|
@@ -2300,7 +2300,6 @@ void SceneTreeDock::_node_reparent(NodePath p_path, bool p_keep_global_xform) {
|
|
|
ERR_FAIL_NULL(new_parent);
|
|
|
|
|
|
List<Node *> selection = editor_selection->get_selected_node_list();
|
|
|
- List<Node *> full_selection = editor_selection->get_full_selected_node_list();
|
|
|
|
|
|
if (selection.is_empty()) {
|
|
|
return; // Nothing to reparent.
|
|
@@ -2313,10 +2312,6 @@ void SceneTreeDock::_node_reparent(NodePath p_path, bool p_keep_global_xform) {
|
|
|
}
|
|
|
|
|
|
_do_reparent(new_parent, -1, nodes, p_keep_global_xform);
|
|
|
-
|
|
|
- for (Node *E : full_selection) {
|
|
|
- editor_selection->add_node(E);
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
void SceneTreeDock::_do_reparent(Node *p_new_parent, int p_position_in_parent, Vector<Node *> p_nodes, bool p_keep_global_xform) {
|
|
@@ -2509,12 +2504,20 @@ void SceneTreeDock::_do_reparent(Node *p_new_parent, int p_position_in_parent, V
|
|
|
|
|
|
perform_node_renames(nullptr, &path_renames);
|
|
|
|
|
|
- undo_redo->commit_action();
|
|
|
+ undo_redo->add_do_method(editor_selection, "clear");
|
|
|
+ undo_redo->add_undo_method(editor_selection, "clear");
|
|
|
+ List<Node *> full_selection = editor_selection->get_full_selected_node_list();
|
|
|
+ for (Node *E : full_selection) {
|
|
|
+ undo_redo->add_do_method(editor_selection, "add_node", E);
|
|
|
+ undo_redo->add_undo_method(editor_selection, "add_node", E);
|
|
|
+ }
|
|
|
|
|
|
if (need_edit) {
|
|
|
EditorNode::get_singleton()->edit_current();
|
|
|
editor_selection->clear();
|
|
|
}
|
|
|
+
|
|
|
+ undo_redo->commit_action();
|
|
|
}
|
|
|
|
|
|
void SceneTreeDock::_script_created(Ref<Script> p_script) {
|
|
@@ -3653,7 +3656,6 @@ void SceneTreeDock::_nodes_dragged(const Array &p_nodes, NodePath p_to, int p_ty
|
|
|
}
|
|
|
|
|
|
List<Node *> selection = editor_selection->get_selected_node_list();
|
|
|
- List<Node *> full_selection = editor_selection->get_full_selected_node_list();
|
|
|
|
|
|
if (selection.is_empty()) {
|
|
|
return; //nothing to reparent
|
|
@@ -3673,10 +3675,6 @@ void SceneTreeDock::_nodes_dragged(const Array &p_nodes, NodePath p_to, int p_ty
|
|
|
|
|
|
_normalize_drop(to_node, to_pos, p_type);
|
|
|
_do_reparent(to_node, to_pos, nodes, !Input::get_singleton()->is_key_pressed(Key::SHIFT));
|
|
|
-
|
|
|
- for (Node *E : full_selection) {
|
|
|
- editor_selection->add_node(E);
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
void SceneTreeDock::_add_children_to_popup(Object *p_obj, int p_depth) {
|