Add support for remote debug in scene tree.

This commit is contained in:
Juan Linietsky 2017-11-15 22:21:29 -03:00
parent 6b34f10ab1
commit dc463e1e42
2 changed files with 70 additions and 0 deletions

View file

@ -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");

View file

@ -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);
};