Gizmo: depth sort shear gizmos

This commit is contained in:
Campbell Barton 2018-10-18 11:41:07 +11:00
parent 40f679ccb9
commit eee8153299
1 changed files with 11 additions and 2 deletions

View File

@ -2035,8 +2035,9 @@ static void WIDGETGROUP_xform_shear_setup(const bContext *UNUSED(C), wmGizmoGrou
for (int j = 0; j < 2; j++) {
wmGizmo *gz = WM_gizmo_new_ptr(gzt_arrow, gzgroup, NULL);
RNA_enum_set(gz->ptr, "draw_style", ED_GIZMO_ARROW_STYLE_BOX);
const int i_ortho = (i + j + 1) % 3;
interp_v3_v3v3(gz->color, axis_color[i], axis_color[i_ortho], 0.33f);
const int i_ortho_a = (i + j + 1) % 3;
const int i_ortho_b = (i + (1 - j) + 1) % 3;
interp_v3_v3v3(gz->color, axis_color[i_ortho_a], axis_color[i_ortho_b], 0.75f);
gz->color[3] = 0.5f;
PointerRNA *ptr = WM_gizmo_operator_set(gz, 0, ot_shear, NULL);
RNA_boolean_set(ptr, "release_confirm", 1);
@ -2132,6 +2133,14 @@ 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]);
}
BLI_listbase_sort(&gzgroup->gizmos, WM_gizmo_cmp_temp_fl_reverse);
}
}
void VIEW3D_GGT_xform_shear(wmGizmoGroupType *gzgt)