diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2020-05-13 18:07:32 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2020-05-13 23:44:04 +0300 |
commit | fd025b0b7a46c5e56f348b73cf989c6bbddec707 (patch) | |
tree | c6a03da09765292b02a7eec062c9f9092a936546 | |
parent | 16cc424bc53f22d4158fb2ed109b14943f340d7b (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.py | 3 | ||||
-rw-r--r-- | source/blender/draw/engines/overlay/overlay_gpencil.c | 5 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_view3d_types.h | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 5 |
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 fca4cb4c321..643776fc612 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -6733,9 +6733,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 21def800e4a..11c3c1c4d1b 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 d4d35e07c2a..326dd88dc59 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -3852,6 +3852,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, |