From 9f6c0c6eaef754f2049ee536c5b38bfdc65fbd08 Mon Sep 17 00:00:00 2001 From: Bojidar Marinov Date: Fri, 9 Mar 2018 21:16:08 +0200 Subject: Duplicate Arrays and Dictionaries when instancing scene in editor Also, add deep (=false) parameter to Array.duplicate and Dictionary.duplicate Fixes #13971 --- core/dictionary.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'core/dictionary.cpp') diff --git a/core/dictionary.cpp b/core/dictionary.cpp index e3f4aa5f28..ba0de95861 100644 --- a/core/dictionary.cpp +++ b/core/dictionary.cpp @@ -211,7 +211,7 @@ const Variant *Dictionary::next(const Variant *p_key) const { return NULL; } -Dictionary Dictionary::duplicate() const { +Dictionary Dictionary::duplicate(bool p_deep) const { Dictionary n; @@ -219,7 +219,7 @@ Dictionary Dictionary::duplicate() const { get_key_list(&keys); for (List::Element *E = keys.front(); E; E = E->next()) { - n[E->get()] = operator[](E->get()); + n[E->get()] = p_deep ? operator[](E->get()).duplicate(p_deep) : operator[](E->get()); } return n; -- cgit v1.2.3