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-18 04:58:54 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-10-18 05:00:16 +0300
commit9b5cf593a6068c9415b28eb24ba2d4ab17a2bed8 (patch)
treef675f324ade2748f671e3cab4a8cc9b17e99668d /source/blender/editors/transform/transform_gizmo_3d.c
parent678c2003097d4a5f2def4e8a6f014420ad609d6e (diff)
Gizmo: tweak sorting to avoid view-aligned shear
Diffstat (limited to 'source/blender/editors/transform/transform_gizmo_3d.c')
-rw-r--r--source/blender/editors/transform/transform_gizmo_3d.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/source/blender/editors/transform/transform_gizmo_3d.c b/source/blender/editors/transform/transform_gizmo_3d.c
index 6297cb57c03..4c1be88904d 100644
--- a/source/blender/editors/transform/transform_gizmo_3d.c
+++ b/source/blender/editors/transform/transform_gizmo_3d.c
@@ -2100,7 +2100,17 @@ static void WIDGETGROUP_xform_shear_draw_prepare(const bContext *C, wmGizmoGroup
/* Basic ordering for drawing only. */
{
LISTBASE_FOREACH (wmGizmo *, gz, &gzgroup->gizmos) {
- gz->temp.f = dot_v3v3(rv3d->viewinv[2], gz->matrix_basis[2]);
+ /* Since we have two pairs of each axis,
+ * bias the values so gizmos that are orthogonal to the view get priority.
+ * This means we never default to shearing along the view axis in the case of an overlap. */
+ float axis_order[3], axis_bias[3];
+ copy_v3_v3(axis_order, gz->matrix_basis[2]);
+ copy_v3_v3(axis_bias, gz->matrix_basis[1]);
+ if (dot_v3v3(axis_bias, rv3d->viewinv[2]) < 0.0f) {
+ negate_v3(axis_bias);
+ }
+ madd_v3_v3fl(axis_order, axis_bias, 0.01f);
+ gz->temp.f = dot_v3v3(rv3d->viewinv[2], axis_order);
}
BLI_listbase_sort(&gzgroup->gizmos, WM_gizmo_cmp_temp_fl_reverse);
}