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>2018-10-17 09:47:09 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-10-17 09:47:09 +0300
commit8e071e76de5ef75285bf14941508a86459642174 (patch)
tree7d72c31b75160e6cf8f411868bde1c3bb43d0de7 /source/blender/editors/transform/transform_gizmo_3d.c
parent80fb943e4f5326aa5cdebb7be1c54044bcc6da92 (diff)
Gizmo: change axis used for shear handles
The shear direction should be more obvious this way.
Diffstat (limited to 'source/blender/editors/transform/transform_gizmo_3d.c')
-rw-r--r--source/blender/editors/transform/transform_gizmo_3d.c16
1 files changed, 12 insertions, 4 deletions
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);
}