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 13:40:43 +0300
committerCampbell Barton <campbell@blender.org>2022-08-24 13:40:43 +0300
commit489aeda034130d84674b82368d083ad9ab87fa0a (patch)
tree7cd33646de5acf8e34962be62ca151fac3cea259 /source/blender/python
parentdc2d75d9bc403b81eaf4b39df561afa5304cfa49 (diff)
parent8c38a994c6b7728d4eae21626b566bcc13376c49 (diff)
Merge branch 'blender-v3.3-release'
Diffstat (limited to 'source/blender/python')
-rw-r--r--source/blender/python/mathutils/mathutils_Quaternion.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/python/mathutils/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c
index 6994a313237..4972381d29e 100644
--- a/source/blender/python/mathutils/mathutils_Quaternion.c
+++ b/source/blender/python/mathutils/mathutils_Quaternion.c
@@ -543,8 +543,13 @@ static PyObject *Quaternion_rotate(QuaternionObject *self, PyObject *value)
length = normalize_qt_qt(tquat, self->quat);
quat_to_mat3(self_rmat, tquat);
mul_m3_m3m3(rmat, other_rmat, self_rmat);
-
- mat3_to_quat(self->quat, rmat);
+ normalize_m3(rmat);
+ /* This check could also be performed on `other_rmat`, use the final result instead to ensure
+ * float imprecision doesn't allow the multiplication to make `rmat` negative. */
+ if (is_negative_m3(rmat)) {
+ negate_m3(rmat);
+ }
+ mat3_normalized_to_quat(self->quat, rmat);
mul_qt_fl(self->quat, length); /* maintain length after rotating */
(void)BaseMath_WriteCallback(self);