Skip to content

Commit c0e36dc

Browse files
committed
Initialize Quaternion variant with identity
1 parent db66bd3 commit c0e36dc

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

core/variant/variant_internal.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ class VariantInternal {
5454
case Variant::TRANSFORM2D:
5555
init_transform2d(v);
5656
break;
57+
case Variant::QUATERNION:
58+
init_quaternion(v);
59+
break;
5760
case Variant::AABB:
5861
init_aabb(v);
5962
break;
@@ -219,7 +222,7 @@ class VariantInternal {
219222

220223
// Should be in the same order as Variant::Type for consistency.
221224
// Those primitive and vector types don't need an `init_` method:
222-
// Nil, bool, float, Vector2/i, Rect2/i, Vector3/i, Plane, Quat, RID.
225+
// Nil, bool, float, Vector2/i, Rect2/i, Vector3/i, Plane, RID.
223226
// Object is a special case, handled via `object_reset_data`.
224227
_FORCE_INLINE_ static void init_string(Variant *v) {
225228
memnew_placement(v->_data._mem, String);
@@ -230,6 +233,10 @@ class VariantInternal {
230233
memnew_placement(v->_data._transform2d, Transform2D);
231234
v->type = Variant::TRANSFORM2D;
232235
}
236+
_FORCE_INLINE_ static void init_quaternion(Variant *v) {
237+
memnew_placement(v->_data._mem, Quaternion);
238+
v->type = Variant::QUATERNION;
239+
}
233240
_FORCE_INLINE_ static void init_aabb(Variant *v) {
234241
v->_data._aabb = (AABB *)Variant::Pools::_bucket_small.alloc();
235242
memnew_placement(v->_data._aabb, AABB);

0 commit comments

Comments
 (0)