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.
This commit is contained in:
parent
8384582828
commit
0823ae7ae4
|
@ -2077,7 +2077,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