Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/BKE_blender_version.h2
-rw-r--r--source/blender/blenloader/intern/versioning_300.c38
-rw-r--r--source/blender/draw/engines/overlay/overlay_grid.c25
-rw-r--r--source/blender/editors/space_image/space_image.c2
-rw-r--r--source/blender/makesdna/DNA_space_types.h1
-rw-r--r--source/blender/makesrna/intern/rna_space.c7
6 files changed, 51 insertions, 24 deletions
diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h
index 34f3b9afacd..8a2693f3f6b 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -25,7 +25,7 @@ extern "C" {
/* Blender file format version. */
#define BLENDER_FILE_VERSION BLENDER_VERSION
-#define BLENDER_FILE_SUBVERSION 11
+#define BLENDER_FILE_SUBVERSION 12
/* Minimum Blender version that supports reading file written with the current
* version. Older Blender versions will test this and show a warning if the file
diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c
index dd3412d6c83..95851c0e9ff 100644
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@ -2567,9 +2567,7 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
}
- }
- if (!MAIN_VERSION_ATLEAST(bmain, 302, 10)) {
/* While vertex-colors were experimental the smear tool became corrupt due
* to bugs in the wm_toolsystem API (auto-creation of sculpt brushes
* was broken). Go through and reset all smear brushes. */
@@ -2637,17 +2635,18 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
- /**
- * Versioning code until next subversion bump goes here.
- *
- * \note Be sure to check when bumping the version:
- * - "versioning_userdef.c", #blo_do_versions_userdef
- * - "versioning_userdef.c", #do_versions_theme
- *
- * \note Keep this message at the bottom of the function.
- */
- {
- /* Keep this block, even when empty. */
+ if (!MAIN_VERSION_ATLEAST(bmain, 302, 12)) {
+ /* UV/Image show background grid option. */
+ LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
+ LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
+ LISTBASE_FOREACH (SpaceLink *, space, &area->spacedata) {
+ if (space->spacetype == SPACE_IMAGE) {
+ SpaceImage *sima = (SpaceImage *)space;
+ sima->overlay.flag |= SI_OVERLAY_SHOW_GRID_BACKGROUND;
+ }
+ }
+ }
+ }
/* Add node storage for the merge by distance node. */
FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
@@ -2666,4 +2665,17 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
FOREACH_NODETREE_END;
}
+
+ /**
+ * Versioning code until next subversion bump goes here.
+ *
+ * \note Be sure to check when bumping the version:
+ * - "versioning_userdef.c", #blo_do_versions_userdef
+ * - "versioning_userdef.c", #do_versions_theme
+ *
+ * \note Keep this message at the bottom of the function.
+ */
+ {
+ /* Keep this block, even when empty. */
+ }
}
diff --git a/source/blender/draw/engines/overlay/overlay_grid.c b/source/blender/draw/engines/overlay/overlay_grid.c
index 20403f156a1..ed6db459696 100644
--- a/source/blender/draw/engines/overlay/overlay_grid.c
+++ b/source/blender/draw/engines/overlay/overlay_grid.c
@@ -49,20 +49,29 @@ void OVERLAY_grid_init(OVERLAY_Data *vedata)
if (pd->space_type == SPACE_IMAGE) {
SpaceImage *sima = (SpaceImage *)draw_ctx->space_data;
View2D *v2d = &draw_ctx->region->v2d;
- if (sima->mode == SI_MODE_UV || !ED_space_image_has_buffer(sima)) {
- shd->grid_flag = GRID_BACK | PLANE_IMAGE | SHOW_GRID;
- }
- else {
- shd->grid_flag = 0;
+
+ /* Only UV Edit mode has the various Overlay options for now. */
+ const bool is_uv_edit = sima->mode == SI_MODE_UV;
+
+ const bool background_enabled = is_uv_edit ? (!pd->hide_overlays &&
+ (sima->overlay.flag &
+ SI_OVERLAY_SHOW_GRID_BACKGROUND) != 0) :
+ true;
+ if (background_enabled) {
+ shd->grid_flag = GRID_BACK | PLANE_IMAGE;
}
- if (sima->flag & SI_CUSTOM_GRID) {
- shd->grid_flag |= CUSTOM_GRID;
+ const bool draw_grid = is_uv_edit || !ED_space_image_has_buffer(sima);
+ if (background_enabled && draw_grid) {
+ shd->grid_flag |= SHOW_GRID;
+ if (is_uv_edit && (sima->flag & SI_CUSTOM_GRID) != 0) {
+ shd->grid_flag |= CUSTOM_GRID;
+ }
}
shd->grid_distance = 1.0f;
copy_v3_fl3(shd->grid_size, 1.0f, 1.0f, 1.0f);
- if (sima->mode == SI_MODE_UV) {
+ if (is_uv_edit) {
shd->grid_size[0] = (float)sima->tile_grid_shape[0];
shd->grid_size[1] = (float)sima->tile_grid_shape[1];
}
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index 03ec018fbe8..bc047a00ae1 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -100,7 +100,7 @@ static SpaceLink *image_create(const ScrArea *UNUSED(area), const Scene *UNUSED(
simage->lock = true;
simage->flag = SI_SHOW_GPENCIL | SI_USE_ALPHA | SI_COORDFLOATS;
simage->uv_opacity = 1.0f;
- simage->overlay.flag = SI_OVERLAY_SHOW_OVERLAYS;
+ simage->overlay.flag = SI_OVERLAY_SHOW_OVERLAYS | SI_OVERLAY_SHOW_GRID_BACKGROUND;
BKE_imageuser_default(&simage->iuser);
simage->iuser.flag = IMA_SHOW_STEREO | IMA_ANIM_ALWAYS | IMA_SHOW_MAX_RESOLUTION;
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index 806c989100d..bcf54ee47a0 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -1318,6 +1318,7 @@ typedef enum eSpaceImage_Flag {
typedef enum eSpaceImageOverlay_Flag {
SI_OVERLAY_SHOW_OVERLAYS = (1 << 0),
+ SI_OVERLAY_SHOW_GRID_BACKGROUND = (1 << 1),
} eSpaceImageOverlay_Flag;
/** Keep in sync with `STEPS_LEN` in `grid_frag.glsl`. */
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index a74019f9569..d2b8eb203aa 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -3497,7 +3497,7 @@ static void rna_def_space_image_uv(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Display Faces", "Display faces over the image");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
- prop = RNA_def_property(srna, "tile_grid_shape", PROP_INT, PROP_NONE);
+ prop = RNA_def_property(srna, "tile_grid_shape", PROP_INT, PROP_XYZ);
RNA_def_property_int_sdna(prop, NULL, "tile_grid_shape");
RNA_def_property_array(prop, 2);
RNA_def_property_int_default(prop, 1);
@@ -5264,6 +5264,11 @@ static void rna_def_space_image_overlay(BlenderRNA *brna)
prop = RNA_def_property(srna, "show_overlays", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "overlay.flag", SI_OVERLAY_SHOW_OVERLAYS);
RNA_def_property_ui_text(prop, "Show Overlays", "Display overlays like UV Maps and Metadata");
+
+ prop = RNA_def_property(srna, "show_grid_background", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "overlay.flag", SI_OVERLAY_SHOW_GRID_BACKGROUND);
+ RNA_def_property_ui_text(prop, "Display Background", "Show the grid background and borders");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
}
static void rna_def_space_image(BlenderRNA *brna)