[Bf-blender-cvs] [9b5cf593a60] blender2.8: Gizmo: tweak sorting to avoid view-aligned shear
Campbell Barton
noreply at git.blender.org
Thu Oct 18 04:00:24 CEST 2018
Commit: 9b5cf593a6068c9415b28eb24ba2d4ab17a2bed8
Author: Campbell Barton
Date: Thu Oct 18 12:58:54 2018 +1100
Branches: blender2.8
https://developer.blender.org/rB9b5cf593a6068c9415b28eb24ba2d4ab17a2bed8
Gizmo: tweak sorting to avoid view-aligned shear
===================================================================
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 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);
}
More information about the Bf-blender-cvs
mailing list