diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2019-05-28 12:40:39 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2019-05-28 12:40:44 +0200 |
commit | 0823ae7ae47989c31d64de222d6f6e4bdcea1962 (patch) | |
tree | 092c5969fb4541764f6c453cf87de37f8ebec04f | |
parent | 8384582828d38ebc8f4ab4c68b9ae5181d1e99dc (diff) |
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.
-rw-r--r-- | scene/main/node.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 368dea7649..2f23c11748 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -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 if ((p_flags & DUPLICATE_FROM_EDITOR) && r_duplimap) |