[Bf-blender-cvs] [b5115ed80f1] master: UV: rename "Pixel Snap Mode" to "Pixel Round Mode"

Chris Blackbourn noreply at git.blender.org
Thu Sep 15 00:48:27 CEST 2022


Commit: b5115ed80f197af3f0298f3c2a1e5d177804f9c4
Author: Chris Blackbourn
Date:   Tue Sep 13 16:43:06 2022 +1200
Branches: master
https://developer.blender.org/rBb5115ed80f197af3f0298f3c2a1e5d177804f9c4

UV: rename "Pixel Snap Mode" to "Pixel Round Mode"

Maniphest Tasks: T78391

Differential Revision: https://developer.blender.org/D15952

===================================================================

M	release/scripts/startup/bl_ui/space_image.py
M	source/blender/editors/transform/transform_convert_mesh_uv.c
M	source/blender/makesdna/DNA_space_types.h
M	source/blender/makesdna/intern/dna_rename_defs.h
M	source/blender/makesrna/intern/rna_space.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py
index 0b26f0b1203..da752b5fe00 100644
--- a/release/scripts/startup/bl_ui/space_image.py
+++ b/release/scripts/startup/bl_ui/space_image.py
@@ -402,7 +402,7 @@ class IMAGE_MT_uvs(Menu):
         layout.menu("IMAGE_MT_uvs_mirror")
         layout.menu("IMAGE_MT_uvs_snap")
 
-        layout.prop_menu_enum(uv, "pixel_snap_mode")
+        layout.prop_menu_enum(uv, "pixel_round_mode")
         layout.prop(uv, "lock_bounds")
 
         layout.separator()
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);



More information about the Bf-blender-cvs mailing list