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 <ideasman42@gmail.com>2020-01-15 11:03:05 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-01-15 11:03:05 +0300
commit27c5fb6fc4b2b9a3c0f43811e7d65ac4e132804b (patch)
treeed59839785b57d18eae08e454db1282f11b0947b /source/blender/blenkernel
parentdf36e1c5dd3c5843bcdc58a7021c6defc25d56ad (diff)
3D View: use compatible quaternions when placing the cursor
The compatible option was used for euler rotation but not quaternions.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/intern/scene.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index e57a50a8a23..2fda6cfb43b 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -2213,7 +2213,16 @@ void BKE_scene_cursor_mat3_to_rot(View3DCursor *cursor, const float mat[3][3], b
switch (cursor->rotation_mode) {
case ROT_MODE_QUAT: {
- mat3_normalized_to_quat(cursor->rotation_quaternion, mat);
+ float quat[4];
+ mat3_normalized_to_quat(quat, mat);
+ if (use_compat) {
+ float quat_orig[4];
+ copy_v4_v4(quat_orig, cursor->rotation_quaternion);
+ quat_to_compatible_quat(cursor->rotation_quaternion, quat, quat_orig);
+ }
+ else {
+ copy_v4_v4(cursor->rotation_quaternion, quat);
+ }
break;
}
case ROT_MODE_AXISANGLE: {
@@ -2239,7 +2248,14 @@ void BKE_scene_cursor_quat_to_rot(View3DCursor *cursor, const float quat[4], boo
switch (cursor->rotation_mode) {
case ROT_MODE_QUAT: {
- copy_qt_qt(cursor->rotation_quaternion, quat);
+ if (use_compat) {
+ float quat_orig[4];
+ copy_v4_v4(quat_orig, cursor->rotation_quaternion);
+ quat_to_compatible_quat(cursor->rotation_quaternion, quat, quat_orig);
+ }
+ else {
+ copy_qt_qt(cursor->rotation_quaternion, quat);
+ }
break;
}
case ROT_MODE_AXISANGLE: {