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.
This commit is contained in:
2021-02-03 14:34:19 -03:00
parent 9042532085
commit bbd74e9fd4

View File

@@ -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);
}
}