Explorar o código

-fixes disability to remove instanced nodes when reopening scene. Fixes #2610

Juan Linietsky %!s(int64=10) %!d(string=hai) anos
pai
achega
85a611d1cd
Modificáronse 2 ficheiros con 4 adicións e 4 borrados
  1. 3 3
      scene/resources/packed_scene.cpp
  2. 1 1
      tools/editor/scene_tree_dock.cpp

+ 3 - 3
scene/resources/packed_scene.cpp

@@ -101,7 +101,7 @@ Node *SceneState::instance(bool p_gen_edit_state) const {
 
 
 		if (i==0 && base_scene_idx>=0) {
 		if (i==0 && base_scene_idx>=0) {
 			//scene inheritance on root node
 			//scene inheritance on root node
-			print_line("scene inherit");
+            //print_line("scene inherit");
 			Ref<PackedScene> sdata = props[ base_scene_idx ];
 			Ref<PackedScene> sdata = props[ base_scene_idx ];
 			ERR_FAIL_COND_V( !sdata.is_valid(), NULL);
 			ERR_FAIL_COND_V( !sdata.is_valid(), NULL);
 			node = sdata->instance(p_gen_edit_state);
 			node = sdata->instance(p_gen_edit_state);
@@ -112,7 +112,7 @@ Node *SceneState::instance(bool p_gen_edit_state) const {
 
 
 		} else if (n.instance>=0) {
 		} else if (n.instance>=0) {
 			//instance a scene into this node
 			//instance a scene into this node
-			print_line("instance");
+            //print_line("instance");
 			if (n.instance&FLAG_INSTANCE_IS_PLACEHOLDER) {
 			if (n.instance&FLAG_INSTANCE_IS_PLACEHOLDER) {
 
 
 				String path = props[n.instance&FLAG_MASK];
 				String path = props[n.instance&FLAG_MASK];
@@ -148,7 +148,7 @@ Node *SceneState::instance(bool p_gen_edit_state) const {
 #endif
 #endif
 			}
 			}
 		} else if (ObjectTypeDB::is_type_enabled(snames[n.type])) {
 		} else if (ObjectTypeDB::is_type_enabled(snames[n.type])) {
-			print_line("created");
+            //print_line("created");
 			//node belongs to this scene and must be created
 			//node belongs to this scene and must be created
 			Object * obj = ObjectTypeDB::instance(snames[ n.type ]);
 			Object * obj = ObjectTypeDB::instance(snames[ n.type ]);
 			if (!obj || !obj->cast_to<Node>()) {
 			if (!obj || !obj->cast_to<Node>()) {

+ 1 - 1
tools/editor/scene_tree_dock.cpp

@@ -875,7 +875,7 @@ bool SceneTreeDock::_validate_no_foreign() {
 
 
 		}
 		}
 
 
-		if (edited_scene->get_scene_instance_state().is_valid() && edited_scene->get_scene_instance_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->get_ok()->set_text("Makes Sense!");
 			accept->get_ok()->set_text("Makes Sense!");
 			accept->set_text("Can't operate on nodes the current scene inherits from!");
 			accept->set_text("Can't operate on nodes the current scene inherits from!");