summaryrefslogtreecommitdiff
path: root/scene/main
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2019-05-28 12:40:39 +0200
committerRémi Verschelde <rverschelde@gmail.com>2019-05-28 12:40:44 +0200
commit0823ae7ae47989c31d64de222d6f6e4bdcea1962 (patch)
tree092c5969fb4541764f6c453cf87de37f8ebec04f /scene/main
parent8384582828d38ebc8f4ab4c68b9ae5181d1e99dc (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.
Diffstat (limited to 'scene/main')
-rw-r--r--scene/main/node.cpp4
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)