diff options
author | geequlim <geequlim@gmail.com> | 2017-11-23 15:23:24 +0800 |
---|---|---|
committer | geequlim <geequlim@gmail.com> | 2017-11-23 15:23:24 +0800 |
commit | 9ef720908f1e08cf46b9a118bee800e1c6f3df33 (patch) | |
tree | b7cb537dc14fdfc6e239246e426f7f8ebf9f33ce | |
parent | 62d86b15887371c59f99bfa37dbe2fcaf80478f7 (diff) |
Improved update for remote scene tree and remote object.
-rw-r--r-- | editor/scene_tree_dock.cpp | 4 | ||||
-rw-r--r-- | editor/script_editor_debugger.cpp | 26 |
2 files changed, 16 insertions, 14 deletions
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index ca3f13b07d..cba55cac77 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -1852,6 +1852,8 @@ void SceneTreeDock::_remote_tree_selected() { remote_tree->show(); edit_remote->set_pressed(true); edit_local->set_pressed(false); + + emit_signal("remote_tree_selected"); } void SceneTreeDock::_local_tree_selected() { @@ -1894,6 +1896,8 @@ void SceneTreeDock::_bind_methods() { ClassDB::bind_method(D_METHOD("_local_tree_selected"), &SceneTreeDock::_local_tree_selected); ClassDB::bind_method(D_METHOD("instance"), &SceneTreeDock::instance); + + ADD_SIGNAL(MethodInfo("remote_tree_selected")); } SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSelection *p_editor_selection, EditorData &p_editor_data) { diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp index 8974bda926..a06732c563 100644 --- a/editor/script_editor_debugger.cpp +++ b/editor/script_editor_debugger.cpp @@ -955,31 +955,28 @@ void ScriptEditorDebugger::_notification(int p_what) { case NOTIFICATION_PROCESS: { if (connection.is_valid()) { + inspect_scene_tree_timeout -= get_process_delta_time(); if (inspect_scene_tree_timeout < 0) { inspect_scene_tree_timeout = EditorSettings::get_singleton()->get("debugger/remote_scene_tree_refresh_interval"); if (inspect_scene_tree->is_visible_in_tree()) { _scene_tree_request(); - - if (inspected_object_id != 0) { - //take the chance and re-inspect selected object - Array msg; - msg.push_back("inspect_object"); - msg.push_back(inspected_object_id); - ppeer->put_var(msg); - } } } inspect_edited_object_timeout -= get_process_delta_time(); if (inspect_edited_object_timeout < 0) { inspect_edited_object_timeout = EditorSettings::get_singleton()->get("debugger/remote_inspect_refresh_interval"); - if (inspect_scene_tree->is_visible_in_tree() && inspected_object_id) { - //take the chance and re-inspect selected object - Array msg; - msg.push_back("inspect_object"); - msg.push_back(inspected_object_id); - ppeer->put_var(msg); + if (inspected_object_id) { + if (ScriptEditorDebuggerInspectedObject *obj = Object::cast_to<ScriptEditorDebuggerInspectedObject>(ObjectDB::get_instance(editor->get_editor_history()->get_current()))) { + if (obj->remote_object_id == inspected_object_id) { + //take the chance and re-inspect selected object + Array msg; + msg.push_back("inspect_object"); + msg.push_back(inspected_object_id); + ppeer->put_var(msg); + } + } } } } @@ -1850,6 +1847,7 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) { inspect_scene_tree = memnew(Tree); EditorNode::get_singleton()->get_scene_tree_dock()->add_remote_tree_editor(inspect_scene_tree); + EditorNode::get_singleton()->get_scene_tree_dock()->connect("remote_tree_selected", this, "_scene_tree_selected"); inspect_scene_tree->set_v_size_flags(SIZE_EXPAND_FILL); inspect_scene_tree->connect("cell_selected", this, "_scene_tree_selected"); inspect_scene_tree->connect("item_collapsed", this, "_scene_tree_folded"); |