1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

make InstancePlaceholder in charge of node reference resolution

This commit is contained in:
Adriano Orioli
2024-04-04 17:10:34 +02:00
parent be56cab58c
commit edd2e6e37f
5 changed files with 670 additions and 8 deletions

View File

@@ -314,6 +314,16 @@ Node *SceneState::instantiate(GenEditState p_edit_state) const {
ERR_FAIL_INDEX_V(nprops[j].value, prop_count, nullptr);
if (nprops[j].name & FLAG_PATH_PROPERTY_IS_NODE) {
if (!Engine::get_singleton()->is_editor_hint() && node->get_scene_instance_load_placeholder()) {
// We cannot know if the referenced nodes exist yet, so instead of deferring, we write the NodePaths directly.
uint32_t name_idx = nprops[j].name & (FLAG_PATH_PROPERTY_IS_NODE - 1);
ERR_FAIL_UNSIGNED_INDEX_V(name_idx, (uint32_t)sname_count, nullptr);
node->set(snames[name_idx], props[nprops[j].value], &valid);
continue;
}
uint32_t name_idx = nprops[j].name & (FLAG_PATH_PROPERTY_IS_NODE - 1);
ERR_FAIL_UNSIGNED_INDEX_V(name_idx, (uint32_t)sname_count, nullptr);