Node::duplicate: Don't set name if original node is nameless
In practice this only happens when duplicating a node which is not in
the scene tree yet, as nameless nodes get assigned a generated name
when added to the scene tree.
Fixes #27319.
(cherry picked from commit 0823ae7ae4
)
This commit is contained in:
parent
88cccfb796
commit
9591e2950a
|
@ -2063,7 +2063,9 @@ Node *Node::_duplicate(int p_flags, Map<const Node *, Node *> *r_duplimap) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
node->set_name(get_name());
|
if (get_name() != String()) {
|
||||||
|
node->set_name(get_name());
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef TOOLS_ENABLED
|
#ifdef TOOLS_ENABLED
|
||||||
if ((p_flags & DUPLICATE_FROM_EDITOR) && r_duplimap)
|
if ((p_flags & DUPLICATE_FROM_EDITOR) && r_duplimap)
|
||||||
|
|
Loading…
Reference in New Issue