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:
authorAntonio Vazquez <blendergit@gmail.com>2020-05-13 18:07:32 +0300
committerAntonio Vazquez <blendergit@gmail.com>2020-05-13 23:49:24 +0300
commitb369d46eb775b32df6c68924703c9a7bb67a2b61 (patch)
tree9f06d6c831b390bb5e6381255e7ca0cb7fd07723
parent891b91928a80ee931453e413c7f397e65e478086 (diff)
GPencil: Add new X-Ray option for Canvas Grid
In some situations is good to have a grid visible anot beeing occulde by meshes. By default is OFF. Differential Revision: https://developer.blender.org/D7721
-rw-r--r--release/scripts/startup/bl_ui/space_view3d.py3
-rw-r--r--source/blender/draw/engines/overlay/overlay_gpencil.c5
-rw-r--r--source/blender/makesdna/DNA_view3d_types.h1
-rw-r--r--source/blender/makesrna/intern/rna_space.c5
4 files changed, 12 insertions, 2 deletions
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index ebc3263f9cc..664c40f2ec7 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -6726,9 +6726,10 @@ class VIEW3D_PT_overlay_gpencil_options(Panel):
col = layout.column()
row = col.row()
row.prop(overlay, "use_gpencil_grid", text="")
- sub = row.row()
+ sub = row.row(align=True)
sub.active = overlay.use_gpencil_grid
sub.prop(overlay, "gpencil_grid_opacity", text="Canvas", slider=True)
+ sub.prop(overlay, "use_gpencil_canvas_xray", text="", icon='XRAY')
row = col.row()
row.prop(overlay, "use_gpencil_fade_layers", text="")
diff --git a/source/blender/draw/engines/overlay/overlay_gpencil.c b/source/blender/draw/engines/overlay/overlay_gpencil.c
index b79d5753686..1397ef7b4b2 100644
--- a/source/blender/draw/engines/overlay/overlay_gpencil.c
+++ b/source/blender/draw/engines/overlay/overlay_gpencil.c
@@ -204,6 +204,7 @@ void OVERLAY_gpencil_cache_init(OVERLAY_Data *vedata)
const bool show_grid = (v3d->gp_flag & V3D_GP_SHOW_GRID) != 0 &&
((ts->gpencil_v3d_align &
(GP_PROJECT_DEPTH_VIEW | GP_PROJECT_DEPTH_STROKE)) == 0);
+ const bool grid_xray = (v3d->gp_flag & V3D_GP_SHOW_GRID_XRAY);
if (show_grid && show_overlays) {
const char *grid_unit = NULL;
@@ -256,7 +257,9 @@ void OVERLAY_gpencil_cache_init(OVERLAY_Data *vedata)
const int gridlines = (gpd->grid.lines <= 0) ? 1 : gpd->grid.lines;
int line_ct = gridlines * 4 + 2;
- DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_BLEND_ALPHA;
+ DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA;
+ state |= (grid_xray) ? DRW_STATE_DEPTH_ALWAYS : DRW_STATE_DEPTH_LESS_EQUAL;
+
DRW_PASS_CREATE(psl->gpencil_canvas_ps, state);
sh = OVERLAY_shader_gpencil_canvas();
diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h
index e486730ebcf..76962281612 100644
--- a/source/blender/makesdna/DNA_view3d_types.h
+++ b/source/blender/makesdna/DNA_view3d_types.h
@@ -450,6 +450,7 @@ enum {
#define V3D_GP_FADE_NOACTIVE_GPENCIL (1 << 6) /* Fade other GPencil objects */
#define V3D_GP_SHOW_STROKE_DIRECTION (1 << 7) /* Show Strokes Directions */
#define V3D_GP_SHOW_MATERIAL_NAME (1 << 8) /* Show Material names */
+#define V3D_GP_SHOW_GRID_XRAY (1 << 9) /* Show Canvas Grid on Top */
/** #View3DShading.flag */
enum {
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 181d4529ef1..8c46dab59dc 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -3905,6 +3905,11 @@ static void rna_def_space_view3d_overlay(BlenderRNA *brna)
prop, "Fade Grease Pencil Objects", "Fade Grease Pencil Objects, except the active one");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPencil_update");
+ prop = RNA_def_property(srna, "use_gpencil_canvas_xray", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gp_flag", V3D_GP_SHOW_GRID_XRAY);
+ RNA_def_property_ui_text(prop, "Canvas X-Ray", "Put Canvas grid on top of any other object");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPencil_update");
+
prop = RNA_def_property(srna, "use_gpencil_show_directions", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "gp_flag", V3D_GP_SHOW_STROKE_DIRECTION);
RNA_def_property_ui_text(prop,