summaryrefslogtreecommitdiffstats
path: root/scene/resources/packed_scene.cpp
diff options
context:
space:
mode:
authorreduz <reduzio@gmail.com>2022-04-16 12:23:32 +0200
committerreduz <reduzio@gmail.com>2022-04-25 12:19:17 +0200
commit8580f377a3d7d72c319e9e5489bcbe1678ad704b (patch)
tree10f6ac97697013f8c0e5ef9f3004498b0e33aaec /scene/resources/packed_scene.cpp
parentf4b0c7a1ea8d86c1dfd96478ca12ad1360903d9d (diff)
downloadredot-engine-8580f377a3d7d72c319e9e5489bcbe1678ad704b.tar.gz
Implement Scene Unique Nodes
Implements https://github.com/godotengine/godot-proposals/issues/4096 * Nodes can be marked unique to the scene in the editor (or via code). * Unique nodes can be accessed via the **%** prefix at any point in the path. From that point in the path (depending on whether the scene of the path is), the unique node will be fetched. * Implementation is very optimal, as these nodes are cached.
Diffstat (limited to 'scene/resources/packed_scene.cpp')
-rw-r--r--scene/resources/packed_scene.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp
index b1c2702a1e..b991cb1abe 100644
--- a/scene/resources/packed_scene.cpp
+++ b/scene/resources/packed_scene.cpp
@@ -310,6 +310,9 @@ Node *SceneState::instantiate(GenEditState p_edit_state) const {
NODE_FROM_ID(owner, n.owner);
if (owner) {
node->_set_owner_nocheck(owner);
+ if (node->data.unique_name_in_owner) {
+ node->_acquire_unique_name_in_owner();
+ }
}
}