diff options
author | reduz <reduzio@gmail.com> | 2022-04-16 12:23:32 +0200 |
---|---|---|
committer | reduz <reduzio@gmail.com> | 2022-04-25 12:19:17 +0200 |
commit | 8580f377a3d7d72c319e9e5489bcbe1678ad704b (patch) | |
tree | 10f6ac97697013f8c0e5ef9f3004498b0e33aaec /scene/resources/packed_scene.cpp | |
parent | f4b0c7a1ea8d86c1dfd96478ca12ad1360903d9d (diff) | |
download | redot-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.cpp | 3 |
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(); + } } } |