diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-09-29 21:37:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-29 21:37:28 +0200 |
commit | ae6c390eb215c8c3f27f0f7a249cb2c07fcfc08a (patch) | |
tree | 1587bf01f58e296427776415b64ff5e7c542edca /editor/scene_tree_dock.cpp | |
parent | cd63cc7df184f8e11dfe7da82d82d51c00b4474e (diff) | |
parent | cfc779ccf080de0ec8c4372acd99a426d33ccabe (diff) |
Merge pull request #32412 from bojidar-bg/27222-make-scene-root-destructive
Fix "Make Scene Root" deleting previous root whenever focusing another scene
Diffstat (limited to 'editor/scene_tree_dock.cpp')
-rw-r--r-- | editor/scene_tree_dock.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 9afe99c16d..98ab1bfb54 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -714,9 +714,8 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { editor_data->get_undo_redo().create_action(TTR("Make node as Root")); editor_data->get_undo_redo().add_do_method(node->get_parent(), "remove_child", node); - editor_data->get_undo_redo().add_do_method(root->get_parent(), "remove_child", root); - editor_data->get_undo_redo().add_do_method(node, "add_child", root); editor_data->get_undo_redo().add_do_method(editor, "set_edited_scene", node); + editor_data->get_undo_redo().add_do_method(node, "add_child", root); editor_data->get_undo_redo().add_do_method(node, "set_filename", root->get_filename()); editor_data->get_undo_redo().add_do_method(root, "set_filename", String()); editor_data->get_undo_redo().add_do_method(node, "set_owner", (Object *)NULL); @@ -728,14 +727,13 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { editor_data->get_undo_redo().add_undo_method(node, "remove_child", root); editor_data->get_undo_redo().add_undo_method(editor, "set_edited_scene", root); editor_data->get_undo_redo().add_undo_method(node->get_parent(), "add_child", node); + editor_data->get_undo_redo().add_undo_method(node->get_parent(), "move_child", node, node->get_index()); editor_data->get_undo_redo().add_undo_method(root, "set_owner", (Object *)NULL); editor_data->get_undo_redo().add_undo_method(node, "set_owner", root); - _node_replace_owner(root, root, root, MODE_UNDO); editor_data->get_undo_redo().add_do_method(scene_tree, "update_tree"); editor_data->get_undo_redo().add_undo_method(scene_tree, "update_tree"); - editor_data->get_undo_redo().add_undo_reference(root); editor_data->get_undo_redo().commit_action(); } break; case TOOL_MULTI_EDIT: { |