Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Blackbourn <chrisbblend@gmail.com>2022-09-18 08:03:40 +0300
committerChris Blackbourn <chrisbblend@gmail.com>2022-09-20 01:00:41 +0300
commita24fc6bbc1ae3c0ee5a26c5b964af219215de692 (patch)
tree007f58081ebdc48a90102390796ce7a3deba9971 /source/blender/makesrna/intern/rna_space.c
parent7a67d69ca4fe807ea36c57166b89a6e42c25b909 (diff)
UV: extend custom grid sizes to set each axis separately
For example, allows a custom UV grid size of 4 x 12. TODO: Fix snapping with custom UV grid sizes. Manifest Tasks: T78391 Differential Revision: https://developer.blender.org/D16000
Diffstat (limited to 'source/blender/makesrna/intern/rna_space.c')
-rw-r--r--source/blender/makesrna/intern/rna_space.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index bf25e3214f8..e2a3fcc367e 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -1886,6 +1886,15 @@ static void rna_SpaceUVEditor_tile_grid_shape_set(PointerRNA *ptr, const int *va
}
}
+static void rna_SpaceUVEditor_custom_grid_subdiv_set(PointerRNA *ptr, const int *values)
+{
+ SpaceImage *data = (SpaceImage *)(ptr->data);
+
+ for (int i = 0; i < 2; i++) {
+ data->custom_grid_subdiv[i] = CLAMPIS(values[i], 1, 5000);
+ }
+}
+
/* Space Text Editor */
static void rna_SpaceTextEditor_word_wrap_set(PointerRNA *ptr, bool value)
@@ -3611,9 +3620,12 @@ static void rna_def_space_image_uv(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Custom Grid", "Use a grid with a user-defined number of steps");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
- prop = RNA_def_property(srna, "custom_grid_subdivisions", PROP_INT, PROP_NONE);
+ prop = RNA_def_property(srna, "custom_grid_subdivisions", PROP_INT, PROP_XYZ);
RNA_def_property_int_sdna(prop, NULL, "custom_grid_subdiv");
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_int_default(prop, 10);
RNA_def_property_range(prop, 1, 5000);
+ RNA_def_property_int_funcs(prop, NULL, "rna_SpaceUVEditor_custom_grid_subdiv_set", NULL);
RNA_def_property_ui_text(
prop, "Dynamic Grid Size", "Number of grid units in UV space that make one UV Unit");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);