diff options
author | Jesse Yurkovich <jesse.y@gmail.com> | 2021-09-03 23:03:28 +0300 |
---|---|---|
committer | Jesse Yurkovich <jesse.y@gmail.com> | 2021-09-03 23:03:28 +0300 |
commit | 4fb7217043627ce952583d99c4b8537e10ee2903 (patch) | |
tree | df40c700fabee7a967a28b919b5c7b1dc2e7372d /source/blender/makesrna/intern | |
parent | 235655ee0d0634db9150b1dc266e3a3b35c491e4 (diff) |
UDIM: Show the UV grid even when images are loaded
Allow the UDIM grid to be shown and adjusted when there are images
loaded in UV edit mode. Right now the grid feature disappears once an
image is loaded and many have found this to be confusing.
Based on community and artist feedback, there was support to change this
behavior[1]
This patch does the following:
- Allows the grid to be shown even when images are present
- The max allowable dimensions for the grid has been increased from
10x10 to 10x100 to match the underlying maximum UDIM range that blender
supports
Note: This should not affect other Image editor modes like Paint/Mask or
the Render Result viewer etc. Future work in this area is currently
documented in a dedicated design task[2]
[1] https://devtalk.blender.org/t/the-udim-tile-grid-design-and-feedback-thread/20136
[2] https://developer.blender.org/T90913
Differential Revision: https://developer.blender.org/D11860
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index d391b09189a..7aee6944d8d 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -1796,6 +1796,16 @@ static const EnumPropertyItem *rna_SpaceImageEditor_pivot_itemf(bContext *UNUSED } } +static void rna_SpaceUVEditor_tile_grid_shape_set(PointerRNA *ptr, const int *values) +{ + SpaceImage *data = (SpaceImage *)(ptr->data); + + int clamp[2] = {10, 100}; + for (int i = 0; i < 2; i++) { + data->tile_grid_shape[i] = CLAMPIS(values[i], 1, clamp[i]); + } +} + /* Space Text Editor */ static void rna_SpaceTextEditor_word_wrap_set(PointerRNA *ptr, bool value) @@ -3417,7 +3427,8 @@ static void rna_def_space_image_uv(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "tile_grid_shape"); RNA_def_property_array(prop, 2); RNA_def_property_int_default(prop, 1); - RNA_def_property_range(prop, 1, 10); + RNA_def_property_range(prop, 1, 100); + RNA_def_property_int_funcs(prop, NULL, "rna_SpaceUVEditor_tile_grid_shape_set", NULL); RNA_def_property_ui_text( prop, "Tile Grid Shape", "How many tiles will be shown in the background"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL); |