diff options
author | TheoXD <redsymbzone@hotmail.com> | 2014-12-18 05:52:27 +0100 |
---|---|---|
committer | TheoXD <redsymbzone@hotmail.com> | 2014-12-18 05:52:27 +0100 |
commit | b3d8a72be92bde888f6240147f704f45c6b394aa (patch) | |
tree | 678bf2a1bc2635a47461fb996608bbc0a16429cb /tools/editor/scene_tree_dock.cpp | |
parent | f27282e0872e1c4bacbe34fc9ce9a0cd167f813d (diff) |
Small clean-up..
Diffstat (limited to 'tools/editor/scene_tree_dock.cpp')
-rw-r--r-- | tools/editor/scene_tree_dock.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/tools/editor/scene_tree_dock.cpp b/tools/editor/scene_tree_dock.cpp index e78bc84237..f5d9e83bf8 100644 --- a/tools/editor/scene_tree_dock.cpp +++ b/tools/editor/scene_tree_dock.cpp @@ -212,7 +212,6 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { if (!_validate_no_foreign()) break; - bool action = false; bool MOVING_DOWN = (p_tool == TOOL_MOVE_DOWN); bool MOVING_UP = !MOVING_DOWN; @@ -237,6 +236,9 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { if (!common_parent || (MOVING_DOWN && highest_id >= common_parent->get_child_count() - MOVING_DOWN) || (MOVING_UP && lowest_id == 0)) break; // one or more nodes can not be moved + if (selection.size() == 1) editor_data->get_undo_redo().create_action("Move Node In Parent"); + if (selection.size() > 1) editor_data->get_undo_redo().create_action("Move Nodes In Parent"); + for (int i = 0; i < selection.size(); i++) { Node *top_node = selection[i]; Node *bottom_node = selection[selection.size() - 1 - i]; @@ -250,16 +252,11 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { int top_node_pos_next = top_node_pos + (MOVING_DOWN ? 1 : -1); int bottom_node_pos_next = bottom_node_pos + (MOVING_DOWN ? 1 : -1); - if (!action && selection.size() == 1) editor_data->get_undo_redo().create_action("Move Node In Parent"); - if (!action && selection.size() > 1) editor_data->get_undo_redo().create_action("Move Nodes In Parent"); - editor_data->get_undo_redo().add_do_method(top_node->get_parent(), "move_child", top_node, top_node_pos_next); editor_data->get_undo_redo().add_undo_method(bottom_node->get_parent(), "move_child", bottom_node, bottom_node_pos); - - action = true; } - if (action) editor_data->get_undo_redo().commit_action(); + editor_data->get_undo_redo().commit_action(); } break; case TOOL_DUPLICATE: { |