From 3ae61f22921520e473a9e95783f0fcc03a5c6a54 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sat, 4 Jun 2016 13:17:56 -0300 Subject: [PATCH] Created a NodeDock with signals and groups --- core/object.cpp | 18 +++ core/object.h | 1 + scene/main/node.cpp | 12 ++ scene/main/node.h | 1 + tools/editor/connections_dialog.cpp | 7 +- tools/editor/editor_node.cpp | 26 +++-- tools/editor/editor_node.h | 4 +- tools/editor/groups_editor.cpp | 20 ++-- tools/editor/groups_editor.h | 4 +- .../icons/icon_connection_and_groups.png | Bin 0 -> 760 bytes tools/editor/node_dock.cpp | 104 ++++++++++++++++++ tools/editor/node_dock.h | 38 +++++++ tools/editor/scene_tree_dock.cpp | 14 +-- tools/editor/scene_tree_dock.h | 3 +- tools/editor/scene_tree_editor.cpp | 33 +++++- tools/editor/scene_tree_editor.h | 4 +- 16 files changed, 252 insertions(+), 37 deletions(-) create mode 100644 tools/editor/icons/icon_connection_and_groups.png create mode 100644 tools/editor/node_dock.cpp create mode 100644 tools/editor/node_dock.h diff --git a/core/object.cpp b/core/object.cpp index d7878fd6233..bedab63281b 100644 --- a/core/object.cpp +++ b/core/object.cpp @@ -1383,6 +1383,24 @@ void Object::get_signal_connection_list(const StringName& p_signal,Listslot_map.size();i++) { + + if (s->slot_map.getv(i).conn.flags&CONNECT_PERSIST) + return true; + } + } + + return false; +} + Error Object::connect(const StringName& p_signal, Object *p_to_object, const StringName& p_to_method,const Vector& p_binds,uint32_t p_flags) { diff --git a/core/object.h b/core/object.h index f4a2472e884..e886aa34598 100644 --- a/core/object.h +++ b/core/object.h @@ -604,6 +604,7 @@ public: void get_signal_list(List *p_signals ) const; void get_signal_connection_list(const StringName& p_signal,List *p_connections) const; void get_all_signal_connections(List *p_connections) const; + bool has_persistent_signal_connections() const; Error connect(const StringName& p_signal, Object *p_to_object, const StringName& p_to_method,const Vector& p_binds=Vector(),uint32_t p_flags=0); void disconnect(const StringName& p_signal, Object *p_to_object, const StringName& p_to_method); diff --git a/scene/main/node.cpp b/scene/main/node.cpp index f2616938416..29925b62f5b 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -1244,7 +1244,19 @@ void Node::get_groups(List *p_groups) const { } +bool Node::has_persistent_groups() const { + const StringName *K=NULL; + + while ((K=data.grouped.next(K))) { + + if (data.grouped[*K].persistent) + return true; + } + + return false; + +} void Node::_print_tree(const Node *p_node) { print_line(String(p_node->get_path_to(this))); diff --git a/scene/main/node.h b/scene/main/node.h index a4683e602fb..cf62e7cdea9 100644 --- a/scene/main/node.h +++ b/scene/main/node.h @@ -223,6 +223,7 @@ public: }; void get_groups(List *p_groups) const; + bool has_persistent_groups() const; void move_child(Node *p_child,int p_pos); void raise(); diff --git a/tools/editor/connections_dialog.cpp b/tools/editor/connections_dialog.cpp index 40828c4664a..e2b8f2884f0 100644 --- a/tools/editor/connections_dialog.cpp +++ b/tools/editor/connections_dialog.cpp @@ -516,6 +516,9 @@ void ConnectionsDock::_connect() { undo_redo->add_undo_method(node,"disconnect",signal,target,dst_method); undo_redo->add_do_method(this,"update_tree"); undo_redo->add_undo_method(this,"update_tree"); + undo_redo->add_do_method(EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor(),"update_tree"); //to force redraw of scene tree + undo_redo->add_undo_method(EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor(),"update_tree"); //to force redraw of scene tree + undo_redo->commit_action(); @@ -577,6 +580,8 @@ void ConnectionsDock::_connect_pressed() { undo_redo->add_undo_method(node,"connect",c.signal,c.target,c.method,Vector(),c.flags); undo_redo->add_do_method(this,"update_tree"); undo_redo->add_undo_method(this,"update_tree"); + undo_redo->add_do_method(EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor(),"update_tree"); //to force redraw of scene tree + undo_redo->add_undo_method(EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor(),"update_tree"); //to force redraw of scene tree undo_redo->commit_action(); c.source->disconnect(c.signal,c.target,c.method); @@ -629,7 +634,7 @@ struct _ConnectionsDockMethodInfoSort { void ConnectionsDock::update_tree() { - tree->clear(); + tree->clear(); if (!node) return; diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index eb5f77d262b..5d0617d8aba 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -1533,7 +1533,7 @@ void EditorNode::push_item(Object *p_object,const String& p_property) { if (!p_object) { property_editor->edit(NULL); - connections_dock->set_node(NULL); + node_dock->set_node(NULL); scene_tree_dock->set_selected(NULL); return; } @@ -1679,7 +1679,7 @@ void EditorNode::_edit_current() { scene_tree_dock->set_selected(NULL); property_editor->edit( NULL ); - connections_dock->set_node(NULL); + node_dock->set_node(NULL); object_menu->set_disabled(true); _display_top_editors(false); @@ -1699,7 +1699,7 @@ void EditorNode::_edit_current() { ERR_FAIL_COND(!current_res); scene_tree_dock->set_selected(NULL); property_editor->edit( current_res ); - connections_dock->set_node(NULL); + node_dock->set_node(NULL); object_menu->set_disabled(false); //resources_dock->add_resource(Ref(current_res)); @@ -1716,7 +1716,7 @@ void EditorNode::_edit_current() { property_editor->edit( current_node ); - connections_dock->set_node( current_node ); + node_dock->set_node( current_node ); scene_tree_dock->set_selected(current_node); object_menu->get_popup()->clear(); @@ -1725,7 +1725,7 @@ void EditorNode::_edit_current() { } else { property_editor->edit( current_obj ); - connections_dock->set_node(NULL); + node_dock->set_node(NULL); //scene_tree_dock->set_selected(current_node); //object_menu->get_popup()->clear(); @@ -3822,6 +3822,10 @@ ScenesDock *EditorNode::get_scenes_dock() { return scenes_dock; } +SceneTreeDock *EditorNode::get_scene_tree_dock() { + + return scene_tree_dock; +} void EditorNode::_instance_request(const String& p_path){ @@ -5793,7 +5797,7 @@ EditorNode::EditorNode() { p->add_check_item(TTR("Deploy with Remote Debug"),RUN_DEPLOY_REMOTE_DEBUG); p->set_item_tooltip(p->get_item_count()-1,TTR("When exporting or deploying, the resulting executable will attempt to connect to the IP of this computer in order to be debugged.")); p->add_check_item(TTR("Small Deploy with Network FS"),RUN_FILE_SERVER); - p->set_item_tooltip(p->get_item_count()-1,TTR("When this option is enabled, export or deploy will produce a minimal executable.\nThe filesystem will be provided from the project by the editor over the network. On Android, deploy will use the USB cable for faster performance. This option speeds up testing for games with a large footprint.")); + p->set_item_tooltip(p->get_item_count()-1,TTR("When this option is enabled, export or deploy will produce a minimal executable.\nThe filesystem will be provided from the project by the editor over the network.\nOn Android, deploy will use the USB cable for faster performance. This option speeds up testing for games with a large footprint.")); p->add_separator(); p->add_check_item(TTR("Visible Collision Shapes"),RUN_DEBUG_COLLISONS); p->set_item_tooltip(p->get_item_count()-1,TTR("Collision shapes and raycast nodes (for 2D and 3D) will be visible on the running game if this option is turned on.")); @@ -5801,9 +5805,9 @@ EditorNode::EditorNode() { p->set_item_tooltip(p->get_item_count()-1,TTR("Navigation meshes and polygons will be visible on the running game if this option is turned on.")); p->add_separator(); p->add_check_item(TTR("Sync Scene Changes"),RUN_LIVE_DEBUG); - p->set_item_tooltip(p->get_item_count()-1,TTR("When this option is turned on, any changes made to the scene in the editor will be replicated in the running game.\nThis works remotely, and is more efficient with networked filesystem.")); + p->set_item_tooltip(p->get_item_count()-1,TTR("When this option is turned on, any changes made to the scene in the editor will be replicated in the running game.\nWhen used remotely on a device, this is more efficient with network filesystem.")); p->add_check_item(TTR("Sync Script Changes"),RUN_RELOAD_SCRIPTS); - p->set_item_tooltip(p->get_item_count()-1,TTR("When this option is turned on, any script that is saved will be reloaded on the running game.\nThis works remotely, and is more efficient with networked filesystem.")); + p->set_item_tooltip(p->get_item_count()-1,TTR("When this option is turned on, any script that is saved will be reloaded on the running game.\nWhen used remotely on a device, this is more efficient with network filesystem.")); p->connect("item_pressed",this,"_menu_option"); /* @@ -6070,9 +6074,9 @@ EditorNode::EditorNode() { property_editor->set_undo_redo(&editor_data.get_undo_redo()); - connections_dock = memnew( ConnectionsDock(this) ); - connections_dock->set_undoredo(&editor_data.get_undo_redo()); - dock_slot[DOCK_SLOT_RIGHT_BL]->add_child(connections_dock); + node_dock = memnew( NodeDock ); + //node_dock->set_undoredo(&editor_data.get_undo_redo()); + dock_slot[DOCK_SLOT_RIGHT_BL]->add_child(node_dock); scenes_dock = memnew( ScenesDock(this) ); scenes_dock->set_name(TTR("FileSystem")); diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h index 736c2ad57a9..7d9b11ed834 100644 --- a/tools/editor/editor_node.h +++ b/tools/editor/editor_node.h @@ -49,6 +49,7 @@ #include "tools/editor/call_dialog.h" #include "tools/editor/reparent_dialog.h" #include "tools/editor/connections_dialog.h" +#include "tools/editor/node_dock.h" #include "tools/editor/settings_config_dialog.h" #include "tools/editor/groups_editor.h" #include "tools/editor/editor_data.h" @@ -272,7 +273,7 @@ private: SceneTreeDock *scene_tree_dock; //ResourcesDock *resources_dock; PropertyEditor *property_editor; - ConnectionsDock *connections_dock; + NodeDock *node_dock; VBoxContainer *prop_editor_vb; ScenesDock *scenes_dock; EditorRunNative *run_native; @@ -665,6 +666,7 @@ public: void request_instance_scene(const String &p_path); ScenesDock *get_scenes_dock(); + SceneTreeDock *get_scene_tree_dock(); static UndoRedo* get_undo_redo() { return &singleton->editor_data.get_undo_redo(); } EditorSelection *get_editor_selection() { return editor_selection; } diff --git a/tools/editor/groups_editor.cpp b/tools/editor/groups_editor.cpp index 906ee27d1b0..898e1e115e4 100644 --- a/tools/editor/groups_editor.cpp +++ b/tools/editor/groups_editor.cpp @@ -30,6 +30,7 @@ #include "scene/gui/box_container.h" #include "scene/gui/label.h" +#include "editor_node.h" void GroupsEditor::_add_group(const String& p_group) { @@ -47,8 +48,10 @@ void GroupsEditor::_add_group(const String& p_group) { undo_redo->add_do_method(node,"add_to_group",name,true); undo_redo->add_do_method(this,"update_tree"); - undo_redo->add_undo_method(node,"remove_from_group",name,get_text()); + undo_redo->add_undo_method(node,"remove_from_group",name); undo_redo->add_undo_method(this,"update_tree"); + undo_redo->add_do_method(EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor(),"update_tree"); //to force redraw of scene tree + undo_redo->add_undo_method(EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor(),"update_tree"); //to force redraw of scene tree undo_redo->commit_action(); @@ -72,6 +75,8 @@ void GroupsEditor::_remove_group(Object *p_item, int p_column, int p_id) { undo_redo->add_do_method(this,"update_tree"); undo_redo->add_undo_method(node,"add_to_group",name,true); undo_redo->add_undo_method(this,"update_tree"); + undo_redo->add_do_method(EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor(),"update_tree"); //to force redraw of scene tree + undo_redo->add_undo_method(EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor(),"update_tree"); //to force redraw of scene tree undo_redo->commit_action(); } @@ -125,14 +130,10 @@ GroupsEditor::GroupsEditor() { node=NULL; - set_title(TTR("Group Editor")); - - VBoxContainer *vbc = memnew( VBoxContainer ); - add_child(vbc); - set_child_rect(vbc); + VBoxContainer *vbc = this; HBoxContainer *hbc = memnew( HBoxContainer ); - vbc->add_margin_child(TTR("Group"), hbc); + vbc->add_child(hbc); group_name = memnew( LineEdit ); group_name->set_h_size_flags(SIZE_EXPAND_FILL); @@ -147,10 +148,9 @@ GroupsEditor::GroupsEditor() { tree = memnew( Tree ); tree->set_hide_root(true); tree->set_v_size_flags(SIZE_EXPAND_FILL); - vbc->add_margin_child(TTR("Node Group(s)"), tree, true); + vbc->add_child(tree); tree->connect("button_pressed",this,"_remove_group"); - - get_ok()->set_text(TTR("Close")); + add_constant_override("separation",3*EDSCALE); } GroupsEditor::~GroupsEditor() diff --git a/tools/editor/groups_editor.h b/tools/editor/groups_editor.h index 6a897d0cbb4..6edb5771407 100644 --- a/tools/editor/groups_editor.h +++ b/tools/editor/groups_editor.h @@ -39,9 +39,9 @@ @author Juan Linietsky */ -class GroupsEditor : public AcceptDialog { +class GroupsEditor : public VBoxContainer { - OBJ_TYPE(GroupsEditor,AcceptDialog); + OBJ_TYPE(GroupsEditor,VBoxContainer); Node *node; diff --git a/tools/editor/icons/icon_connection_and_groups.png b/tools/editor/icons/icon_connection_and_groups.png new file mode 100644 index 0000000000000000000000000000000000000000..1fe4a28ed7e31b6e229d87e81fa664aafebb6132 GIT binary patch literal 760 zcmVWFU8GbZ8()Nlj2>E@cM*00LY|L_t(I%bk)>YaB-q z#eda3+MQWu6(p@eG6eS_xy80l0z)9^AYt+a0{Ilt!G`!`d{A`D9|#x{e6Ydazz6$m z$e)wJ*q0C(p^K0h?XG6!nbmYp<&asiF$O^%G+ofuRqxd+QB|2vr~TvOPDFFirpn$4sys)tFR}@9h z>bm|~M0QtKSD!>tbOK-tk`?VF})u6XZ%I6ORjFvrq3 z5drA6UEfDnL_!GRb8GG2s!9mqtI=q*0buI7e%TfnwbbX)00m%^B>BmE|A~kM5m`7t zKVJthYinz{G3GWf0LH*MFa@;oPm@VwjYeilVh z1$0Ej8e^(%xBGZyWo4r*%U@LW8el|(IF29XdHy=jb0p7milU&ZDv9IxVg~(wfBWq0 z?ANAgK5khF@NRi|dHdw#OePy4gx^Kv`kX5s*qtqzb50|G@p$}QmSt0*1onV$TFo~%gscHgS7qZ~6~>N)UX>pS9fp0000set_pressed(true); + connections_button->set_pressed(false); + groups->show(); + connections->hide(); +} + +void NodeDock::show_connections(){ + + groups_button->set_pressed(false); + connections_button->set_pressed(true); + groups->hide(); + connections->show(); +} + + +void NodeDock::_bind_methods() { + + ObjectTypeDB::bind_method(_MD("show_groups"),&NodeDock::show_groups); + ObjectTypeDB::bind_method(_MD("show_connections"),&NodeDock::show_connections); +} + +void NodeDock::_notification(int p_what) { + + if (p_what==NOTIFICATION_ENTER_TREE) { + connections_button->set_icon(get_icon("Connect","EditorIcons")); + groups_button->set_icon(get_icon("Groups","EditorIcons")); + } +} + +NodeDock *NodeDock::singleton=NULL; + +void NodeDock::set_node(Node* p_node) { + + connections->set_node(p_node); + groups->set_current(p_node); + + if (p_node) { + if (connections_button->is_pressed()) + connections->show(); + else + groups->show(); + + mode_hb->show(); + select_a_node->hide(); + } else { + connections->hide(); + groups->hide(); + mode_hb->hide(); + select_a_node->show(); + } +} + +NodeDock::NodeDock() +{ + singleton=this; + + set_name(TTR("Node")); + mode_hb = memnew( HBoxContainer ); + add_child(mode_hb); + mode_hb->hide(); + + + connections_button = memnew( ToolButton ); + connections_button->set_text(TTR("Signals")); + connections_button->set_toggle_mode(true); + connections_button->set_pressed(true); + connections_button->set_h_size_flags(SIZE_EXPAND_FILL); + mode_hb->add_child(connections_button); + connections_button->connect("pressed",this,"show_connections"); + + groups_button = memnew( ToolButton ); + groups_button->set_text(TTR("Groups")); + groups_button->set_toggle_mode(true); + groups_button->set_pressed(false); + groups_button->set_h_size_flags(SIZE_EXPAND_FILL); + mode_hb->add_child(groups_button); + groups_button->connect("pressed",this,"show_groups"); + + connections = memnew( ConnectionsDock(EditorNode::get_singleton()) ); + connections->set_undoredo(EditorNode::get_singleton()->get_undo_redo()); + add_child(connections); + connections->set_v_size_flags(SIZE_EXPAND_FILL); + connections->hide(); + + groups = memnew( GroupsEditor ); + groups->set_undo_redo(EditorNode::get_singleton()->get_undo_redo()); + add_child(groups); + groups->set_v_size_flags(SIZE_EXPAND_FILL); + groups->hide(); + + select_a_node = memnew( Label ); + select_a_node->set_text(TTR("Select a Node to edit Signals and Groups.")); + select_a_node->set_v_size_flags(SIZE_EXPAND_FILL); + select_a_node->set_valign(Label::VALIGN_CENTER); + select_a_node->set_align(Label::ALIGN_CENTER); + select_a_node->set_autowrap(true); + add_child(select_a_node); + +} diff --git a/tools/editor/node_dock.h b/tools/editor/node_dock.h new file mode 100644 index 00000000000..02312b90b55 --- /dev/null +++ b/tools/editor/node_dock.h @@ -0,0 +1,38 @@ +#ifndef NODE_DOCK_H +#define NODE_DOCK_H + +#include "connections_dialog.h" +#include "groups_editor.h" + +class NodeDock : public VBoxContainer { + + OBJ_TYPE(NodeDock,VBoxContainer); + + ToolButton *connections_button; + ToolButton *groups_button; + + ConnectionsDock *connections; + GroupsEditor *groups; + + HBoxContainer *mode_hb; + + Label* select_a_node; + +protected: + + static void _bind_methods(); + void _notification(int p_what); + +public: + + static NodeDock *singleton; + + void set_node(Node* p_node); + + void show_groups(); + void show_connections(); + + NodeDock(); +}; + +#endif // NODE_DOCK_H diff --git a/tools/editor/scene_tree_dock.cpp b/tools/editor/scene_tree_dock.cpp index 6dba04dd4fc..9612305a0f5 100644 --- a/tools/editor/scene_tree_dock.cpp +++ b/tools/editor/scene_tree_dock.cpp @@ -271,8 +271,8 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { break; //if (!_validate_no_foreign()) // break; - groups_editor->set_current(current); - groups_editor->popup_centered_ratio(); + //groups_editor->set_current(current); + //groups_editor->popup_centered_ratio(); } break; case TOOL_SCRIPT: { @@ -1685,8 +1685,8 @@ void SceneTreeDock::_tree_rmb(const Vector2& p_menu_pos) { menu->add_icon_item(get_icon("Instance","EditorIcons"),TTR("Instance Child Scene"),TOOL_INSTANCE); menu->add_separator(); menu->add_icon_item(get_icon("Reload","EditorIcons"),TTR("Change Type"),TOOL_REPLACE); - menu->add_separator(); - menu->add_icon_item(get_icon("Groups","EditorIcons"),TTR("Edit Groups"),TOOL_GROUP); + //menu->add_separator(); moved to their own dock + //menu->add_icon_item(get_icon("Groups","EditorIcons"),TTR("Edit Groups"),TOOL_GROUP); //menu->add_icon_item(get_icon("Connect","EditorIcons"),TTR("Edit Connections"),TOOL_CONNECT); menu->add_separator(); menu->add_icon_item(get_icon("Script","EditorIcons"),TTR("Add Script"),TOOL_SCRIPT); @@ -1820,9 +1820,9 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor,Node *p_scene_root,EditorSelec add_child(create_dialog); create_dialog->connect("create",this,"_create"); - groups_editor = memnew( GroupsEditor ); - add_child(groups_editor); - groups_editor->set_undo_redo(&editor_data->get_undo_redo()); + //groups_editor = memnew( GroupsEditor ); + //add_child(groups_editor); + //groups_editor->set_undo_redo(&editor_data->get_undo_redo()); //connect_dialog = memnew( ConnectionsDialog(p_editor) ); //add_child(connect_dialog); diff --git a/tools/editor/scene_tree_dock.h b/tools/editor/scene_tree_dock.h index b1a2dcb689b..60bec9b4f4d 100644 --- a/tools/editor/scene_tree_dock.h +++ b/tools/editor/scene_tree_dock.h @@ -86,7 +86,7 @@ class SceneTreeDock : public VBoxContainer { EditorData *editor_data; EditorSelection *editor_selection; - GroupsEditor *groups_editor; + //GroupsEditor *groups_editor; //ConnectionsDialog *connect_dialog; ScriptCreateDialog *script_create_dialog; AcceptDialog *accept; @@ -166,6 +166,7 @@ public: void perform_node_renames(Node* p_base,List > *p_renames, Map, Set > *r_rem_anims=NULL); SceneTreeEditor *get_tree_editor() { return scene_tree; } + SceneTreeDock(EditorNode *p_editor,Node *p_scene_root,EditorSelection *p_editor_selection,EditorData &p_editor_data); }; diff --git a/tools/editor/scene_tree_editor.cpp b/tools/editor/scene_tree_editor.cpp index 09a5e7860fe..bc12ff23e55 100644 --- a/tools/editor/scene_tree_editor.cpp +++ b/tools/editor/scene_tree_editor.cpp @@ -216,6 +216,17 @@ void SceneTreeEditor::_cell_button_pressed(Object *p_item,int p_column,int p_id) warning->set_text(config_err); warning->popup_centered_minsize(); + } else if (p_id==BUTTON_SIGNALS) { + + item->select(0); + NodeDock::singleton->get_parent()->call("set_current_tab",NodeDock::singleton->get_index()); + NodeDock::singleton->show_connections(); + + } else if (p_id==BUTTON_GROUPS) { + + item->select(0); + NodeDock::singleton->get_parent()->call("set_current_tab",NodeDock::singleton->get_index()); + NodeDock::singleton->show_groups(); } } @@ -285,10 +296,25 @@ bool SceneTreeEditor::_add_nodes(Node *p_node,TreeItem *p_parent) { } } - String warning = p_node->get_configuration_warning(); - if (warning!=String()) { - item->add_button(0,get_icon("NodeWarning","EditorIcons"),BUTTON_WARNING); + + if (can_rename) { //should be can edit.. + + String warning = p_node->get_configuration_warning(); + if (warning!=String()) { + item->add_button(0,get_icon("NodeWarning","EditorIcons"),BUTTON_WARNING); + } + + bool has_connections = p_node->has_persistent_signal_connections(); + bool has_groups = p_node->has_persistent_groups(); + + if (has_connections && has_groups) { + item->add_button(0,get_icon("ConnectionAndGroups","EditorIcons"),BUTTON_SIGNALS); + } else if (has_connections) { + item->add_button(0,get_icon("Connect","EditorIcons"),BUTTON_SIGNALS); + } else if (has_groups) { + item->add_button(0,get_icon("Groups","EditorIcons"),BUTTON_GROUPS); + } } if (p_node==get_scene_node() && p_node->get_scene_inherited_state().is_valid()) { @@ -999,6 +1025,7 @@ void SceneTreeEditor::_bind_methods() { ObjectTypeDB::bind_method(_MD("can_drop_data_fw"), &SceneTreeEditor::can_drop_data_fw); ObjectTypeDB::bind_method(_MD("drop_data_fw"), &SceneTreeEditor::drop_data_fw); + ObjectTypeDB::bind_method(_MD("update_tree"), &SceneTreeEditor::update_tree); ADD_SIGNAL( MethodInfo("node_selected") ); ADD_SIGNAL( MethodInfo("node_renamed") ); diff --git a/tools/editor/scene_tree_editor.h b/tools/editor/scene_tree_editor.h index 94be75ea8ea..ae0afa32ec7 100644 --- a/tools/editor/scene_tree_editor.h +++ b/tools/editor/scene_tree_editor.h @@ -49,7 +49,9 @@ class SceneTreeEditor : public Control { BUTTON_SCRIPT=2, BUTTON_LOCK=3, BUTTON_GROUP=4, - BUTTON_WARNING=5 + BUTTON_WARNING=5, + BUTTON_SIGNALS=6, + BUTTON_GROUPS=7, }; enum {