summaryrefslogtreecommitdiffstats
path: root/core/variant/variant_internal.h
diff options
context:
space:
mode:
Diffstat (limited to 'core/variant/variant_internal.h')
-rw-r--r--core/variant/variant_internal.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/core/variant/variant_internal.h b/core/variant/variant_internal.h
index dbd4a6a7ad..ec87081f15 100644
--- a/core/variant/variant_internal.h
+++ b/core/variant/variant_internal.h
@@ -114,6 +114,9 @@ public:
case Variant::PACKED_COLOR_ARRAY:
init_color_array(v);
break;
+ case Variant::PACKED_VECTOR4_ARRAY:
+ init_vector4_array(v);
+ break;
case Variant::OBJECT:
init_object(v);
break;
@@ -205,6 +208,8 @@ public:
_FORCE_INLINE_ static const PackedVector3Array *get_vector3_array(const Variant *v) { return &static_cast<const Variant::PackedArrayRef<Vector3> *>(v->_data.packed_array)->array; }
_FORCE_INLINE_ static PackedColorArray *get_color_array(Variant *v) { return &static_cast<Variant::PackedArrayRef<Color> *>(v->_data.packed_array)->array; }
_FORCE_INLINE_ static const PackedColorArray *get_color_array(const Variant *v) { return &static_cast<const Variant::PackedArrayRef<Color> *>(v->_data.packed_array)->array; }
+ _FORCE_INLINE_ static PackedVector4Array *get_vector4_array(Variant *v) { return &static_cast<Variant::PackedArrayRef<Vector4> *>(v->_data.packed_array)->array; }
+ _FORCE_INLINE_ static const PackedVector4Array *get_vector4_array(const Variant *v) { return &static_cast<const Variant::PackedArrayRef<Vector4> *>(v->_data.packed_array)->array; }
_FORCE_INLINE_ static Object **get_object(Variant *v) { return (Object **)&v->_get_obj().obj; }
_FORCE_INLINE_ static const Object **get_object(const Variant *v) { return (const Object **)&v->_get_obj().obj; }
@@ -313,6 +318,10 @@ public:
v->_data.packed_array = Variant::PackedArrayRef<Color>::create(Vector<Color>());
v->type = Variant::PACKED_COLOR_ARRAY;
}
+ _FORCE_INLINE_ static void init_vector4_array(Variant *v) {
+ v->_data.packed_array = Variant::PackedArrayRef<Vector4>::create(Vector<Vector4>());
+ v->type = Variant::PACKED_VECTOR4_ARRAY;
+ }
_FORCE_INLINE_ static void init_object(Variant *v) {
object_assign_null(v);
v->type = Variant::OBJECT;
@@ -417,6 +426,8 @@ public:
return get_vector3_array(v);
case Variant::PACKED_COLOR_ARRAY:
return get_color_array(v);
+ case Variant::PACKED_VECTOR4_ARRAY:
+ return get_vector4_array(v);
case Variant::OBJECT:
return get_object(v);
case Variant::VARIANT_MAX:
@@ -501,6 +512,8 @@ public:
return get_vector3_array(v);
case Variant::PACKED_COLOR_ARRAY:
return get_color_array(v);
+ case Variant::PACKED_VECTOR4_ARRAY:
+ return get_vector4_array(v);
case Variant::OBJECT:
return get_object(v);
case Variant::VARIANT_MAX:
@@ -797,6 +810,12 @@ struct VariantGetInternalPtr<PackedColorArray> {
static const PackedColorArray *get_ptr(const Variant *v) { return VariantInternal::get_color_array(v); }
};
+template <>
+struct VariantGetInternalPtr<PackedVector4Array> {
+ static PackedVector4Array *get_ptr(Variant *v) { return VariantInternal::get_vector4_array(v); }
+ static const PackedVector4Array *get_ptr(const Variant *v) { return VariantInternal::get_vector4_array(v); }
+};
+
template <typename T>
struct VariantInternalAccessor {
};
@@ -1058,6 +1077,12 @@ struct VariantInternalAccessor<PackedColorArray> {
};
template <>
+struct VariantInternalAccessor<PackedVector4Array> {
+ static _FORCE_INLINE_ const PackedVector4Array &get(const Variant *v) { return *VariantInternal::get_vector4_array(v); }
+ static _FORCE_INLINE_ void set(Variant *v, const PackedVector4Array &p_value) { *VariantInternal::get_vector4_array(v) = p_value; }
+};
+
+template <>
struct VariantInternalAccessor<Object *> {
static _FORCE_INLINE_ Object *get(const Variant *v) { return const_cast<Object *>(*VariantInternal::get_object(v)); }
static _FORCE_INLINE_ void set(Variant *v, const Object *p_value) { VariantInternal::object_assign(v, p_value); }
@@ -1297,6 +1322,11 @@ struct VariantInitializer<PackedColorArray> {
};
template <>
+struct VariantInitializer<PackedVector4Array> {
+ static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_vector4_array(v); }
+};
+
+template <>
struct VariantInitializer<Object *> {
static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_object(v); }
};
@@ -1490,6 +1520,11 @@ struct VariantDefaultInitializer<PackedColorArray> {
static _FORCE_INLINE_ void init(Variant *v) { *VariantInternal::get_color_array(v) = PackedColorArray(); }
};
+template <>
+struct VariantDefaultInitializer<PackedVector4Array> {
+ static _FORCE_INLINE_ void init(Variant *v) { *VariantInternal::get_vector4_array(v) = PackedVector4Array(); }
+};
+
template <typename T>
struct VariantTypeChanger {
static _FORCE_INLINE_ void change(Variant *v) {