Fix smaller issues in variant op.

This commit is contained in:
Relintai 2024-01-20 12:47:21 +01:00
parent 99e16eb434
commit 13807c1292

View File

@ -3244,7 +3244,11 @@ 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_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_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_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_VECTOR3_ARRAY, Vector3, p_value.type != Variant::VECTOR3) 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)
DEFAULT_OP_DVECTOR_SET(POOL_VECTOR4I_ARRAY, Vector4i, p_value.type != Variant::VECTOR4I)
DEFAULT_OP_DVECTOR_SET(POOL_COLOR_ARRAY, Color, p_value.type != Variant::COLOR) DEFAULT_OP_DVECTOR_SET(POOL_COLOR_ARRAY, Color, p_value.type != Variant::COLOR)
default: default:
return; return;
@ -5058,7 +5062,7 @@ void Variant::blend(const Variant &a, const Variant &b, float c, Variant &r_dst)
case RECT2I: { case RECT2I: {
const Rect2i *ra = reinterpret_cast<const Rect2i *>(a._data._mem); const Rect2i *ra = reinterpret_cast<const Rect2i *>(a._data._mem);
const Rect2i *rb = reinterpret_cast<const Rect2i *>(b._data._mem); const Rect2i *rb = reinterpret_cast<const Rect2i *>(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; return;
case VECTOR2: { case VECTOR2: {
@ -5436,7 +5440,6 @@ void Variant::interpolate(const Variant &a, const Variant &b, float c, Variant &
} }
return; return;
case POOL_VECTOR4I_ARRAY: { case POOL_VECTOR4I_ARRAY: {
/*
const PoolVector<Vector4i> *arr_a = reinterpret_cast<const PoolVector<Vector4i> *>(a._data._mem); const PoolVector<Vector4i> *arr_a = reinterpret_cast<const PoolVector<Vector4i> *>(a._data._mem);
const PoolVector<Vector4i> *arr_b = reinterpret_cast<const PoolVector<Vector4i> *>(b._data._mem); const PoolVector<Vector4i> *arr_b = reinterpret_cast<const PoolVector<Vector4i> *>(b._data._mem);
int sz = arr_a->size(); int sz = arr_a->size();
@ -5451,12 +5454,12 @@ void Variant::interpolate(const Variant &a, const Variant &b, float c, Variant &
PoolVector<Vector4i>::Read br = arr_b->read(); PoolVector<Vector4i>::Read br = arr_b->read();
for (int i = 0; i < sz; i++) { 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 = v;
} }
*/
r_dst = a; r_dst = a;
} }
return; return;