[Bf-blender-cvs] [c50335b359e] master: UV: add toggle to show the grid over the image

Chris Blackbourn noreply at git.blender.org
Thu Sep 22 07:21:20 CEST 2022


Commit: c50335b359e06751cba81e3d33a4ee0ae71daffb
Author: Chris Blackbourn
Date:   Thu Sep 22 13:16:34 2022 +1200
Branches: master
https://developer.blender.org/rBc50335b359e06751cba81e3d33a4ee0ae71daffb

UV: add toggle to show the grid over the image

In UV editor, previously unable to see grid and image at same time.

Maniphest Tasks: T78391

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

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

M	release/scripts/startup/bl_ui/space_image.py
M	source/blender/draw/engines/overlay/overlay_grid.cc
M	source/blender/makesdna/DNA_space_types.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 b624d024843..89d025814f2 100644
--- a/release/scripts/startup/bl_ui/space_image.py
+++ b/release/scripts/startup/bl_ui/space_image.py
@@ -1531,6 +1531,14 @@ class IMAGE_PT_overlay_guides(Panel):
 
         if overlay.show_grid_background:
             layout.use_property_split = True
+
+            col = layout.column(align=False, heading="Grid Over Image")
+            col.use_property_decorate = False
+            row = col.row(align=True)
+            sub = row.row(align=True)
+            sub.prop(uvedit, "show_grid_over_image", text="")
+            sub.active = context.space_data.image is not None
+
             col = layout.column(align=False, heading="Fixed Subdivisions")
             col.use_property_decorate = False
 
diff --git a/source/blender/draw/engines/overlay/overlay_grid.cc b/source/blender/draw/engines/overlay/overlay_grid.cc
index 4a4d9ee6c19..89fc6ec2eb7 100644
--- a/source/blender/draw/engines/overlay/overlay_grid.cc
+++ b/source/blender/draw/engines/overlay/overlay_grid.cc
@@ -51,6 +51,9 @@ void OVERLAY_grid_init(OVERLAY_Data *vedata)
                                                  true;
     if (background_enabled) {
       grid_flag = GRID_BACK | PLANE_IMAGE;
+      if (sima->flag & SI_GRID_OVER_IMAGE) {
+        grid_flag = PLANE_IMAGE;
+      }
     }
 
     const bool draw_grid = is_uv_edit || !ED_space_image_has_buffer(sima);
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index 6bb8dc6aa18..5a819ead4ec 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -1319,6 +1319,8 @@ typedef enum eSpaceImage_Flag {
   SI_SHOW_R = (1 << 27),
   SI_SHOW_G = (1 << 28),
   SI_SHOW_B = (1 << 29),
+
+  SI_GRID_OVER_IMAGE = (1 << 30),
 } eSpaceImage_Flag;
 
 typedef enum eSpaceImageOverlay_Flag {
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 18f686b8946..9bbe37b5187 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -3614,6 +3614,12 @@ static void rna_def_space_image_uv(BlenderRNA *brna)
       prop, "Tile Grid Shape", "How many tiles will be shown in the background");
   RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
 
+  prop = RNA_def_property(srna, "show_grid_over_image", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_GRID_OVER_IMAGE);
+  RNA_def_property_boolean_default(prop, true);
+  RNA_def_property_ui_text(prop, "Grid Over Image", "Show the grid over the image");
+  RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
+
   prop = RNA_def_property(srna, "use_custom_grid", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_CUSTOM_GRID);
   RNA_def_property_boolean_default(prop, true);



More information about the Bf-blender-cvs mailing list