summaryrefslogtreecommitdiffstats
path: root/scene/main/node.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-03-24 01:21:28 +0100
committerRémi Verschelde <rverschelde@gmail.com>2024-03-24 01:21:28 +0100
commit9d8697ab01a3010e015403328a00459c5903c8a8 (patch)
treeb824ba6d680b40cf0e19fc19a921f038109d3172 /scene/main/node.cpp
parent8f9136963dc33349e8a87f915e214d371b2fb023 (diff)
parent95ced4bbdcea4d8e225e235fc120c4ebd72f443d (diff)
downloadredot-engine-9d8697ab01a3010e015403328a00459c5903c8a8.tar.gz
Merge pull request #89686 from kleonc/unique-node-names-check-owned-then-in-owner
Always look for unique node names in owner if not found in owned nodes
Diffstat (limited to 'scene/main/node.cpp')
-rw-r--r--scene/main/node.cpp21
1 files changed, 6 insertions, 15 deletions
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index 9e35d29dc8..d4e2d6eb16 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -1755,23 +1755,14 @@ Node *Node::get_node_or_null(const NodePath &p_path) const {
}
} else if (name.is_node_unique_name()) {
- if (current->data.owned_unique_nodes.size()) {
- // Has unique nodes in ownership
- Node **unique = current->data.owned_unique_nodes.getptr(name);
- if (!unique) {
- return nullptr;
- }
- next = *unique;
- } else if (current->data.owner) {
- Node **unique = current->data.owner->data.owned_unique_nodes.getptr(name);
- if (!unique) {
- return nullptr;
- }
- next = *unique;
- } else {
+ Node **unique = current->data.owned_unique_nodes.getptr(name);
+ if (!unique && current->data.owner) {
+ unique = current->data.owner->data.owned_unique_nodes.getptr(name);
+ }
+ if (!unique) {
return nullptr;
}
-
+ next = *unique;
} else {
next = nullptr;
const Node *const *node = current->data.children.getptr(name);