feat: updated godot version
This commit is contained in:
parent
0c508b0831
commit
42b028dbb5
4694 changed files with 236470 additions and 401376 deletions
|
|
@ -35,7 +35,10 @@
|
|||
#include "core/io/resource.h"
|
||||
#include "core/math/math_funcs.h"
|
||||
#include "core/variant/variant_parser.h"
|
||||
#include "core/variant/variant_pools.h"
|
||||
|
||||
PagedAllocator<Variant::Pools::BucketSmall, true> Variant::Pools::_bucket_small;
|
||||
PagedAllocator<Variant::Pools::BucketMedium, true> Variant::Pools::_bucket_medium;
|
||||
PagedAllocator<Variant::Pools::BucketLarge, true> Variant::Pools::_bucket_large;
|
||||
|
||||
String Variant::get_type_name(Variant::Type p_type) {
|
||||
switch (p_type) {
|
||||
|
|
@ -865,6 +868,17 @@ bool Variant::operator==(const Variant &p_variant) const {
|
|||
return hash_compare(p_variant);
|
||||
}
|
||||
|
||||
bool Variant::operator!=(const Variant &p_variant) const {
|
||||
// Don't use `!hash_compare(p_variant)` given it makes use of OP_EQUAL
|
||||
if (type != p_variant.type) { //evaluation of operator== needs to be more strict
|
||||
return true;
|
||||
}
|
||||
bool v;
|
||||
Variant r;
|
||||
evaluate(OP_NOT_EQUAL, *this, p_variant, r, v);
|
||||
return r;
|
||||
}
|
||||
|
||||
bool Variant::operator<(const Variant &p_variant) const {
|
||||
if (type != p_variant.type) { //if types differ, then order by type first
|
||||
return type < p_variant.type;
|
||||
|
|
@ -1169,7 +1183,7 @@ void Variant::reference(const Variant &p_variant) {
|
|||
memnew_placement(_data._mem, Rect2i(*reinterpret_cast<const Rect2i *>(p_variant._data._mem)));
|
||||
} break;
|
||||
case TRANSFORM2D: {
|
||||
_data._transform2d = VariantPools::alloc<Transform2D>();
|
||||
_data._transform2d = (Transform2D *)Pools::_bucket_small.alloc();
|
||||
memnew_placement(_data._transform2d, Transform2D(*p_variant._data._transform2d));
|
||||
} break;
|
||||
case VECTOR3: {
|
||||
|
|
@ -1188,22 +1202,22 @@ void Variant::reference(const Variant &p_variant) {
|
|||
memnew_placement(_data._mem, Plane(*reinterpret_cast<const Plane *>(p_variant._data._mem)));
|
||||
} break;
|
||||
case AABB: {
|
||||
_data._aabb = VariantPools::alloc<::AABB>();
|
||||
_data._aabb = (::AABB *)Pools::_bucket_small.alloc();
|
||||
memnew_placement(_data._aabb, ::AABB(*p_variant._data._aabb));
|
||||
} break;
|
||||
case QUATERNION: {
|
||||
memnew_placement(_data._mem, Quaternion(*reinterpret_cast<const Quaternion *>(p_variant._data._mem)));
|
||||
} break;
|
||||
case BASIS: {
|
||||
_data._ptr = VariantPools::alloc<Basis>();
|
||||
_data._basis = (Basis *)Pools::_bucket_medium.alloc();
|
||||
memnew_placement(_data._basis, Basis(*p_variant._data._basis));
|
||||
} break;
|
||||
case TRANSFORM3D: {
|
||||
_data._ptr = VariantPools::alloc<Transform3D>();
|
||||
_data._transform3d = (Transform3D *)Pools::_bucket_medium.alloc();
|
||||
memnew_placement(_data._transform3d, Transform3D(*p_variant._data._transform3d));
|
||||
} break;
|
||||
case PROJECTION: {
|
||||
_data._ptr = VariantPools::alloc<Projection>();
|
||||
_data._projection = (Projection *)Pools::_bucket_large.alloc();
|
||||
memnew_placement(_data._projection, Projection(*p_variant._data._projection));
|
||||
} break;
|
||||
|
||||
|
|
@ -1374,35 +1388,35 @@ void Variant::_clear_internal() {
|
|||
case TRANSFORM2D: {
|
||||
if (_data._transform2d) {
|
||||
_data._transform2d->~Transform2D();
|
||||
VariantPools::free(_data._transform2d);
|
||||
Pools::_bucket_small.free((Pools::BucketSmall *)_data._transform2d);
|
||||
_data._transform2d = nullptr;
|
||||
}
|
||||
} break;
|
||||
case AABB: {
|
||||
if (_data._aabb) {
|
||||
_data._aabb->~AABB();
|
||||
VariantPools::free(_data._aabb);
|
||||
Pools::_bucket_small.free((Pools::BucketSmall *)_data._aabb);
|
||||
_data._aabb = nullptr;
|
||||
}
|
||||
} break;
|
||||
case BASIS: {
|
||||
if (_data._basis) {
|
||||
_data._basis->~Basis();
|
||||
VariantPools::free(_data._basis);
|
||||
Pools::_bucket_medium.free((Pools::BucketMedium *)_data._basis);
|
||||
_data._basis = nullptr;
|
||||
}
|
||||
} break;
|
||||
case TRANSFORM3D: {
|
||||
if (_data._transform3d) {
|
||||
_data._transform3d->~Transform3D();
|
||||
VariantPools::free(_data._transform3d);
|
||||
Pools::_bucket_medium.free((Pools::BucketMedium *)_data._transform3d);
|
||||
_data._transform3d = nullptr;
|
||||
}
|
||||
} break;
|
||||
case PROJECTION: {
|
||||
if (_data._projection) {
|
||||
_data._projection->~Projection();
|
||||
VariantPools::free(_data._projection);
|
||||
Pools::_bucket_large.free((Pools::BucketLarge *)_data._projection);
|
||||
_data._projection = nullptr;
|
||||
}
|
||||
} break;
|
||||
|
|
@ -1490,10 +1504,6 @@ Variant::operator int8_t() const {
|
|||
return _to_int<int8_t>();
|
||||
}
|
||||
|
||||
Variant::operator Math::int_alt_t() const {
|
||||
return _to_int<Math::int_alt_t>();
|
||||
}
|
||||
|
||||
Variant::operator uint64_t() const {
|
||||
return _to_int<uint64_t>();
|
||||
}
|
||||
|
|
@ -1510,10 +1520,6 @@ Variant::operator uint8_t() const {
|
|||
return _to_int<uint8_t>();
|
||||
}
|
||||
|
||||
Variant::operator Math::uint_alt_t() const {
|
||||
return _to_int<Math::uint_alt_t>();
|
||||
}
|
||||
|
||||
Variant::operator ObjectID() const {
|
||||
if (type == INT) {
|
||||
return ObjectID(_data._int);
|
||||
|
|
@ -2327,11 +2333,6 @@ Variant::Variant(int8_t p_int8) :
|
|||
_data._int = p_int8;
|
||||
}
|
||||
|
||||
Variant::Variant(Math::int_alt_t p_int_alt) :
|
||||
type(INT) {
|
||||
_data._int = p_int_alt;
|
||||
}
|
||||
|
||||
Variant::Variant(uint64_t p_uint64) :
|
||||
type(INT) {
|
||||
_data._int = int64_t(p_uint64);
|
||||
|
|
@ -2352,11 +2353,6 @@ Variant::Variant(uint8_t p_uint8) :
|
|||
_data._int = int64_t(p_uint8);
|
||||
}
|
||||
|
||||
Variant::Variant(Math::uint_alt_t p_uint_alt) :
|
||||
type(INT) {
|
||||
_data._int = p_uint_alt;
|
||||
}
|
||||
|
||||
Variant::Variant(float p_float) :
|
||||
type(FLOAT) {
|
||||
_data._float = p_float;
|
||||
|
|
@ -2452,13 +2448,13 @@ Variant::Variant(const Plane &p_plane) :
|
|||
|
||||
Variant::Variant(const ::AABB &p_aabb) :
|
||||
type(AABB) {
|
||||
_data._aabb = VariantPools::alloc<::AABB>();
|
||||
_data._aabb = (::AABB *)Pools::_bucket_small.alloc();
|
||||
memnew_placement(_data._aabb, ::AABB(p_aabb));
|
||||
}
|
||||
|
||||
Variant::Variant(const Basis &p_matrix) :
|
||||
type(BASIS) {
|
||||
_data._basis = VariantPools::alloc<Basis>();
|
||||
_data._basis = (Basis *)Pools::_bucket_medium.alloc();
|
||||
memnew_placement(_data._basis, Basis(p_matrix));
|
||||
}
|
||||
|
||||
|
|
@ -2470,19 +2466,19 @@ Variant::Variant(const Quaternion &p_quaternion) :
|
|||
|
||||
Variant::Variant(const Transform3D &p_transform) :
|
||||
type(TRANSFORM3D) {
|
||||
_data._transform3d = VariantPools::alloc<Transform3D>();
|
||||
_data._transform3d = (Transform3D *)Pools::_bucket_medium.alloc();
|
||||
memnew_placement(_data._transform3d, Transform3D(p_transform));
|
||||
}
|
||||
|
||||
Variant::Variant(const Projection &pp_projection) :
|
||||
type(PROJECTION) {
|
||||
_data._projection = VariantPools::alloc<Projection>();
|
||||
_data._projection = (Projection *)Pools::_bucket_large.alloc();
|
||||
memnew_placement(_data._projection, Projection(pp_projection));
|
||||
}
|
||||
|
||||
Variant::Variant(const Transform2D &p_transform) :
|
||||
type(TRANSFORM2D) {
|
||||
_data._transform2d = VariantPools::alloc<Transform2D>();
|
||||
_data._transform2d = (Transform2D *)Pools::_bucket_small.alloc();
|
||||
memnew_placement(_data._transform2d, Transform2D(p_transform));
|
||||
}
|
||||
|
||||
|
|
@ -3159,18 +3155,18 @@ uint32_t Variant::recursive_hash(int recursion_count) const {
|
|||
#define hash_compare_packed_array(p_lhs, p_rhs, p_type, p_compare_func) \
|
||||
const Vector<p_type> &l = PackedArrayRef<p_type>::get_array(p_lhs); \
|
||||
const Vector<p_type> &r = PackedArrayRef<p_type>::get_array(p_rhs); \
|
||||
\
|
||||
if (l.size() != r.size()) \
|
||||
return false; \
|
||||
\
|
||||
const p_type *lr = l.ptr(); \
|
||||
const p_type *rr = r.ptr(); \
|
||||
\
|
||||
for (int i = 0; i < l.size(); ++i) { \
|
||||
if (!p_compare_func((lr[i]), (rr[i]))) \
|
||||
return false; \
|
||||
} \
|
||||
\
|
||||
\
|
||||
if (l.size() != r.size()) \
|
||||
return false; \
|
||||
\
|
||||
const p_type *lr = l.ptr(); \
|
||||
const p_type *rr = r.ptr(); \
|
||||
\
|
||||
for (int i = 0; i < l.size(); ++i) { \
|
||||
if (!p_compare_func((lr[i]), (rr[i]))) \
|
||||
return false; \
|
||||
} \
|
||||
\
|
||||
return true
|
||||
|
||||
bool Variant::hash_compare(const Variant &p_variant, int recursion_count, bool semantic_comparison) const {
|
||||
|
|
@ -3437,24 +3433,14 @@ bool Variant::is_ref_counted() const {
|
|||
bool Variant::is_type_shared(Variant::Type p_type) {
|
||||
switch (p_type) {
|
||||
case OBJECT:
|
||||
case DICTIONARY:
|
||||
case ARRAY:
|
||||
// NOTE: Packed array constructors **do** copies (unlike `Array()` and `Dictionary()`),
|
||||
// whereas they pass by reference when inside a `Variant`.
|
||||
case PACKED_BYTE_ARRAY:
|
||||
case PACKED_INT32_ARRAY:
|
||||
case PACKED_INT64_ARRAY:
|
||||
case PACKED_FLOAT32_ARRAY:
|
||||
case PACKED_FLOAT64_ARRAY:
|
||||
case PACKED_STRING_ARRAY:
|
||||
case PACKED_VECTOR2_ARRAY:
|
||||
case PACKED_VECTOR3_ARRAY:
|
||||
case PACKED_COLOR_ARRAY:
|
||||
case PACKED_VECTOR4_ARRAY:
|
||||
case DICTIONARY:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
default: {
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Variant::is_shared() const {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue