[Bf-blender-cvs] [bbd74e9fd4c] blender-v2.92-release: Fix T85340: Gizmo rotation inverted (in some perspective angles)

Germano Cavalcante noreply at git.blender.org
Wed Feb 3 18:55:15 CET 2021


Commit: bbd74e9fd4ce014cc98c76eae03563dd0c0d1727
Author: Germano Cavalcante
Date:   Wed Feb 3 14:34:19 2021 -0300
Branches: blender-v2.92-release
https://developer.blender.org/rBbbd74e9fd4ce014cc98c76eae03563dd0c0d1727

Fix T85340: Gizmo rotation inverted (in some perspective angles)

This is an old bug (strange not to have been reported before).

To define the direction of rotation, the View Vector is used.

However, only the projection matrix was being considered, but in
perspective mode, the position of the pivot also matters.

===================================================================

M	source/blender/editors/transform/transform_constraints.c

===================================================================

diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c
index 96671697dc4..007ef7fd5c2 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -573,7 +573,9 @@ static void constraints_rotation_imp(TransInfo *t,
   }
   /* don't flip axis if asked to or if num input */
   if (r_angle && (mode & CON_NOFLIP) == 0 && hasNumInput(&t->num) == 0) {
-    if (dot_v3v3(r_vec, t->viewinv[2]) > 0.0f) {
+    float view_vector[3];
+    view_vector_calc(t, t->center_global, view_vector);
+    if (dot_v3v3(r_vec, view_vector) > 0.0f) {
       *r_angle = -(*r_angle);
     }
   }



More information about the Bf-blender-cvs mailing list