summaryrefslogtreecommitdiffstats
path: root/src/variant/variant.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/variant/variant.cpp')
-rw-r--r--src/variant/variant.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/variant/variant.cpp b/src/variant/variant.cpp
index 9dcf705..1f57d48 100644
--- a/src/variant/variant.cpp
+++ b/src/variant/variant.cpp
@@ -448,12 +448,7 @@ Variant::operator ObjectID() const {
if (get_type() == Type::INT) {
return ObjectID(operator uint64_t());
} else if (get_type() == Type::OBJECT) {
- Object *obj = operator Object *();
- if (obj != nullptr) {
- return ObjectID(obj->get_instance_id());
- } else {
- return ObjectID();
- }
+ return ObjectID(internal::gdextension_interface_variant_get_object_instance_id(_native_ptr()));
} else {
return ObjectID();
}
@@ -515,6 +510,10 @@ Variant::operator PackedVector4Array() const {
return PackedVector4Array(this);
}
+Object *Variant::get_validated_object() const {
+ return ObjectDB::get_instance(operator ObjectID());
+}
+
Variant &Variant::operator=(const Variant &other) {
clear();
internal::gdextension_interface_variant_new_copy(_native_ptr(), other._native_ptr());