Merge pull request #1497 from Naros/fix-variant-hpp-packed-vector4-array

Add missing enum & ctor for PackedVector4Array implementation
pull/1509/head
David Snopek 2024-06-25 09:42:41 -05:00 committed by GitHub
commit 90c6ea2a12
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 0 deletions

View File

@ -100,6 +100,7 @@ public:
PACKED_VECTOR2_ARRAY, PACKED_VECTOR2_ARRAY,
PACKED_VECTOR3_ARRAY, PACKED_VECTOR3_ARRAY,
PACKED_COLOR_ARRAY, PACKED_COLOR_ARRAY,
PACKED_VECTOR4_ARRAY,
VARIANT_MAX VARIANT_MAX
}; };
@ -212,6 +213,7 @@ public:
Variant(const PackedVector2Array &v); Variant(const PackedVector2Array &v);
Variant(const PackedVector3Array &v); Variant(const PackedVector3Array &v);
Variant(const PackedColorArray &v); Variant(const PackedColorArray &v);
Variant(const PackedVector4Array &v);
~Variant(); ~Variant();
operator bool() const; operator bool() const;
@ -260,6 +262,7 @@ public:
operator PackedVector2Array() const; operator PackedVector2Array() const;
operator PackedVector3Array() const; operator PackedVector3Array() const;
operator PackedColorArray() const; operator PackedColorArray() const;
operator PackedVector4Array() const;
Variant &operator=(const Variant &other); Variant &operator=(const Variant &other);
Variant &operator=(Variant &&other); Variant &operator=(Variant &&other);

View File

@ -248,6 +248,10 @@ Variant::Variant(const PackedColorArray &v) {
from_type_constructor[PACKED_COLOR_ARRAY](_native_ptr(), v._native_ptr()); from_type_constructor[PACKED_COLOR_ARRAY](_native_ptr(), v._native_ptr());
} }
Variant::Variant(const PackedVector4Array &v) {
from_type_constructor[PACKED_VECTOR4_ARRAY](_native_ptr(), v._native_ptr());
}
Variant::~Variant() { Variant::~Variant() {
internal::gdextension_interface_variant_destroy(_native_ptr()); internal::gdextension_interface_variant_destroy(_native_ptr());
} }
@ -506,6 +510,10 @@ Variant::operator PackedColorArray() const {
return PackedColorArray(this); return PackedColorArray(this);
} }
Variant::operator PackedVector4Array() const {
return PackedVector4Array(this);
}
Variant &Variant::operator=(const Variant &other) { Variant &Variant::operator=(const Variant &other) {
clear(); clear();
internal::gdextension_interface_variant_new_copy(_native_ptr(), other._native_ptr()); internal::gdextension_interface_variant_new_copy(_native_ptr(), other._native_ptr());