[Bf-blender-cvs] [416e006a2ae] master: Cleanup: use 'use_' prefix for RNA booleans

Campbell Barton noreply at git.blender.org
Mon Jul 5 14:13:35 CEST 2021


Commit: 416e006a2aee09a6354fad9aec6a3f44f9f758b8
Author: Campbell Barton
Date:   Mon Jul 5 21:41:02 2021 +1000
Branches: master
https://developer.blender.org/rB416e006a2aee09a6354fad9aec6a3f44f9f758b8

Cleanup: use 'use_' prefix for RNA booleans

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

M	release/scripts/startup/bl_ui/space_image.py
M	source/blender/editors/space_image/image_ops.c
M	source/blender/makesrna/intern/rna_shader_fx.c
M	source/blender/shader_fx/intern/FX_shader_flip.c

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

diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py
index 3fafa328289..31a4aa5da48 100644
--- a/release/scripts/startup/bl_ui/space_image.py
+++ b/release/scripts/startup/bl_ui/space_image.py
@@ -257,8 +257,8 @@ class IMAGE_MT_image_flip(Menu):
 
     def draw(self, _context):
         layout = self.layout
-        layout.operator("image.flip", text="Horizontally").use_flip_horizontal = True
-        layout.operator("image.flip", text="Vertically").use_flip_vertical = True
+        layout.operator("image.flip", text="Horizontally").use_flip_x = True
+        layout.operator("image.flip", text="Vertically").use_flip_y = True
 
 class IMAGE_MT_image_invert(Menu):
     bl_label = "Invert"
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 193c35d10a2..b4e1f1ec9fc 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -2712,10 +2712,10 @@ static int image_flip_exec(bContext *C, wmOperator *op)
     return OPERATOR_CANCELLED;
   }
 
-  const bool flip_horizontal = RNA_boolean_get(op->ptr, "use_flip_horizontal");
-  const bool flip_vertical = RNA_boolean_get(op->ptr, "use_flip_vertical");
+  const bool use_flip_x = RNA_boolean_get(op->ptr, "use_flip_x");
+  const bool use_flip_y = RNA_boolean_get(op->ptr, "use_flip_y");
 
-  if (!flip_horizontal && !flip_vertical) {
+  if (!use_flip_x && !use_flip_y) {
     BKE_image_release_ibuf(ima, ibuf, NULL);
     return OPERATOR_FINISHED;
   }
@@ -2735,8 +2735,8 @@ static int image_flip_exec(bContext *C, wmOperator *op)
     float *orig_float_pixels = MEM_dupallocN(float_pixels);
     for (int x = 0; x < size_x; x++) {
       for (int y = 0; y < size_y; y++) {
-        const int source_pixel_x = flip_horizontal ? size_x - x - 1 : x;
-        const int source_pixel_y = flip_vertical ? size_y - y - 1 : y;
+        const int source_pixel_x = use_flip_x ? size_x - x - 1 : x;
+        const int source_pixel_y = use_flip_y ? size_y - y - 1 : y;
 
         float *source_pixel = &orig_float_pixels[4 * (source_pixel_x + source_pixel_y * size_x)];
         float *target_pixel = &float_pixels[4 * (x + y * size_x)];
@@ -2755,8 +2755,8 @@ static int image_flip_exec(bContext *C, wmOperator *op)
     char *orig_char_pixels = MEM_dupallocN(char_pixels);
     for (int x = 0; x < size_x; x++) {
       for (int y = 0; y < size_y; y++) {
-        const int source_pixel_x = flip_horizontal ? size_x - x - 1 : x;
-        const int source_pixel_y = flip_vertical ? size_y - y - 1 : y;
+        const int source_pixel_x = use_flip_x ? size_x - x - 1 : x;
+        const int source_pixel_y = use_flip_y ? size_y - y - 1 : y;
 
         char *source_pixel = &orig_char_pixels[4 * (source_pixel_x + source_pixel_y * size_x)];
         char *target_pixel = &char_pixels[4 * (x + y * size_x)];
@@ -2804,10 +2804,9 @@ void IMAGE_OT_flip(wmOperatorType *ot)
   /* properties */
   PropertyRNA *prop;
   prop = RNA_def_boolean(
-      ot->srna, "use_flip_horizontal", false, "Horizontal", "Flip the image horizontally");
+      ot->srna, "use_flip_x", false, "Horizontal", "Flip the image horizontally");
   RNA_def_property_flag(prop, PROP_SKIP_SAVE);
-  prop = RNA_def_boolean(
-      ot->srna, "use_flip_vertical", false, "Vertical", "Flip the image vertically");
+  prop = RNA_def_boolean(ot->srna, "use_flip_y", false, "Vertical", "Flip the image vertically");
   RNA_def_property_flag(prop, PROP_SKIP_SAVE);
 
   /* flags */
diff --git a/source/blender/makesrna/intern/rna_shader_fx.c b/source/blender/makesrna/intern/rna_shader_fx.c
index 4a6cb0d740a..7c5212073ab 100644
--- a/source/blender/makesrna/intern/rna_shader_fx.c
+++ b/source/blender/makesrna/intern/rna_shader_fx.c
@@ -649,12 +649,12 @@ static void rna_def_shader_fx_flip(BlenderRNA *brna)
 
   RNA_define_lib_overridable(true);
 
-  prop = RNA_def_property(srna, "flip_horizontal", PROP_BOOLEAN, PROP_NONE);
+  prop = RNA_def_property(srna, "use_flip_x", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "flag", FX_FLIP_HORIZONTAL);
   RNA_def_property_ui_text(prop, "Horizontal", "Flip image horizontally");
   RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update");
 
-  prop = RNA_def_property(srna, "flip_vertical", PROP_BOOLEAN, PROP_NONE);
+  prop = RNA_def_property(srna, "use_flip_y", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "flag", FX_FLIP_VERTICAL);
   RNA_def_property_ui_text(prop, "Vertical", "Flip image vertically");
   RNA_def_property_update(prop, NC_OBJECT | ND_SHADERFX, "rna_ShaderFx_update");
diff --git a/source/blender/shader_fx/intern/FX_shader_flip.c b/source/blender/shader_fx/intern/FX_shader_flip.c
index b6a36378f7e..048ff3deba1 100644
--- a/source/blender/shader_fx/intern/FX_shader_flip.c
+++ b/source/blender/shader_fx/intern/FX_shader_flip.c
@@ -65,8 +65,8 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel)
   uiLayoutSetPropSep(layout, true);
 
   row = uiLayoutRowWithHeading(layout, true, IFACE_("Axis"));
-  uiItemR(row, ptr, "flip_horizontal", toggles_flag, NULL, ICON_NONE);
-  uiItemR(row, ptr, "flip_vertical", toggles_flag, NULL, ICON_NONE);
+  uiItemR(row, ptr, "use_flip_x", toggles_flag, NULL, ICON_NONE);
+  uiItemR(row, ptr, "use_flip_y", toggles_flag, NULL, ICON_NONE);
 
   shaderfx_panel_end(layout, ptr);
 }



More information about the Bf-blender-cvs mailing list