Skip to content

Commit ed8baa3

Browse files
committed
Merge pull request #96236 from kleonc/scene_tree_dock_fix_trying_to_remove_internal_node
Fix `SceneTreeDock` invalid state after trying to remove internal Node
2 parents 2e4c07b + 5ae85a4 commit ed8baa3

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

editor/scene_tree_dock.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2650,6 +2650,13 @@ void SceneTreeDock::_delete_confirm(bool p_cut) {
26502650
}
26512651
}
26522652

2653+
if (!entire_scene) {
2654+
for (const Node *E : remove_list) {
2655+
// `move_child` + `get_index` doesn't really work for internal nodes.
2656+
ERR_FAIL_COND_MSG(E->get_internal_mode() != INTERNAL_MODE_DISABLED, "Trying to remove internal node, this is not supported.");
2657+
}
2658+
}
2659+
26532660
EditorNode::get_singleton()->hide_unused_editors(this);
26542661

26552662
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
@@ -2662,10 +2669,6 @@ void SceneTreeDock::_delete_confirm(bool p_cut) {
26622669
undo_redo->add_undo_method(scene_tree, "update_tree");
26632670
undo_redo->add_undo_reference(edited_scene);
26642671
} else {
2665-
for (const Node *E : remove_list) {
2666-
// `move_child` + `get_index` doesn't really work for internal nodes.
2667-
ERR_FAIL_COND_MSG(E->get_internal_mode() != INTERNAL_MODE_DISABLED, "Trying to remove internal node, this is not supported.");
2668-
}
26692672
if (delete_tracks_checkbox->is_pressed() || p_cut) {
26702673
remove_list.sort_custom<Node::Comparator>(); // Sort nodes to keep positions.
26712674
HashMap<Node *, NodePath> path_renames;

0 commit comments

Comments
 (0)