diff options
author | Chris Blackbourn <chrisbblend@gmail.com> | 2022-09-13 07:43:06 +0300 |
---|---|---|
committer | Chris Blackbourn <chrisbblend@gmail.com> | 2022-09-15 01:36:13 +0300 |
commit | b5115ed80f197af3f0298f3c2a1e5d177804f9c4 (patch) | |
tree | 1d5273ba3bcae217f455001faea54e1204170bfa /source | |
parent | 530f203e27a7ea44f68383cc8093e85a03c428a6 (diff) |
UV: rename "Pixel Snap Mode" to "Pixel Round Mode"
Maniphest Tasks: T78391
Differential Revision: https://developer.blender.org/D15952
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/transform/transform_convert_mesh_uv.c | 12 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_space_types.h | 14 | ||||
-rw-r--r-- | source/blender/makesdna/intern/dna_rename_defs.h | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 14 |
4 files changed, 21 insertions, 20 deletions
diff --git a/source/blender/editors/transform/transform_convert_mesh_uv.c b/source/blender/editors/transform/transform_convert_mesh_uv.c index 27f12137e3a..78281e5f8e5 100644 --- a/source/blender/editors/transform/transform_convert_mesh_uv.c +++ b/source/blender/editors/transform/transform_convert_mesh_uv.c @@ -399,7 +399,7 @@ static void createTransUVs(bContext *C, TransInfo *t) static void flushTransUVs(TransInfo *t) { SpaceImage *sima = t->area->spacedata.first; - const bool use_pixel_snap = ((sima->pixel_snap_mode != SI_PIXEL_SNAP_DISABLED) && + const bool use_pixel_round = ((sima->pixel_round_mode != SI_PIXEL_ROUND_DISABLED) && (t->state != TRANS_CANCEL)); FOREACH_TRANS_DATA_CONTAINER (t, tc) { @@ -410,7 +410,7 @@ static void flushTransUVs(TransInfo *t) aspect_inv[0] = 1.0f / t->aspect[0]; aspect_inv[1] = 1.0f / t->aspect[1]; - if (use_pixel_snap) { + if (use_pixel_round) { int size_i[2]; ED_space_image_get_size(sima, &size_i[0], &size_i[1]); size[0] = size_i[0]; @@ -422,16 +422,16 @@ static void flushTransUVs(TransInfo *t) td->loc2d[0] = td->loc[0] * aspect_inv[0]; td->loc2d[1] = td->loc[1] * aspect_inv[1]; - if (use_pixel_snap) { + if (use_pixel_round) { td->loc2d[0] *= size[0]; td->loc2d[1] *= size[1]; - switch (sima->pixel_snap_mode) { - case SI_PIXEL_SNAP_CENTER: + switch (sima->pixel_round_mode) { + case SI_PIXEL_ROUND_CENTER: td->loc2d[0] = roundf(td->loc2d[0] - 0.5f) + 0.5f; td->loc2d[1] = roundf(td->loc2d[1] - 0.5f) + 0.5f; break; - case SI_PIXEL_SNAP_CORNER: + case SI_PIXEL_ROUND_CORNER: td->loc2d[0] = roundf(td->loc2d[0]); td->loc2d[1] = roundf(td->loc2d[1]); break; diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index d13f3fad270..f25201bf5b4 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -1218,7 +1218,7 @@ typedef struct SpaceImage { char pin; - char pixel_snap_mode; + char pixel_round_mode; char lock; /** UV draw type. */ @@ -1260,12 +1260,12 @@ typedef enum eSpaceImage_UVDT_Stretch { SI_UVDT_STRETCH_AREA = 1, } eSpaceImage_UVDT_Stretch; -/** #SpaceImage.pixel_snap_mode */ -typedef enum eSpaceImage_PixelSnapMode { - SI_PIXEL_SNAP_DISABLED = 0, - SI_PIXEL_SNAP_CENTER = 1, - SI_PIXEL_SNAP_CORNER = 2, -} eSpaceImage_Snap_Mode; +/** #SpaceImage.pixel_round_mode */ +typedef enum eSpaceImage_PixelRoundMode { + SI_PIXEL_ROUND_DISABLED = 0, + SI_PIXEL_ROUND_CENTER = 1, + SI_PIXEL_ROUND_CORNER = 2, +} eSpaceImage_Round_Mode; /** #SpaceImage.mode */ typedef enum eSpaceImage_Mode { diff --git a/source/blender/makesdna/intern/dna_rename_defs.h b/source/blender/makesdna/intern/dna_rename_defs.h index 257e60eae98..facf6199dce 100644 --- a/source/blender/makesdna/intern/dna_rename_defs.h +++ b/source/blender/makesdna/intern/dna_rename_defs.h @@ -109,6 +109,7 @@ DNA_STRUCT_RENAME_ELEM(RenderData, bake_filter, bake_margin) DNA_STRUCT_RENAME_ELEM(RigidBodyWorld, steps_per_second, substeps_per_frame) DNA_STRUCT_RENAME_ELEM(SDefBind, numverts, verts_num) DNA_STRUCT_RENAME_ELEM(SDefVert, numbinds, binds_num) +DNA_STRUCT_RENAME_ELEM(SpaceImage, pixel_snap_mode, pixel_round_mode) DNA_STRUCT_RENAME_ELEM(SpaceSeq, overlay_type, overlay_frame_type) DNA_STRUCT_RENAME_ELEM(SurfaceDeformModifierData, num_mesh_verts, mesh_verts_num) DNA_STRUCT_RENAME_ELEM(SurfaceDeformModifierData, numpoly, target_polys_num) diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 01b68cbd134..9efdef7e155 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -3531,10 +3531,10 @@ 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"}, + static const EnumPropertyItem pixel_round_mode_items[] = { + {SI_PIXEL_ROUND_DISABLED, "DISABLED", 0, "Disabled", "Don't round to pixels"}, + {SI_PIXEL_ROUND_CORNER, "CORNER", 0, "Corner", "Round to pixel corners"}, + {SI_PIXEL_ROUND_CENTER, "CENTER", 0, "Center", "Round to pixel centers"}, {0, NULL, 0, NULL, NULL}, }; @@ -3626,9 +3626,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, "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"); + prop = RNA_def_property(srna, "pixel_round_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, pixel_round_mode_items); + RNA_def_property_ui_text(prop, "Round to Pixels", "Round 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); |