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
This commit is contained in:
Chris Blackbourn 2022-09-22 13:16:34 +12:00
parent 3185c3bc74
commit c50335b359
4 changed files with 19 additions and 0 deletions

View File

@ -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

View File

@ -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);

View File

@ -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 {

View File

@ -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);