summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-11-15 22:21:29 -0300
committerJuan Linietsky <reduzio@gmail.com>2017-11-15 22:21:49 -0300
commitdc463e1e42ac919d99d763c0127436877fc4efc5 (patch)
treec0c951d2c2972b11e563bd7e53837d6b2c5cb0d7
parent6b34f10ab1dc92fa0addf57cb3cdcce5fd109d5b (diff)
Add support for remote debug in scene tree.
-rw-r--r--editor/scene_tree_dock.cpp60
-rw-r--r--editor/scene_tree_dock.h10
2 files changed, 70 insertions, 0 deletions
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index 7ada335007..b5d5bc6045 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -1887,6 +1887,43 @@ void SceneTreeDock::open_script_dialog(Node *p_for_node) {
_tool_selected(TOOL_ATTACH_SCRIPT);
}
+void SceneTreeDock::add_remote_tree_editor(Control *p_remote) {
+ ERR_FAIL_COND(remote_tree != NULL);
+ add_child(p_remote);
+ remote_tree = p_remote;
+ remote_tree->hide();
+}
+
+void SceneTreeDock::show_remote_tree() {
+
+ button_hb->show();
+ _remote_tree_selected();
+}
+
+void SceneTreeDock::hide_remote_tree() {
+
+ button_hb->hide();
+ _local_tree_selected();
+}
+
+void SceneTreeDock::_remote_tree_selected() {
+
+ scene_tree->hide();
+ if (remote_tree)
+ remote_tree->show();
+ edit_remote->set_pressed(true);
+ edit_local->set_pressed(false);
+}
+
+void SceneTreeDock::_local_tree_selected() {
+
+ scene_tree->show();
+ if (remote_tree)
+ remote_tree->hide();
+ edit_remote->set_pressed(false);
+ edit_local->set_pressed(true);
+}
+
void SceneTreeDock::_bind_methods() {
ClassDB::bind_method(D_METHOD("_tool_selected"), &SceneTreeDock::_tool_selected, DEFVAL(false));
@@ -1912,6 +1949,8 @@ void SceneTreeDock::_bind_methods() {
ClassDB::bind_method(D_METHOD("_tree_rmb"), &SceneTreeDock::_tree_rmb);
ClassDB::bind_method(D_METHOD("_filter_changed"), &SceneTreeDock::_filter_changed);
ClassDB::bind_method(D_METHOD("_focus_node"), &SceneTreeDock::_focus_node);
+ ClassDB::bind_method(D_METHOD("_remote_tree_selected"), &SceneTreeDock::_remote_tree_selected);
+ ClassDB::bind_method(D_METHOD("_local_tree_selected"), &SceneTreeDock::_local_tree_selected);
ClassDB::bind_method(D_METHOD("instance"), &SceneTreeDock::instance);
}
@@ -1982,7 +2021,28 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel
button_clear_script = tb;
tb->hide();
+ button_hb = memnew(HBoxContainer);
+ vbc->add_child(button_hb);
+
+ edit_remote = memnew(ToolButton);
+ button_hb->add_child(edit_remote);
+ edit_remote->set_h_size_flags(SIZE_EXPAND_FILL);
+ edit_remote->set_text(TTR("Remote"));
+ edit_remote->set_toggle_mode(true);
+ edit_remote->connect("pressed", this, "_remote_tree_selected");
+
+ edit_local = memnew(ToolButton);
+ button_hb->add_child(edit_local);
+ edit_local->set_h_size_flags(SIZE_EXPAND_FILL);
+ edit_local->set_text(TTR("Local"));
+ edit_local->set_toggle_mode(true);
+ edit_local->connect("pressed", this, "_local_tree_selected");
+
+ remote_tree = NULL;
+ button_hb->hide();
+
scene_tree = memnew(SceneTreeEditor(false, true, true));
+
vbc->add_child(scene_tree);
scene_tree->set_v_size_flags(SIZE_EXPAND | SIZE_FILL);
scene_tree->connect("rmb_pressed", this, "_tree_rmb");
diff --git a/editor/scene_tree_dock.h b/editor/scene_tree_dock.h
index f61c67bb13..97d3c4748a 100644
--- a/editor/scene_tree_dock.h
+++ b/editor/scene_tree_dock.h
@@ -95,7 +95,10 @@ class SceneTreeDock : public VBoxContainer {
ToolButton *button_create_script;
ToolButton *button_clear_script;
+ HBoxContainer *button_hb;
+ ToolButton *edit_local, *edit_remote;
SceneTreeEditor *scene_tree;
+ Control *remote_tree;
HBoxContainer *tool_hbc;
void _tool_selected(int p_tool, bool p_confirm_override = false);
@@ -174,6 +177,9 @@ class SceneTreeDock : public VBoxContainer {
void _file_selected(String p_file);
+ void _remote_tree_selected();
+ void _local_tree_selected();
+
protected:
void _notification(int p_what);
static void _bind_methods();
@@ -194,6 +200,10 @@ public:
SceneTreeEditor *get_tree_editor() { return scene_tree; }
EditorData *get_editor_data() { return editor_data; }
+ void add_remote_tree_editor(Control *p_remote);
+ void show_remote_tree();
+ void hide_remote_tree();
+
void open_script_dialog(Node *p_for_node);
SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSelection *p_editor_selection, EditorData &p_editor_data);
};