Fix T103868: render uv transform gizmo even if it has zero area
Change the 2D Gizmo drawing function to provide a usable transform matrix, if it would otherwise be degenerate. Differential Revision: https://developer.blender.org/D17113
This commit is contained in:
parent
34a6591a07
commit
6c8db7c22b
Notes:
blender-bot
2023-02-14 03:21:27 +01:00
Referenced by issue #103868, UV Editor, Manipulator disappears if AABB of selection has zero area.
|
@ -604,8 +604,11 @@ static void gizmo2d_xform_draw_prepare(const bContext *C, wmGizmoGroup *gzgroup)
|
|||
UI_view2d_view_to_region_m4(®ion->v2d, ggd->cage->matrix_space);
|
||||
/* Define the bounding box of the gizmo in the offset transform matrix. */
|
||||
unit_m4(ggd->cage->matrix_offset);
|
||||
ggd->cage->matrix_offset[0][0] = (ggd->max[0] - ggd->min[0]);
|
||||
ggd->cage->matrix_offset[1][1] = (ggd->max[1] - ggd->min[1]);
|
||||
const float min_gizmo_pixel_size = 0.001f; /* Draw Gizmo larger than this many pixels. */
|
||||
const float min_scale_axis_x = min_gizmo_pixel_size / ggd->cage->matrix_space[0][0];
|
||||
const float min_scale_axis_y = min_gizmo_pixel_size / ggd->cage->matrix_space[1][1];
|
||||
ggd->cage->matrix_offset[0][0] = max_ff(min_scale_axis_x, ggd->max[0] - ggd->min[0]);
|
||||
ggd->cage->matrix_offset[1][1] = max_ff(min_scale_axis_y, ggd->max[1] - ggd->min[1]);
|
||||
|
||||
ScrArea *area = CTX_wm_area(C);
|
||||
|
||||
|
|
Loading…
Reference in New Issue