Don't push remote object if the same remote object is already in the history

Fix error inspector capitalization with regular objects after insepct remote objects
This commit is contained in:
geequlim 2017-09-03 17:05:50 +08:00
parent 29cd034e23
commit 31b1a77dbc
3 changed files with 16 additions and 7 deletions

View File

@ -86,6 +86,20 @@ void EditorHistory::_add_object(ObjectID p_object, const String &p_property, int
bool has_prev = current >= 0 && current < history.size();
if (has_prev) {
if (obj->is_type("ScriptEditorDebuggerInspectedObject")) {
for (int i = current; i >= 0; i--) {
Object *pre_obj = ObjectDB::get_instance(get_history_obj(i));
if (pre_obj->is_type("ScriptEditorDebuggerInspectedObject")) {
if (pre_obj->call("get_remote_object_id") == obj->call("get_remote_object_id")) {
History &pr = history[i];
pr.path[pr.path.size() - 1] = o;
current = i;
return;
}
}
}
}
history.resize(current + 1); //clip history to next
}

View File

@ -3618,6 +3618,7 @@ void PropertyEditor::edit(Object *p_object) {
if (obj) {
set_enable_capitalize_paths(true);
obj->remove_change_receptor(this);
if (obj->is_type("ScriptEditorDebuggerInspectedObject")) {

View File

@ -497,7 +497,6 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
}
inspected_object_id = id;
debugObj->update();
editor->push_item(debugObj, "");
} else if (p_msg == "message:video_mem") {
@ -1000,12 +999,7 @@ void ScriptEditorDebugger::_notification(int p_what) {
if (inspect_scene_tree->is_visible())
_scene_tree_request();
bool need_query_instance = inspected_object_id != 0;
need_query_instance = need_query_instance && editor->get_property_editor()->is_visible();
need_query_instance = need_query_instance && (editor->get_property_editor()->obj != NULL);
need_query_instance = need_query_instance && editor->get_property_editor()->obj->is_type("ScriptEditorDebuggerInspectedObject");
need_query_instance = need_query_instance && ((ObjectID)editor->get_property_editor()->obj->call("get_remote_object_id") != 0);
if (need_query_instance) {
if (inspected_object_id != 0 && editor->get_property_editor()->is_visible() && (editor->get_property_editor()->obj != NULL) && editor->get_property_editor()->obj->is_type("ScriptEditorDebuggerInspectedObject") && ((ObjectID)editor->get_property_editor()->obj->call("get_remote_object_id") != 0)) {
Array msg;
msg.push_back("inspect_object");
msg.push_back(inspected_object_id);