Gizmo: tweak sorting to avoid view-aligned shear
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user