From 95ced4bbdcea4d8e225e235fc120c4ebd72f443d Mon Sep 17 00:00:00 2001 From: kleonc <9283098+kleonc@users.noreply.github.com> Date: Tue, 19 Mar 2024 22:13:10 +0100 Subject: Always look for unique node names in owner if not found in owned nodes --- scene/main/node.cpp | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) (limited to 'scene/main/node.cpp') diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 906c397b5c..b166672cd7 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -1679,23 +1679,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); -- cgit v1.2.3