From ff7a3970a63ac908fb1e271397b951f06716af36 Mon Sep 17 00:00:00 2001 From: Lukas Tenbrink Date: Mon, 21 Oct 2024 02:06:44 +0200 Subject: [PATCH] Add PackedArrayRef classes, instances of PackedArrayRefRAII. These mimic Variant's PackedArray behavior as a ref counted shared ownership of a single instance PackedArray. --- core/variant/packed_array_ref.h | 141 ++++++++++++++++++++++++++++++++ core/variant/variant.cpp | 130 +++++++++++++++++++++++++++++ core/variant/variant.h | 93 ++++++++------------- core/variant/variant_internal.h | 60 +++++++------- platform/windows/godot.natvis | 36 ++++---- 5 files changed, 354 insertions(+), 106 deletions(-) create mode 100644 core/variant/packed_array_ref.h diff --git a/core/variant/packed_array_ref.h b/core/variant/packed_array_ref.h new file mode 100644 index 00000000000..36ff78dabfb --- /dev/null +++ b/core/variant/packed_array_ref.h @@ -0,0 +1,141 @@ +/**************************************************************************/ +/* packed_array_ref.h */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/**************************************************************************/ + +#ifndef PACKED_ARRAY_REF_H +#define PACKED_ARRAY_REF_H + +#include "core/os/memory.h" +#include "core/templates/vector.h" + +struct PackedArrayRefBase { + SafeRefCount refcount; + _FORCE_INLINE_ PackedArrayRefBase *reference() { + if (refcount.ref()) { + return this; + } else { + return nullptr; + } + } + static _FORCE_INLINE_ PackedArrayRefBase *reference_from(PackedArrayRefBase *p_base, PackedArrayRefBase *p_from) { + if (p_base == p_from) { + return p_base; //same thing, do nothing + } + + if (p_from->reference()) { + if (p_base->refcount.unref()) { + memdelete(p_base); + } + return p_from; + } else { + return p_base; //keep, could not reference new + } + } + static _FORCE_INLINE_ void destroy(PackedArrayRefBase *p_array) { + if (p_array->refcount.unref()) { + memdelete(p_array); + } + } + _FORCE_INLINE_ virtual ~PackedArrayRefBase() {} //needs virtual destructor, but make inline +}; + +template +struct PackedArrayRef : public PackedArrayRefBase { + Vector array; + static _FORCE_INLINE_ PackedArrayRef *create() { + return memnew(PackedArrayRef); + } + static _FORCE_INLINE_ PackedArrayRef *create(const Vector &p_from) { + return memnew(PackedArrayRef(p_from)); + } + + static _FORCE_INLINE_ const Vector &get_array(PackedArrayRefBase *p_base) { + return static_cast *>(p_base)->array; + } + static _FORCE_INLINE_ Vector *get_array_ptr(const PackedArrayRefBase *p_base) { + return &const_cast *>(static_cast *>(p_base))->array; + } + + _FORCE_INLINE_ PackedArrayRef(const Vector &p_from) { + array = p_from; + refcount.init(); + } + _FORCE_INLINE_ PackedArrayRef(const PackedArrayRef &p_from) { + array = p_from.array; + refcount.init(); + } + _FORCE_INLINE_ PackedArrayRef() { + refcount.init(); + } +}; + +template +struct PackedArrayRefRAII { + PackedArrayRef *ref = nullptr; + + PackedArrayRefRAII() { + ref = PackedArrayRef::create(); + } + + PackedArrayRefRAII(PackedArrayRefRAII &p_from) { + if (p_from.ref) { + ref = dynamic_cast *>(p_from.ref->reference()); + } + } + + explicit PackedArrayRefRAII(const Vector &p_from) { + ref = PackedArrayRef::create(p_from); + } + + explicit PackedArrayRefRAII(PackedArrayRef &p_from) { + ref = dynamic_cast *>(p_from.reference()); + } + + explicit PackedArrayRefRAII(PackedArrayRef *p_from) { + if (p_from) { + ref = dynamic_cast *>(p_from->reference()); + } + } + + ~PackedArrayRefRAII() { + if (ref) { + PackedArrayRefBase::destroy(ref); + } + } + + Vector *operator->() { + return &ref->get_array_ptr(*this); + } + + Vector &operator*() { + return ref->get_array_ptr(*this); + } +}; + +#endif // PACKED_ARRAY_REF_H diff --git a/core/variant/variant.cpp b/core/variant/variant.cpp index e2865a06be9..2e7dffbbc49 100644 --- a/core/variant/variant.cpp +++ b/core/variant/variant.cpp @@ -2349,6 +2349,86 @@ Variant::operator PackedVector4Array() const { } } +Variant::operator PackedByteArrayRef() { + if (type == PACKED_BYTE_ARRAY) { + return PackedByteArrayRef(static_cast *>(_data.packed_array)); + } else { + return PackedByteArrayRef(_convert_array_from_variant(*this)); + } +} + +Variant::operator PackedInt32ArrayRef() { + if (type == PACKED_INT32_ARRAY) { + return PackedInt32ArrayRef(static_cast *>(_data.packed_array)); + } else { + return PackedInt32ArrayRef(_convert_array_from_variant(*this)); + } +} + +Variant::operator PackedInt64ArrayRef() { + if (type == PACKED_INT64_ARRAY) { + return PackedInt64ArrayRef(static_cast *>(_data.packed_array)); + } else { + return PackedInt64ArrayRef(_convert_array_from_variant(*this)); + } +} + +Variant::operator PackedFloat32ArrayRef() { + if (type == PACKED_FLOAT32_ARRAY) { + return PackedFloat32ArrayRef(static_cast *>(_data.packed_array)); + } else { + return PackedFloat32ArrayRef(_convert_array_from_variant(*this)); + } +} + +Variant::operator PackedFloat64ArrayRef() { + if (type == PACKED_FLOAT64_ARRAY) { + return PackedFloat64ArrayRef(static_cast *>(_data.packed_array)); + } else { + return PackedFloat64ArrayRef(_convert_array_from_variant(*this)); + } +} + +Variant::operator PackedStringArrayRef() { + if (type == PACKED_STRING_ARRAY) { + return PackedStringArrayRef(static_cast *>(_data.packed_array)); + } else { + return PackedStringArrayRef(_convert_array_from_variant(*this)); + } +} + +Variant::operator PackedVector2ArrayRef() { + if (type == PACKED_VECTOR2_ARRAY) { + return PackedVector2ArrayRef(static_cast *>(_data.packed_array)); + } else { + return PackedVector2ArrayRef(_convert_array_from_variant(*this)); + } +} + +Variant::operator PackedVector3ArrayRef() { + if (type == PACKED_VECTOR3_ARRAY) { + return PackedVector3ArrayRef(static_cast *>(_data.packed_array)); + } else { + return PackedVector3ArrayRef(_convert_array_from_variant(*this)); + } +} + +Variant::operator PackedColorArrayRef() { + if (type == PACKED_COLOR_ARRAY) { + return PackedColorArrayRef(static_cast *>(_data.packed_array)); + } else { + return PackedColorArrayRef(_convert_array_from_variant(*this)); + } +} + +Variant::operator PackedVector4ArrayRef() { + if (type == PACKED_VECTOR4_ARRAY) { + return PackedVector4ArrayRef(static_cast *>(_data.packed_array)); + } else { + return PackedVector4ArrayRef(_convert_array_from_variant(*this)); + } +} + /* helpers */ Variant::operator Vector<::RID>() const { @@ -2696,6 +2776,56 @@ Variant::Variant(const PackedVector4Array &p_vector4_array) : _data.packed_array = PackedArrayRef::create(p_vector4_array); } +Variant::Variant(PackedByteArrayRef &p_byte_array) : + type(PACKED_BYTE_ARRAY) { + _data.packed_array = p_byte_array.ref->reference(); +} + +Variant::Variant(PackedInt32ArrayRef &p_int32_array) : + type(PACKED_INT32_ARRAY) { + _data.packed_array = p_int32_array.ref->reference(); +} + +Variant::Variant(PackedInt64ArrayRef &p_int64_array) : + type(PACKED_INT64_ARRAY) { + _data.packed_array = p_int64_array.ref->reference(); +} + +Variant::Variant(PackedFloat32ArrayRef &p_float32_array) : + type(PACKED_FLOAT32_ARRAY) { + _data.packed_array = p_float32_array.ref->reference(); +} + +Variant::Variant(PackedFloat64ArrayRef &p_float64_array) : + type(PACKED_FLOAT64_ARRAY) { + _data.packed_array = p_float64_array.ref->reference(); +} + +Variant::Variant(PackedStringArrayRef &p_string_array) : + type(PACKED_STRING_ARRAY) { + _data.packed_array = p_string_array.ref->reference(); +} + +Variant::Variant(PackedVector2ArrayRef &p_vector2_array) : + type(PACKED_VECTOR2_ARRAY) { + _data.packed_array = p_vector2_array.ref->reference(); +} + +Variant::Variant(PackedVector3ArrayRef &p_vector3_array) : + type(PACKED_VECTOR3_ARRAY) { + _data.packed_array = p_vector3_array.ref->reference(); +} + +Variant::Variant(PackedColorArrayRef &p_color_array) : + type(PACKED_COLOR_ARRAY) { + _data.packed_array = p_color_array.ref->reference(); +} + +Variant::Variant(PackedVector4ArrayRef &p_vector4_array) : + type(PACKED_VECTOR4_ARRAY) { + _data.packed_array = p_vector4_array.ref->reference(); +} + /* helpers */ Variant::Variant(const Vector<::RID> &p_array) : type(ARRAY) { diff --git a/core/variant/variant.h b/core/variant/variant.h index c76b849abdb..484e702ba95 100644 --- a/core/variant/variant.h +++ b/core/variant/variant.h @@ -60,6 +60,7 @@ #include "core/variant/array.h" #include "core/variant/callable.h" #include "core/variant/dictionary.h" +#include "core/variant/packed_array_ref.h" class Object; class RefCounted; @@ -82,6 +83,18 @@ typedef Vector PackedVector3Array; typedef Vector PackedColorArray; typedef Vector PackedVector4Array; +typedef PackedArrayRefRAII PackedByteArrayRef; +typedef PackedArrayRefRAII PackedInt32ArrayRef; +typedef PackedArrayRefRAII PackedInt64ArrayRef; +typedef PackedArrayRefRAII PackedFloat32ArrayRef; +typedef PackedArrayRefRAII PackedFloat64ArrayRef; +typedef PackedArrayRefRAII PackedRealArrayRef; +typedef PackedArrayRefRAII PackedStringArrayRef; +typedef PackedArrayRefRAII PackedVector2ArrayRef; +typedef PackedArrayRefRAII PackedVector3ArrayRef; +typedef PackedArrayRefRAII PackedColorArrayRef; +typedef PackedArrayRefRAII PackedVector4ArrayRef; + class Variant { public: // If this changes the table in variant_op must be updated @@ -195,64 +208,6 @@ private: } }; - /* array helpers */ - struct PackedArrayRefBase { - SafeRefCount refcount; - _FORCE_INLINE_ PackedArrayRefBase *reference() { - if (refcount.ref()) { - return this; - } else { - return nullptr; - } - } - static _FORCE_INLINE_ PackedArrayRefBase *reference_from(PackedArrayRefBase *p_base, PackedArrayRefBase *p_from) { - if (p_base == p_from) { - return p_base; //same thing, do nothing - } - - if (p_from->reference()) { - if (p_base->refcount.unref()) { - memdelete(p_base); - } - return p_from; - } else { - return p_base; //keep, could not reference new - } - } - static _FORCE_INLINE_ void destroy(PackedArrayRefBase *p_array) { - if (p_array->refcount.unref()) { - memdelete(p_array); - } - } - _FORCE_INLINE_ virtual ~PackedArrayRefBase() {} //needs virtual destructor, but make inline - }; - - template - struct PackedArrayRef : public PackedArrayRefBase { - Vector array; - static _FORCE_INLINE_ PackedArrayRef *create() { - return memnew(PackedArrayRef); - } - static _FORCE_INLINE_ PackedArrayRef *create(const Vector &p_from) { - return memnew(PackedArrayRef(p_from)); - } - - static _FORCE_INLINE_ const Vector &get_array(PackedArrayRefBase *p_base) { - return static_cast *>(p_base)->array; - } - static _FORCE_INLINE_ Vector *get_array_ptr(const PackedArrayRefBase *p_base) { - return &const_cast *>(static_cast *>(p_base))->array; - } - - _FORCE_INLINE_ PackedArrayRef(const Vector &p_from) { - array = p_from; - refcount.init(); - } - _FORCE_INLINE_ PackedArrayRef() { - refcount.init(); - } - }; - /* end of array helpers */ _ALWAYS_INLINE_ ObjData &_get_obj(); _ALWAYS_INLINE_ const ObjData &_get_obj() const; @@ -434,6 +389,17 @@ public: operator PackedColorArray() const; operator PackedVector4Array() const; + operator PackedByteArrayRef(); + operator PackedInt32ArrayRef(); + operator PackedInt64ArrayRef(); + operator PackedFloat32ArrayRef(); + operator PackedFloat64ArrayRef(); + operator PackedStringArrayRef(); + operator PackedVector2ArrayRef(); + operator PackedVector3ArrayRef(); + operator PackedColorArrayRef(); + operator PackedVector4ArrayRef(); + operator Vector<::RID>() const; operator Vector() const; operator Vector() const; @@ -500,6 +466,17 @@ public: Variant(const PackedColorArray &p_color_array); Variant(const PackedVector4Array &p_vector4_array); + Variant(PackedByteArrayRef &p_byte_array); + Variant(PackedInt32ArrayRef &p_int32_array); + Variant(PackedInt64ArrayRef &p_int64_array); + Variant(PackedFloat32ArrayRef &p_float32_array); + Variant(PackedFloat64ArrayRef &p_float64_array); + Variant(PackedStringArrayRef &p_string_array); + Variant(PackedVector2ArrayRef &p_vector2_array); + Variant(PackedVector3ArrayRef &p_vector3_array); + Variant(PackedColorArrayRef &p_color_array); + Variant(PackedVector4ArrayRef &p_vector4_array); + Variant(const Vector<::RID> &p_array); // helper Variant(const Vector &p_array); // helper Variant(const Vector &p_face_array); diff --git a/core/variant/variant_internal.h b/core/variant/variant_internal.h index 58652d26e0c..8a0326ee6b1 100644 --- a/core/variant/variant_internal.h +++ b/core/variant/variant_internal.h @@ -186,26 +186,26 @@ public: _FORCE_INLINE_ static const Array *get_array(const Variant *v) { return reinterpret_cast(v->_data._mem); } // Typed arrays. - _FORCE_INLINE_ static PackedByteArray *get_byte_array(Variant *v) { return &static_cast *>(v->_data.packed_array)->array; } - _FORCE_INLINE_ static const PackedByteArray *get_byte_array(const Variant *v) { return &static_cast *>(v->_data.packed_array)->array; } - _FORCE_INLINE_ static PackedInt32Array *get_int32_array(Variant *v) { return &static_cast *>(v->_data.packed_array)->array; } - _FORCE_INLINE_ static const PackedInt32Array *get_int32_array(const Variant *v) { return &static_cast *>(v->_data.packed_array)->array; } - _FORCE_INLINE_ static PackedInt64Array *get_int64_array(Variant *v) { return &static_cast *>(v->_data.packed_array)->array; } - _FORCE_INLINE_ static const PackedInt64Array *get_int64_array(const Variant *v) { return &static_cast *>(v->_data.packed_array)->array; } - _FORCE_INLINE_ static PackedFloat32Array *get_float32_array(Variant *v) { return &static_cast *>(v->_data.packed_array)->array; } - _FORCE_INLINE_ static const PackedFloat32Array *get_float32_array(const Variant *v) { return &static_cast *>(v->_data.packed_array)->array; } - _FORCE_INLINE_ static PackedFloat64Array *get_float64_array(Variant *v) { return &static_cast *>(v->_data.packed_array)->array; } - _FORCE_INLINE_ static const PackedFloat64Array *get_float64_array(const Variant *v) { return &static_cast *>(v->_data.packed_array)->array; } - _FORCE_INLINE_ static PackedStringArray *get_string_array(Variant *v) { return &static_cast *>(v->_data.packed_array)->array; } - _FORCE_INLINE_ static const PackedStringArray *get_string_array(const Variant *v) { return &static_cast *>(v->_data.packed_array)->array; } - _FORCE_INLINE_ static PackedVector2Array *get_vector2_array(Variant *v) { return &static_cast *>(v->_data.packed_array)->array; } - _FORCE_INLINE_ static const PackedVector2Array *get_vector2_array(const Variant *v) { return &static_cast *>(v->_data.packed_array)->array; } - _FORCE_INLINE_ static PackedVector3Array *get_vector3_array(Variant *v) { return &static_cast *>(v->_data.packed_array)->array; } - _FORCE_INLINE_ static const PackedVector3Array *get_vector3_array(const Variant *v) { return &static_cast *>(v->_data.packed_array)->array; } - _FORCE_INLINE_ static PackedColorArray *get_color_array(Variant *v) { return &static_cast *>(v->_data.packed_array)->array; } - _FORCE_INLINE_ static const PackedColorArray *get_color_array(const Variant *v) { return &static_cast *>(v->_data.packed_array)->array; } - _FORCE_INLINE_ static PackedVector4Array *get_vector4_array(Variant *v) { return &static_cast *>(v->_data.packed_array)->array; } - _FORCE_INLINE_ static const PackedVector4Array *get_vector4_array(const Variant *v) { return &static_cast *>(v->_data.packed_array)->array; } + _FORCE_INLINE_ static PackedByteArray *get_byte_array(Variant *v) { return &static_cast *>(v->_data.packed_array)->array; } + _FORCE_INLINE_ static const PackedByteArray *get_byte_array(const Variant *v) { return &static_cast *>(v->_data.packed_array)->array; } + _FORCE_INLINE_ static PackedInt32Array *get_int32_array(Variant *v) { return &static_cast *>(v->_data.packed_array)->array; } + _FORCE_INLINE_ static const PackedInt32Array *get_int32_array(const Variant *v) { return &static_cast *>(v->_data.packed_array)->array; } + _FORCE_INLINE_ static PackedInt64Array *get_int64_array(Variant *v) { return &static_cast *>(v->_data.packed_array)->array; } + _FORCE_INLINE_ static const PackedInt64Array *get_int64_array(const Variant *v) { return &static_cast *>(v->_data.packed_array)->array; } + _FORCE_INLINE_ static PackedFloat32Array *get_float32_array(Variant *v) { return &static_cast *>(v->_data.packed_array)->array; } + _FORCE_INLINE_ static const PackedFloat32Array *get_float32_array(const Variant *v) { return &static_cast *>(v->_data.packed_array)->array; } + _FORCE_INLINE_ static PackedFloat64Array *get_float64_array(Variant *v) { return &static_cast *>(v->_data.packed_array)->array; } + _FORCE_INLINE_ static const PackedFloat64Array *get_float64_array(const Variant *v) { return &static_cast *>(v->_data.packed_array)->array; } + _FORCE_INLINE_ static PackedStringArray *get_string_array(Variant *v) { return &static_cast *>(v->_data.packed_array)->array; } + _FORCE_INLINE_ static const PackedStringArray *get_string_array(const Variant *v) { return &static_cast *>(v->_data.packed_array)->array; } + _FORCE_INLINE_ static PackedVector2Array *get_vector2_array(Variant *v) { return &static_cast *>(v->_data.packed_array)->array; } + _FORCE_INLINE_ static const PackedVector2Array *get_vector2_array(const Variant *v) { return &static_cast *>(v->_data.packed_array)->array; } + _FORCE_INLINE_ static PackedVector3Array *get_vector3_array(Variant *v) { return &static_cast *>(v->_data.packed_array)->array; } + _FORCE_INLINE_ static const PackedVector3Array *get_vector3_array(const Variant *v) { return &static_cast *>(v->_data.packed_array)->array; } + _FORCE_INLINE_ static PackedColorArray *get_color_array(Variant *v) { return &static_cast *>(v->_data.packed_array)->array; } + _FORCE_INLINE_ static const PackedColorArray *get_color_array(const Variant *v) { return &static_cast *>(v->_data.packed_array)->array; } + _FORCE_INLINE_ static PackedVector4Array *get_vector4_array(Variant *v) { return &static_cast *>(v->_data.packed_array)->array; } + _FORCE_INLINE_ static const PackedVector4Array *get_vector4_array(const Variant *v) { return &static_cast *>(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; } @@ -279,43 +279,43 @@ public: v->type = Variant::ARRAY; } _FORCE_INLINE_ static void init_byte_array(Variant *v) { - v->_data.packed_array = Variant::PackedArrayRef::create(Vector()); + v->_data.packed_array = PackedArrayRef::create(Vector()); v->type = Variant::PACKED_BYTE_ARRAY; } _FORCE_INLINE_ static void init_int32_array(Variant *v) { - v->_data.packed_array = Variant::PackedArrayRef::create(Vector()); + v->_data.packed_array = PackedArrayRef::create(Vector()); v->type = Variant::PACKED_INT32_ARRAY; } _FORCE_INLINE_ static void init_int64_array(Variant *v) { - v->_data.packed_array = Variant::PackedArrayRef::create(Vector()); + v->_data.packed_array = PackedArrayRef::create(Vector()); v->type = Variant::PACKED_INT64_ARRAY; } _FORCE_INLINE_ static void init_float32_array(Variant *v) { - v->_data.packed_array = Variant::PackedArrayRef::create(Vector()); + v->_data.packed_array = PackedArrayRef::create(Vector()); v->type = Variant::PACKED_FLOAT32_ARRAY; } _FORCE_INLINE_ static void init_float64_array(Variant *v) { - v->_data.packed_array = Variant::PackedArrayRef::create(Vector()); + v->_data.packed_array = PackedArrayRef::create(Vector()); v->type = Variant::PACKED_FLOAT64_ARRAY; } _FORCE_INLINE_ static void init_string_array(Variant *v) { - v->_data.packed_array = Variant::PackedArrayRef::create(Vector()); + v->_data.packed_array = PackedArrayRef::create(Vector()); v->type = Variant::PACKED_STRING_ARRAY; } _FORCE_INLINE_ static void init_vector2_array(Variant *v) { - v->_data.packed_array = Variant::PackedArrayRef::create(Vector()); + v->_data.packed_array = PackedArrayRef::create(Vector()); v->type = Variant::PACKED_VECTOR2_ARRAY; } _FORCE_INLINE_ static void init_vector3_array(Variant *v) { - v->_data.packed_array = Variant::PackedArrayRef::create(Vector()); + v->_data.packed_array = PackedArrayRef::create(Vector()); v->type = Variant::PACKED_VECTOR3_ARRAY; } _FORCE_INLINE_ static void init_color_array(Variant *v) { - v->_data.packed_array = Variant::PackedArrayRef::create(Vector()); + v->_data.packed_array = PackedArrayRef::create(Vector()); v->type = Variant::PACKED_COLOR_ARRAY; } _FORCE_INLINE_ static void init_vector4_array(Variant *v) { - v->_data.packed_array = Variant::PackedArrayRef::create(Vector()); + v->_data.packed_array = PackedArrayRef::create(Vector()); v->type = Variant::PACKED_VECTOR4_ARRAY; } _FORCE_INLINE_ static void init_object(Variant *v) { diff --git a/platform/windows/godot.natvis b/platform/windows/godot.natvis index 14536fa1301..8ef871719b0 100644 --- a/platform/windows/godot.natvis +++ b/platform/windows/godot.natvis @@ -177,16 +177,16 @@ {*(*reinterpret_cast<ObjData*>(&_data._mem[0])).obj} {*(Dictionary *)_data._mem} {*(Array *)_data._mem} - {reinterpret_cast<const Variant::PackedArrayRef<unsigned char>*>(_data.packed_array)->array} - {reinterpret_cast<const Variant::PackedArrayRef<int>*>(_data.packed_array)->array} + {reinterpret_cast<const PackedArrayRef<unsigned char>*>(_data.packed_array)->array} + {reinterpret_cast<const PackedArrayRef<int>*>(_data.packed_array)->array} {*reinterpret_cast<PackedInt64Array *>(&_data.packed_array[1])} - {reinterpret_cast<const Variant::PackedArrayRef<float>*>(_data.packed_array)->array} - {reinterpret_cast<const Variant::PackedArrayRef<double>*>(_data.packed_array)->array} - {reinterpret_cast<const Variant::PackedArrayRef<String>*>(_data.packed_array)->array} - {reinterpret_cast<const Variant::PackedArrayRef<Vector2>*>(_data.packed_array)->array} - {reinterpret_cast<const Variant::PackedArrayRef<Vector3>*>(_data.packed_array)->array} - {reinterpret_cast<const Variant::PackedArrayRef<Color>*>(_data.packed_array)->array} - {reinterpret_cast<const Variant::PackedArrayRef<Vector4>*>(_data.packed_array)->array} + {reinterpret_cast<const PackedArrayRef<float>*>(_data.packed_array)->array} + {reinterpret_cast<const PackedArrayRef<double>*>(_data.packed_array)->array} + {reinterpret_cast<const PackedArrayRef<String>*>(_data.packed_array)->array} + {reinterpret_cast<const PackedArrayRef<Vector2>*>(_data.packed_array)->array} + {reinterpret_cast<const PackedArrayRef<Vector3>*>(_data.packed_array)->array} + {reinterpret_cast<const PackedArrayRef<Color>*>(_data.packed_array)->array} + {reinterpret_cast<const PackedArrayRef<Vector4>*>(_data.packed_array)->array} [INVALID] ((String *)(_data._mem))->_cowdata._ptr,s32 @@ -212,16 +212,16 @@ *(*reinterpret_cast<ObjData*>(&_data._mem[0])).obj *(Dictionary *)_data._mem *(Array *)_data._mem - reinterpret_cast<const Variant::PackedArrayRef<unsigned char>*>(_data.packed_array)->array - reinterpret_cast<const Variant::PackedArrayRef<int>*>(_data.packed_array)->array + reinterpret_cast<const PackedArrayRef<unsigned char>*>(_data.packed_array)->array + reinterpret_cast<const PackedArrayRef<int>*>(_data.packed_array)->array *reinterpret_cast<PackedInt64Array *>(&_data.packed_array[1]) - reinterpret_cast<const Variant::PackedArrayRef<float>*>(_data.packed_array)->array - reinterpret_cast<const Variant::PackedArrayRef<double>*>(_data.packed_array)->array - reinterpret_cast<const Variant::PackedArrayRef<String>*>(_data.packed_array)->array - reinterpret_cast<const Variant::PackedArrayRef<Vector2>*>(_data.packed_array)->array - reinterpret_cast<const Variant::PackedArrayRef<Vector3>*>(_data.packed_array)->array - reinterpret_cast<const Variant::PackedArrayRef<Color>*>(_data.packed_array)->array - reinterpret_cast<const Variant::PackedArrayRef<Vector4>*>(_data.packed_array)->array + reinterpret_cast<const PackedArrayRef<float>*>(_data.packed_array)->array + reinterpret_cast<const PackedArrayRef<double>*>(_data.packed_array)->array + reinterpret_cast<const PackedArrayRef<String>*>(_data.packed_array)->array + reinterpret_cast<const PackedArrayRef<Vector2>*>(_data.packed_array)->array + reinterpret_cast<const PackedArrayRef<Vector3>*>(_data.packed_array)->array + reinterpret_cast<const PackedArrayRef<Color>*>(_data.packed_array)->array + reinterpret_cast<const PackedArrayRef<Vector4>*>(_data.packed_array)->array