Perform a name check when loading scenes and running on editor, fixes #6152

This commit is contained in:
Juan Linietsky 2018-07-29 17:39:06 -03:00
parent b3919dcb44
commit 200c6cf630
1 changed files with 7 additions and 1 deletions

View File

@ -31,6 +31,7 @@
#include "packed_scene.h" #include "packed_scene.h"
#include "core/core_string_names.h" #include "core/core_string_names.h"
#include "engine.h"
#include "io/resource_loader.h" #include "io/resource_loader.h"
#include "project_settings.h" #include "project_settings.h"
#include "scene/2d/node_2d.h" #include "scene/2d/node_2d.h"
@ -278,10 +279,15 @@ Node *SceneState::instance(GenEditState p_edit_state) const {
//and the node has nowhere to go anymore //and the node has nowhere to go anymore
stray_instances.push_back(node); //can't be added, go to stray list stray_instances.push_back(node); //can't be added, go to stray list
} }
} else {
if (Engine::get_singleton()->is_editor_hint()) {
//validate name if using editor, to avoid broken
node->set_name(snames[n.name]);
} else { } else {
node->_set_name_nocheck(snames[n.name]); node->_set_name_nocheck(snames[n.name]);
} }
} }
}
if (n.owner >= 0) { if (n.owner >= 0) {