1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-11 13:10:58 +00:00

Merge pull request #14754 from willnationsdev/dictionary-copy

Added 'duplicate' function for Dictionary in C++ and API.
This commit is contained in:
Rémi Verschelde
2017-12-17 23:58:59 +01:00
committed by GitHub
6 changed files with 12 additions and 10 deletions

View File

@@ -2162,7 +2162,7 @@ Node *Node::_duplicate(int p_flags, Map<const Node *, Node *> *r_duplimap) const
Variant value = N->get()->get(name);
// Duplicate dictionaries and arrays, mainly needed for __meta__
if (value.get_type() == Variant::DICTIONARY) {
value = Dictionary(value).copy();
value = Dictionary(value).duplicate();
} else if (value.get_type() == Variant::ARRAY) {
value = Array(value).duplicate();
}
@@ -2303,7 +2303,7 @@ void Node::_duplicate_and_reown(Node *p_new_parent, const Map<Node *, Node *> &p
Variant value = get(name);
// Duplicate dictionaries and arrays, mainly needed for __meta__
if (value.get_type() == Variant::DICTIONARY) {
value = Dictionary(value).copy();
value = Dictionary(value).duplicate();
} else if (value.get_type() == Variant::ARRAY) {
value = Array(value).duplicate();
}