From 92c89d7b879229ac01390da068026d0a11d864f1 Mon Sep 17 00:00:00 2001 From: Jesse Yurkovich Date: Fri, 8 Apr 2022 21:40:05 -0700 Subject: 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 --- release/scripts/startup/bl_ui/space_image.py | 72 ++++++++++++---------------- 1 file changed, 31 insertions(+), 41 deletions(-) (limited to 'release/scripts/startup/bl_ui') diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py index 785a841a0e6..1dd50c979e2 100644 --- a/release/scripts/startup/bl_ui/space_image.py +++ b/release/scripts/startup/bl_ui/space_image.py @@ -1453,66 +1453,57 @@ class IMAGE_PT_uv_cursor(Panel): col.prop(sima, "cursor_location", text="Location") -class IMAGE_PT_udim_grid(Panel): +class IMAGE_PT_overlay(Panel): bl_space_type = 'IMAGE_EDITOR' - bl_region_type = 'UI' - bl_category = "View" - bl_label = "UDIM Grid" - - @classmethod - def poll(cls, context): - sima = context.space_data - - return sima.show_uvedit + bl_region_type = 'HEADER' + bl_label = "Overlays" + bl_ui_units_x = 13 def draw(self, context): - layout = self.layout - - sima = context.space_data - uvedit = sima.uv_editor - - layout.use_property_split = True - layout.use_property_decorate = False + pass - col = layout.column() - col.prop(uvedit, "tile_grid_shape", text="Grid Shape") -class IMAGE_PT_custom_grid(Panel): +class IMAGE_PT_overlay_guides(Panel): bl_space_type = 'IMAGE_EDITOR' - bl_region_type = 'UI' - bl_category = "View" - bl_label = "Custom Grid" + bl_region_type = 'HEADER' + bl_label = "Guides" + bl_parent_id = 'IMAGE_PT_overlay' @classmethod def poll(cls, context): sima = context.space_data - return sima.show_uvedit - def draw_header(self, context): - sima = context.space_data - uvedit = sima.uv_editor - self.layout.prop(uvedit, "use_custom_grid", text="") + return sima.show_uvedit def draw(self, context): layout = self.layout sima = context.space_data + overlay = sima.overlay uvedit = sima.uv_editor - layout.use_property_split = True - layout.use_property_decorate = False + layout.active = overlay.show_overlays - col = layout.column() - col.prop(uvedit, "custom_grid_subdivisions", text="Subdivisions") + row = layout.row() + row_el = row.column() + row_el.prop(overlay, "show_grid_background", text="Grid") -class IMAGE_PT_overlay(Panel): - bl_space_type = 'IMAGE_EDITOR' - bl_region_type = 'HEADER' - bl_label = "Overlays" - bl_ui_units_x = 13 + if overlay.show_grid_background: + layout.use_property_split = True + col = layout.column(align=False, heading="Fixed Subdivisions") + col.use_property_decorate = False - def draw(self, context): - pass + row = col.row(align=True) + sub = row.row(align=True) + sub.prop(uvedit, "use_custom_grid", text="") + sub = sub.row(align=True) + sub.active = uvedit.use_custom_grid + sub.prop(uvedit, "custom_grid_subdivisions", text="") + + row = layout.row() + row.use_property_split = True + row.use_property_decorate = False + row.prop(uvedit, "tile_grid_shape", text="Tiles") class IMAGE_PT_overlay_uv_edit(Panel): @@ -1689,9 +1680,8 @@ classes = ( IMAGE_PT_scope_sample, IMAGE_PT_uv_cursor, IMAGE_PT_annotation, - IMAGE_PT_udim_grid, - IMAGE_PT_custom_grid, IMAGE_PT_overlay, + IMAGE_PT_overlay_guides, IMAGE_PT_overlay_uv_edit, IMAGE_PT_overlay_uv_edit_geometry, IMAGE_PT_overlay_texture_paint, -- cgit v1.2.3