diff options
author | Poommetee Ketson <poommetee@protonmail.com> | 2017-09-12 04:19:26 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-12 04:19:26 +0700 |
commit | 5edb3b6ee4ccc10fa8cb0dc5a82889aacda04ad7 (patch) | |
tree | 2b752da74729950f7942c6ca145cc1cb2ef11425 /editor/scene_tree_dock.cpp | |
parent | ea5231fdf406b7f2e4050761e3d383061216b4ec (diff) | |
parent | ebee9898ca71a7388412225fccaf460c258c6940 (diff) |
Merge pull request #11167 from bojidar-bg/9547-fix-metadata-duplication
Fix duplication of nodes resulting in shared metadata
Diffstat (limited to 'editor/scene_tree_dock.cpp')
-rw-r--r-- | editor/scene_tree_dock.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index afdf48b314..4fe24a2eff 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -823,7 +823,14 @@ Node *SceneTreeDock::_duplicate(Node *p_node, Map<Node *, Node *> &duplimap) { if (!(E->get().usage & PROPERTY_USAGE_STORAGE)) continue; String name = E->get().name; - node->set(name, p_node->get(name)); + Variant value = p_node->get(name); + // Duplicate dictionaries and arrays, mainly needed for __meta__ + if (value.get_type() == Variant::DICTIONARY) { + value = Dictionary(value).copy(); + } else if (value.get_type() == Variant::ARRAY) { + value = Array(value).duplicate(); + } + node->set(name, value); } List<Node::GroupInfo> group_info; |