Fix "Make Scene Root" deleting previous root whenever focusing another scene
Hopefully fixes #24484 and fixes #27222.
This commit is contained in:
parent
3481c47e71
commit
cfc779ccf0
|
@ -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().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(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(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(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(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(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(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(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(), "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(root, "set_owner", (Object *)NULL);
|
||||||
editor_data->get_undo_redo().add_undo_method(node, "set_owner", root);
|
editor_data->get_undo_redo().add_undo_method(node, "set_owner", root);
|
||||||
|
|
||||||
_node_replace_owner(root, root, root, MODE_UNDO);
|
_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_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_method(scene_tree, "update_tree");
|
||||||
editor_data->get_undo_redo().add_undo_reference(root);
|
|
||||||
editor_data->get_undo_redo().commit_action();
|
editor_data->get_undo_redo().commit_action();
|
||||||
} break;
|
} break;
|
||||||
case TOOL_MULTI_EDIT: {
|
case TOOL_MULTI_EDIT: {
|
||||||
|
|
Loading…
Reference in New Issue