summaryrefslogtreecommitdiff
path: root/scene/main
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2018-04-08 09:39:03 -0300
committerGitHub <noreply@github.com>2018-04-08 09:39:03 -0300
commit4ee3f3251dc55ae49c873bc1895cecf75bc0bf8a (patch)
treead5442ba88596748b67ec6834a50b61543c8d916 /scene/main
parent8a5fb669ae3590fa1aa3f1fb90d01c3dca843c94 (diff)
parent9f6c0c6eaef754f2049ee536c5b38bfdc65fbd08 (diff)
Merge pull request #17382 from bojidar-bg/13971-path-array-unsaved
Duplicate Arrays and Dictionaries when instancing scene in editor
Diffstat (limited to 'scene/main')
-rw-r--r--scene/main/node.cpp16
1 files changed, 2 insertions, 14 deletions
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index 28b4540573..2c4708b37f 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -2163,13 +2163,7 @@ Node *Node::_duplicate(int p_flags, Map<const Node *, Node *> *r_duplimap) const
if (name == script_property_name)
continue;
- Variant value = N->get()->get(name);
- // Duplicate dictionaries and arrays, mainly needed for __meta__
- if (value.get_type() == Variant::DICTIONARY) {
- value = Dictionary(value).duplicate();
- } else if (value.get_type() == Variant::ARRAY) {
- value = Array(value).duplicate();
- }
+ Variant value = N->get()->get(name).duplicate(true);
if (E->get().usage & PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE) {
@@ -2313,13 +2307,7 @@ void Node::_duplicate_and_reown(Node *p_new_parent, const Map<Node *, Node *> &p
continue;
String name = E->get().name;
- Variant value = get(name);
- // Duplicate dictionaries and arrays, mainly needed for __meta__
- if (value.get_type() == Variant::DICTIONARY) {
- value = Dictionary(value).duplicate();
- } else if (value.get_type() == Variant::ARRAY) {
- value = Array(value).duplicate();
- }
+ Variant value = get(name).duplicate(true);
node->set(name, value);
}