Skip to content

Commit

Permalink
Merge pull request #84824 from Rindbee/fix-double-internal-node
Browse files Browse the repository at this point in the history
Fix duplicating sub-scene may get two copies of internal node
  • Loading branch information
akien-mga committed Feb 9, 2024
2 parents 0bda868 + f19c419 commit 58a8eb8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions scene/main/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2549,6 +2549,11 @@ Node *Node::_duplicate(int p_flags, HashMap<const Node *, Node *> *r_duplimap) c
for (List<const Node *>::Element *N = node_tree.front(); N; N = N->next()) {
for (int i = 0; i < N->get()->get_child_count(); ++i) {
Node *descendant = N->get()->get_child(i);

if (!descendant->get_owner()) {
continue; // Internal nodes or nodes added by scripts.
}

// Skip nodes not really belonging to the instantiated hierarchy; they'll be processed normally later
// but remember non-instantiated nodes that are hidden below instantiated ones
if (!instance_roots.has(descendant->get_owner())) {
Expand Down

0 comments on commit 58a8eb8

Please sign in to comment.