diff options
author | marynate <mary.w.nate@gmail.com> | 2014-05-08 13:43:19 +0800 |
---|---|---|
committer | marynate <mary.w.nate@gmail.com> | 2014-05-08 13:46:10 +0800 |
commit | 2f5c0e41b59b9eac7a44708a0ad3c3d056d04921 (patch) | |
tree | 4818f82f199a86328878aeac486328e545844d82 /tools/editor/scene_tree_editor.cpp | |
parent | 2495df4ffce5ed3f9d94e0d10801fa6bb6cfba19 (diff) |
Add lock and group icon to scene tree editor
Diffstat (limited to 'tools/editor/scene_tree_editor.cpp')
-rw-r--r-- | tools/editor/scene_tree_editor.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tools/editor/scene_tree_editor.cpp b/tools/editor/scene_tree_editor.cpp index b5928efdac..6645a3695e 100644 --- a/tools/editor/scene_tree_editor.cpp +++ b/tools/editor/scene_tree_editor.cpp @@ -32,6 +32,7 @@ #include "print_string.h" #include "message_queue.h" #include "scene/main/viewport.h" +#include "tools/editor/plugins/canvas_item_editor_plugin.h" Node *SceneTreeEditor::get_scene_node() { @@ -85,6 +86,21 @@ void SceneTreeEditor::_cell_button_pressed(Object *p_item,int p_column,int p_id) undo_redo->add_undo_method(n,v?"show":"hide"); undo_redo->commit_action(); } + + } else if (p_id==BUTTON_LOCK) { + + if (n->is_type("CanvasItem")) { + n->set_meta("_edit_lock_", Variant()); + _update_tree(); + emit_signal("node_changed"); + } + + } else if (p_id==BUTTON_GROUP) { + if (n->is_type("CanvasItem")) { + n->set_meta("_edit_group_", Variant()); + _update_tree(); + emit_signal("node_changed"); + } } } @@ -165,6 +181,16 @@ void SceneTreeEditor::_add_nodes(Node *p_node,TreeItem *p_parent) { if (!p_node->is_connected("visibility_changed",this,"_node_visibility_changed")) p_node->connect("visibility_changed",this,"_node_visibility_changed",varray(p_node)); + bool is_locked = p_node->has_meta("_edit_lock_");//_edit_group_ + if (is_locked) + item->add_button(0,get_icon("Lock", "EditorIcons"), BUTTON_LOCK); + + bool is_grouped = p_node->has_meta("_edit_group_"); + if (is_grouped) + item->add_button(0,get_icon("Group", "EditorIcons"), BUTTON_GROUP); + + + } else if (p_node->is_type("GeometryInstance")) { @@ -627,10 +653,12 @@ void SceneTreeEditor::_bind_methods() { ADD_SIGNAL( MethodInfo("node_selected") ); ADD_SIGNAL( MethodInfo("node_renamed") ); ADD_SIGNAL( MethodInfo("node_prerename") ); + ADD_SIGNAL( MethodInfo("node_changed") ); ADD_SIGNAL( MethodInfo("open") ); ADD_SIGNAL( MethodInfo("open_script") ); + } @@ -729,6 +757,7 @@ void SceneTreeDialog::_bind_methods() { ObjectTypeDB::bind_method("_cancel",&SceneTreeDialog::_cancel); ADD_SIGNAL( MethodInfo("selected",PropertyInfo(Variant::NODE_PATH,"path"))); + } |