Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <campbell@blender.org>2022-08-24 09:09:13 +0300
committerCampbell Barton <campbell@blender.org>2022-08-24 09:09:13 +0300
commitf39c9d1596f7e2efae2cac30e09dc87989485c6f (patch)
treeb10fe00888015629b9498e5a4795420273a5192e /source/blender
parentbe81690b73ad1e1a54da43b38b791d7c866ec0e1 (diff)
parent10a4726a5b770a6c916c0ee444808d86c63802e2 (diff)
Merge branch 'blender-v3.3-release'
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/python/mathutils/mathutils_Matrix.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c
index 1e85ece124d..de42b11c70b 100644
--- a/source/blender/python/mathutils/mathutils_Matrix.c
+++ b/source/blender/python/mathutils/mathutils_Matrix.c
@@ -1243,13 +1243,19 @@ static PyObject *Matrix_to_quaternion(MatrixObject *self)
"inappropriate matrix size - expects 3x3 or 4x4 matrix");
return NULL;
}
+ float mat3[3][3];
if (self->row_num == 3) {
- mat3_to_quat(quat, (float(*)[3])self->matrix);
+ copy_m3_m3(mat3, (const float(*)[3])self->matrix);
}
else {
- mat4_to_quat(quat, (const float(*)[4])self->matrix);
+ copy_m3_m4(mat3, (const float(*)[4])self->matrix);
}
-
+ normalize_m3(mat3);
+ if (is_negative_m3(mat3)) {
+ /* Without this, the results are invalid, see: T94231. */
+ negate_m3(mat3);
+ }
+ mat3_normalized_to_quat(quat, mat3);
return Quaternion_CreatePyObject(quat, NULL);
}