diff options
author | Siddhartha Jejurkar <sidd017> | 2021-09-29 10:47:32 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-09-29 10:48:35 +0300 |
commit | bf06f76be6316be92a4655a41391e163d2fb1221 (patch) | |
tree | 5dac6a12fb65f0897806739d5ef8e00407112041 /release | |
parent | 008ae26712f85475a8a9dc4d031447e12fb05522 (diff) |
UV Editor: Grid and snapping improvements
Implements T89789, T89792, custom grid (described as dynamic grid in
T78389) and UV grid snapping (T78391)
Replaces the default UV editor grid with 2 new types of grid :
* Custom grid: Allows the user to create an NxN grid, where the value
of N is specified by the user.
* Subdividing grid: Subdivides the UV editor grid when the user
zooms in the viewport and vice versa when zooming out.
UV snapping improvements :
* Increment snapping: Increment values for snapping are calculated based
on which grid type is being used in the UV editor
(subdividing or custom). In general the increment value is equal to
the distance between 2 visible grid lines.
* Absolute grid snap: New toggle added to increment snapping option in
the UV editor, allows UV grid snapping during translation.
Reviewed By: campbellbarton
Ref D12684
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/startup/bl_ui/space_image.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py index 3ee668888f3..797d0c62b72 100644 --- a/release/scripts/startup/bl_ui/space_image.py +++ b/release/scripts/startup/bl_ui/space_image.py @@ -934,6 +934,10 @@ class IMAGE_PT_snapping(Panel): row = col.row(align=True) row.prop(tool_settings, "snap_target", expand=True) + col.separator() + if 'INCREMENT' in tool_settings.snap_uv_element: + col.prop(tool_settings, "use_snap_uv_grid_absolute") + col.label(text="Affect") row = col.row(align=True) row.prop(tool_settings, "use_snap_translate", text="Move", toggle=True) @@ -1467,6 +1471,33 @@ class IMAGE_PT_udim_grid(Panel): col = layout.column() col.prop(uvedit, "tile_grid_shape", text="Grid Shape") +class IMAGE_PT_custom_grid(Panel): + bl_space_type = 'IMAGE_EDITOR' + bl_region_type = 'UI' + bl_category = "View" + bl_label = "Custom Grid" + + @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="") + + 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 + + col = layout.column() + col.prop(uvedit, "custom_grid_subdivisions", text="Subdivisions") class IMAGE_PT_overlay(Panel): bl_space_type = 'IMAGE_EDITOR' @@ -1652,6 +1683,7 @@ classes = ( IMAGE_PT_uv_cursor, IMAGE_PT_annotation, IMAGE_PT_udim_grid, + IMAGE_PT_custom_grid, IMAGE_PT_overlay, IMAGE_PT_overlay_uv_edit, IMAGE_PT_overlay_uv_edit_geometry, |