diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-10-16 15:21:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-16 15:21:46 +0200 |
commit | 0dbe01483a902c49ecedf4fd36b74353424145a5 (patch) | |
tree | f84891a2b3bc26900f38d2a02cf50785024e1958 | |
parent | 49aa1be9b6edb96adc69c709239a4205c924bea2 (diff) | |
parent | eac36a06517d0c041494e3f08a70a0ca5c951458 (diff) |
Merge pull request #22918 from DualMatrix/node_as_root_2
Fixed setting node as root showing error and making invisible children visible.
-rw-r--r-- | editor/scene_tree_dock.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index a6a014f3bd..8925804710 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -574,6 +574,8 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { editor_data->get_undo_redo().add_do_method(editor, "set_edited_scene", node); 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); + editor_data->get_undo_redo().add_do_method(root, "set_owner", node); _node_replace_owner(root, root, node, MODE_DO); editor_data->get_undo_redo().add_undo_method(root, "set_filename", root->get_filename()); @@ -581,6 +583,9 @@ 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(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"); @@ -982,7 +987,7 @@ void SceneTreeDock::_notification(int p_what) { void SceneTreeDock::_node_replace_owner(Node *p_base, Node *p_node, Node *p_root, ReplaceOwnerMode p_mode) { - if (p_node->get_owner() == p_base || !p_node->get_owner()) { + if (p_node->get_owner() == p_base && p_node != p_root) { UndoRedo *undo_redo = &editor_data->get_undo_redo(); switch (p_mode) { case MODE_BIDI: { |