Sfoglia il codice sorgente

Fixed user being unable to delete root Node if is an inherited Scene

User wasn't able to delete the root Node because it was being treated as
a foreign Node since it was an inherited Scene
Silvano Cerza 7 anni fa
parent
commit
7167394876
1 ha cambiato i file con 7 aggiunte e 0 eliminazioni
  1. 7 0
      editor/scene_tree_dock.cpp

+ 7 - 0
editor/scene_tree_dock.cpp

@@ -1307,6 +1307,13 @@ bool SceneTreeDock::_validate_no_foreign() {
 			return false;
 			return false;
 		}
 		}
 
 
+		// When edited_scene inherits from another one the root Node will be the parent Scene,
+		// we don't want to consider that Node a foreign one otherwise we would not be able to
+		// delete it
+		if (edited_scene->get_scene_inherited_state().is_valid() && edited_scene == E->get()) {
+			continue;
+		}
+
 		if (edited_scene->get_scene_inherited_state().is_valid() && edited_scene->get_scene_inherited_state()->find_node_by_path(edited_scene->get_path_to(E->get())) >= 0) {
 		if (edited_scene->get_scene_inherited_state().is_valid() && edited_scene->get_scene_inherited_state()->find_node_by_path(edited_scene->get_path_to(E->get())) >= 0) {
 
 
 			accept->set_text(TTR("Can't operate on nodes the current scene inherits from!"));
 			accept->set_text(TTR("Can't operate on nodes the current scene inherits from!"));