diff options
author | Joep Peters <Joep> | 2019-01-22 17:38:56 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-01-22 19:05:18 +0300 |
commit | 1651879d3419eed71d98bc46dba4adce3c09e573 (patch) | |
tree | 51396caa7c89440758c529a9a5480f0bb89559a0 /source/blender/makesrna | |
parent | babba31c49ef635cad8621444a2f7b7316690512 (diff) |
UV Editor: support snapping to center of pixels, in addition to corners.
Differential Revision: https://developer.blender.org/D4150
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 66729b53394..640929ead19 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -2194,6 +2194,13 @@ static void rna_def_space_image_uv(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; + static const EnumPropertyItem pixel_snap_mode_items[] = { + {SI_PIXEL_SNAP_DISABLED, "DISABLED", 0, "Disabled", "Don't snap to pixels"}, + {SI_PIXEL_SNAP_CORNER, "CORNER", 0, "Corner", "Snap to pixel corners"}, + {SI_PIXEL_SNAP_CENTER, "CENTER", 0, "Center", "Snap to pixel centers"}, + {0, NULL, 0, NULL, NULL} + }; + srna = RNA_def_struct(brna, "SpaceUVEditor", NULL); RNA_def_struct_sdna(srna, "SpaceImage"); RNA_def_struct_nested(brna, srna, "SpaceImageEditor"); @@ -2265,9 +2272,9 @@ static void rna_def_space_image_uv(BlenderRNA *brna) /* todo: move edge and face drawing options here from G.f */ - prop = RNA_def_property(srna, "use_snap_to_pixels", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_PIXELSNAP); - RNA_def_property_ui_text(prop, "Snap to Pixels", "Snap UVs to pixel locations while editing"); + prop = RNA_def_property(srna, "pixel_snap_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, pixel_snap_mode_items); + RNA_def_property_ui_text(prop, "Snap to Pixels", "Snap UVs to pixels while editing"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL); prop = RNA_def_property(srna, "lock_bounds", PROP_BOOLEAN, PROP_NONE); |