Duplicate Arrays and Dictionaries when instancing scene in editor
Also, add deep (=false) parameter to Array.duplicate and Dictionary.duplicate Fixes #13971
This commit is contained in:
parent
b842369442
commit
9f6c0c6eae
11 changed files with 32 additions and 28 deletions
|
|
@ -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<Variant>::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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue