GPencil: Add "Self Overlap" parameter to materials to disable Stencil
authorAntonioya <blendergit@gmail.com>
Fri, 9 Aug 2019 09:04:14 +0000 (11:04 +0200)
committerAntonio Vazquez <blendergit@gmail.com>
Fri, 9 Aug 2019 09:37:02 +0000 (11:37 +0200)
This parameter was removed in 2.80 and we decided to back again, but now is inverted.

release/scripts/startup/bl_ui/properties_material_gpencil.py
source/blender/draw/engines/gpencil/gpencil_draw_utils.c
source/blender/makesdna/DNA_material_types.h
source/blender/makesrna/intern/rna_material.c

index 8db0f8182abf36973268a7df8b31a526fb611496..a9e68ecc502b154c62f31070ef82c80004284617 100644 (file)
@@ -162,6 +162,8 @@ class MATERIAL_PT_gpencil_strokecolor(GPMaterialButtonsPanel, Panel):
             if gpcolor.mode in {'DOTS', 'BOX'}:
                 col.prop(gpcolor, "alignment_mode")
 
             if gpcolor.mode in {'DOTS', 'BOX'}:
                 col.prop(gpcolor, "alignment_mode")
 
+            if gpcolor.mode == 'LINE':
+                col.prop(gpcolor, "use_overlap_strokes")
 
 class MATERIAL_PT_gpencil_fillcolor(GPMaterialButtonsPanel, Panel):
     bl_label = "Fill"
 
 class MATERIAL_PT_gpencil_fillcolor(GPMaterialButtonsPanel, Panel):
     bl_label = "Fill"
index 9b75521794676f10dffd83c29ced13c973585b0d..2892d0dbbaa5219d9f0b675e00f82a9e0e0faa8e 100644 (file)
@@ -1456,7 +1456,8 @@ void gpencil_triangulate_stroke_fill(Object *ob, bGPDstroke *gps)
 /* Check if stencil is required */
 static bool gpencil_is_stencil_required(MaterialGPencilStyle *gp_style)
 {
 /* Check if stencil is required */
 static bool gpencil_is_stencil_required(MaterialGPencilStyle *gp_style)
 {
-  return (bool)(gp_style->stroke_style == GP_STYLE_STROKE_STYLE_SOLID);
+  return (bool)((gp_style->stroke_style == GP_STYLE_STROKE_STYLE_SOLID) &&
+                ((gp_style->flag & GP_STYLE_DISABLE_STENCIL) == 0));
 }
 
 /* draw stroke in drawing buffer */
 }
 
 /* draw stroke in drawing buffer */
index 42308f54d7ae8ad7c4d1a88c4c8bc4f37ce331b4..152ecb85991c1ca7786b3e0f6dc5e761361441d1 100644 (file)
@@ -128,6 +128,8 @@ typedef enum eMaterialGPencilStyle_Flag {
   GP_STYLE_FILL_SHOW = (1 << 9),
   /* mix stroke texture */
   GP_STYLE_STROKE_TEX_MIX = (1 << 11),
   GP_STYLE_FILL_SHOW = (1 << 9),
   /* mix stroke texture */
   GP_STYLE_STROKE_TEX_MIX = (1 << 11),
+  /* disable stencil clipping (overlap) */
+  GP_STYLE_DISABLE_STENCIL = (1 << 12),
 } eMaterialGPencilStyle_Flag;
 
 typedef enum eMaterialGPencilStyle_Mode {
 } eMaterialGPencilStyle_Flag;
 
 typedef enum eMaterialGPencilStyle_Mode {
index 162ba6be834e868ac0cb982ef1bce69954c60cc6..04fe53821e47c18059e806788bcb75a187f2a80f 100644 (file)
@@ -610,8 +610,14 @@ static void rna_def_material_greasepencil(BlenderRNA *brna)
   prop = RNA_def_property(srna, "use_fill_pattern", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_STYLE_FILL_PATTERN);
   RNA_def_property_ui_text(prop, "Pattern", "Use Fill Texture as a pattern to apply color");
   prop = RNA_def_property(srna, "use_fill_pattern", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_STYLE_FILL_PATTERN);
   RNA_def_property_ui_text(prop, "Pattern", "Use Fill Texture as a pattern to apply color");
+
   RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
   RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
+  prop = RNA_def_property(srna, "use_overlap_strokes", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_STYLE_DISABLE_STENCIL);
+  RNA_def_property_ui_text(
+      prop, "Self Overlap", "Disable stencil and overlap self intersections with alpha materials");
 
 
+  RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
   prop = RNA_def_property(srna, "show_stroke", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_STYLE_STROKE_SHOW);
   RNA_def_property_ui_text(prop, "Show Stroke", "Show stroke lines of this material");
   prop = RNA_def_property(srna, "show_stroke", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_STYLE_STROKE_SHOW);
   RNA_def_property_ui_text(prop, "Show Stroke", "Show stroke lines of this material");