From 6aad35a2fb6fcedef644a4727452103ebca90e55 Mon Sep 17 00:00:00 2001 From: kleonc <9283098+kleonc@users.noreply.github.com> Date: Wed, 28 Aug 2024 19:06:31 +0200 Subject: [PATCH] Fix SceneTreeDock invalid state after trying to remove internal Node --- editor/scene_tree_dock.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 02c8a03ac6ed..ef7f7be6cd70 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -2650,6 +2650,12 @@ void SceneTreeDock::_delete_confirm(bool p_cut) { } } + for (const Node *E : remove_list) { + // `move_child` + `get_index` doesn't really work for internal nodes. + ERR_FAIL_COND_MSG(E->get_internal_mode() != INTERNAL_MODE_DISABLED, "Trying to remove internal node, this is not supported."); + } + } + EditorNode::get_singleton()->hide_unused_editors(this); EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton(); @@ -2662,10 +2668,6 @@ void SceneTreeDock::_delete_confirm(bool p_cut) { undo_redo->add_undo_method(scene_tree, "update_tree"); undo_redo->add_undo_reference(edited_scene); } else { - for (const Node *E : remove_list) { - // `move_child` + `get_index` doesn't really work for internal nodes. - ERR_FAIL_COND_MSG(E->get_internal_mode() != INTERNAL_MODE_DISABLED, "Trying to remove internal node, this is not supported."); - } if (delete_tracks_checkbox->is_pressed() || p_cut) { remove_list.sort_custom(); // Sort nodes to keep positions. HashMap path_renames;