diff options
author | Jesse Yurkovich <jesse.y@gmail.com> | 2022-04-09 07:40:05 +0300 |
---|---|---|
committer | Jesse Yurkovich <jesse.y@gmail.com> | 2022-04-09 07:40:05 +0300 |
commit | 92c89d7b879229ac01390da068026d0a11d864f1 (patch) | |
tree | 85e6438ad40203fe2aeffcd15e4499715425c0a0 /source/blender/draw/engines | |
parent | 502d16e66788487113ba18f85f44ebd7eff6c492 (diff) |
UDIM: Move UDIM grid controls to the Overlay panel
This change moves the grid panel UI from the View tab up into the
Overlay panel.
Reasons to move to the Overlay panel include:
- Consistency with the grid options in the 3D viewport
- The grid has been drawn as an Overlay for quite some time already
Additional changes that now make sense to have:
- The grid responds to the main Overlay show/hide toggle
- Adds a toggle to show/hide the grid which is consistent with overlays in general
As before, these grid controls are only available for active UV edit
sessions.
Differential Revision: https://developer.blender.org/D11862
Diffstat (limited to 'source/blender/draw/engines')
-rw-r--r-- | source/blender/draw/engines/overlay/overlay_grid.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/source/blender/draw/engines/overlay/overlay_grid.c b/source/blender/draw/engines/overlay/overlay_grid.c index 20403f156a1..ed6db459696 100644 --- a/source/blender/draw/engines/overlay/overlay_grid.c +++ b/source/blender/draw/engines/overlay/overlay_grid.c @@ -49,20 +49,29 @@ void OVERLAY_grid_init(OVERLAY_Data *vedata) if (pd->space_type == SPACE_IMAGE) { SpaceImage *sima = (SpaceImage *)draw_ctx->space_data; View2D *v2d = &draw_ctx->region->v2d; - if (sima->mode == SI_MODE_UV || !ED_space_image_has_buffer(sima)) { - shd->grid_flag = GRID_BACK | PLANE_IMAGE | SHOW_GRID; - } - else { - shd->grid_flag = 0; + + /* Only UV Edit mode has the various Overlay options for now. */ + const bool is_uv_edit = sima->mode == SI_MODE_UV; + + const bool background_enabled = is_uv_edit ? (!pd->hide_overlays && + (sima->overlay.flag & + SI_OVERLAY_SHOW_GRID_BACKGROUND) != 0) : + true; + if (background_enabled) { + shd->grid_flag = GRID_BACK | PLANE_IMAGE; } - if (sima->flag & SI_CUSTOM_GRID) { - shd->grid_flag |= CUSTOM_GRID; + const bool draw_grid = is_uv_edit || !ED_space_image_has_buffer(sima); + if (background_enabled && draw_grid) { + shd->grid_flag |= SHOW_GRID; + if (is_uv_edit && (sima->flag & SI_CUSTOM_GRID) != 0) { + shd->grid_flag |= CUSTOM_GRID; + } } shd->grid_distance = 1.0f; copy_v3_fl3(shd->grid_size, 1.0f, 1.0f, 1.0f); - if (sima->mode == SI_MODE_UV) { + if (is_uv_edit) { shd->grid_size[0] = (float)sima->tile_grid_shape[0]; shd->grid_size[1] = (float)sima->tile_grid_shape[1]; } |