[Bf-blender-cvs] [8e071e76de5] blender2.8: Gizmo: change axis used for shear handles

Campbell Barton noreply at git.blender.org
Wed Oct 17 08:48:30 CEST 2018


Commit: 8e071e76de5ef75285bf14941508a86459642174
Author: Campbell Barton
Date:   Wed Oct 17 17:47:09 2018 +1100
Branches: blender2.8
https://developer.blender.org/rB8e071e76de5ef75285bf14941508a86459642174

Gizmo: change axis used for shear handles

The shear direction should be more obvious this way.

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

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

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

diff --git a/source/blender/editors/transform/transform_gizmo_3d.c b/source/blender/editors/transform/transform_gizmo_3d.c
index 98a0e880ef6..b9c984f7f21 100644
--- a/source/blender/editors/transform/transform_gizmo_3d.c
+++ b/source/blender/editors/transform/transform_gizmo_3d.c
@@ -2078,12 +2078,20 @@ static void WIDGETGROUP_xform_shear_refresh(const bContext *C, wmGizmoGroup *gzg
 				WM_gizmo_set_flag(gz, WM_GIZMO_MOVE_CURSOR, true);
 
 				wmGizmoOpElem *gzop = WM_gizmo_operator_get(gz, 0);
-				const int i_ortho = (i + j + 1) % 3;
-				WM_gizmo_set_matrix_rotation_from_yz_axis(gz, rv3d->twmat[i_ortho], rv3d->twmat[i]);
+				const int i_ortho_a = (i + j + 1) % 3;
+				const int i_ortho_b = (i + (1 - j) + 1) % 3;
+				WM_gizmo_set_matrix_rotation_from_yz_axis(gz, rv3d->twmat[i_ortho_a], rv3d->twmat[i]);
 				WM_gizmo_set_matrix_location(gz, rv3d->twmat[3]);
 
-				RNA_float_set_array(&gzop->ptr, "axis", tbounds.axis[i]);
-				RNA_float_set_array(&gzop->ptr, "axis_ortho", tbounds.axis[i_ortho]);
+				float axis[3];
+				if (j == 0) {
+					copy_v3_v3(axis, tbounds.axis[i_ortho_b]);
+				}
+				else {
+					negate_v3_v3(axis, tbounds.axis[i_ortho_b]);
+				}
+				RNA_float_set_array(&gzop->ptr, "axis", axis);
+				RNA_float_set_array(&gzop->ptr, "axis_ortho", tbounds.axis[i_ortho_a]);
 				mul_v3_fl(gz->matrix_basis[0], 0.5f);
 				mul_v3_fl(gz->matrix_basis[1], 6.0f);
 			}



More information about the Bf-blender-cvs mailing list