Skip to content

Commit

Permalink
Merge pull request #13209 from GodotExplorer/debugger-a
Browse files Browse the repository at this point in the history
Improved update for remote scene tree and remote object.
  • Loading branch information
akien-mga authored Nov 23, 2017
2 parents ee3179f + 9ef7209 commit 3a33725
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
4 changes: 4 additions & 0 deletions editor/scene_tree_dock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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) {
Expand Down
26 changes: 12 additions & 14 deletions editor/script_editor_debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
}
}
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit 3a33725

Please sign in to comment.