From 8ddf92681e7dbe417bbb7b67e5d4ad6d099755cf Mon Sep 17 00:00:00 2001 From: Relintai Date: Sat, 20 Jan 2024 12:50:13 +0100 Subject: [PATCH] Fixed smaller issues in VariantOP. --- core/variant/variant_op.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/core/variant/variant_op.cpp b/core/variant/variant_op.cpp index 9476d0da1..4b196d9cc 100644 --- a/core/variant/variant_op.cpp +++ b/core/variant/variant_op.cpp @@ -3315,7 +3315,7 @@ void Variant::set(const Variant &p_index, const Variant &p_value, bool *r_valid) DEFAULT_OP_DVECTOR_SET(POOL_REAL_ARRAY, real_t, p_value.type != Variant::REAL && p_value.type != Variant::INT) DEFAULT_OP_DVECTOR_SET(POOL_STRING_ARRAY, String, p_value.type != Variant::STRING) DEFAULT_OP_DVECTOR_SET(POOL_VECTOR2_ARRAY, Vector2, p_value.type != Variant::VECTOR2) // 25 - DEFAULT_OP_DVECTOR_SET(POOL_VECTOR2I_ARRAY, Vector2i, p_value.type != Variant::VECTOR2I) + DEFAULT_OP_DVECTOR_SET(POOL_VECTOR2I_ARRAY, Vector2i, p_value.type != Variant::VECTOR2I) DEFAULT_OP_DVECTOR_SET(POOL_VECTOR3_ARRAY, Vector3, p_value.type != Variant::VECTOR3) DEFAULT_OP_DVECTOR_SET(POOL_VECTOR3I_ARRAY, Vector3i, p_value.type != Variant::VECTOR3I) DEFAULT_OP_DVECTOR_SET(POOL_VECTOR4_ARRAY, Vector4, p_value.type != Variant::VECTOR4) @@ -5382,7 +5382,7 @@ void Variant::blend(const Variant &a, const Variant &b, float c, Variant &r_dst) case RECT2I: { const Rect2i *ra = reinterpret_cast(a._data._mem); const Rect2i *rb = reinterpret_cast(b._data._mem); - r_dst = Rect2(ra->position + rb->position * c, ra->size + rb->size * c); + r_dst = Rect2i(ra->position + rb->position * c, ra->size + rb->size * c); } return; case VECTOR2: { @@ -5523,7 +5523,7 @@ void Variant::interpolate(const Variant &a, const Variant &b, float c, Variant & } return; case RECT2I: { - r_dst = Rect2(reinterpret_cast(a._data._mem)->position.linear_interpolate(reinterpret_cast(b._data._mem)->position, c), reinterpret_cast(a._data._mem)->size.linear_interpolate(reinterpret_cast(b._data._mem)->size, c)); + r_dst = Rect2i(reinterpret_cast(a._data._mem)->position.linear_interpolate(reinterpret_cast(b._data._mem)->position, c), reinterpret_cast(a._data._mem)->size.linear_interpolate(reinterpret_cast(b._data._mem)->size, c)); } return; case VECTOR2: { @@ -5768,7 +5768,6 @@ void Variant::interpolate(const Variant &a, const Variant &b, float c, Variant & } return; case POOL_VECTOR4I_ARRAY: { - /* const PoolVector *arr_a = reinterpret_cast *>(a._data._mem); const PoolVector *arr_b = reinterpret_cast *>(b._data._mem); int sz = arr_a->size(); @@ -5783,12 +5782,12 @@ void Variant::interpolate(const Variant &a, const Variant &b, float c, Variant & PoolVector::Read br = arr_b->read(); for (int i = 0; i < sz; i++) { - vw[i] = ar[i].lerp(br[i], c); + vw[i] = ar[i].linear_interpolate(br[i], c); } } r_dst = v; } - */ + r_dst = a; } return;