summaryrefslogtreecommitdiffstats
path: root/core/variant_op.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/variant_op.cpp')
-rw-r--r--core/variant_op.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/core/variant_op.cpp b/core/variant_op.cpp
index 621af2dfb7..983c3e18bc 100644
--- a/core/variant_op.cpp
+++ b/core/variant_op.cpp
@@ -3417,8 +3417,15 @@ Variant Variant::iter_get(const Variant &r_iter, bool &r_valid) const {
Variant Variant::duplicate(bool deep) const {
switch (type) {
- // case OBJECT:
- // return operator Object *()->duplicate();
+ case OBJECT: {
+ if (deep && !_get_obj().ref.is_null()) {
+ Ref<Resource> resource = _get_obj().ref;
+ if (resource.is_valid()) {
+ return resource->duplicate(true);
+ }
+ }
+ return *this;
+ } break;
case DICTIONARY:
return operator Dictionary().duplicate(deep);
case ARRAY: