[Bf-blender-cvs] [2e7dee3fb9f] greasepencil-object: GPencil: Add "Self Overlap" parameter to materials to disable Stencil

Antonioya noreply at git.blender.org
Tue Jul 9 23:11:49 CEST 2019


Commit: 2e7dee3fb9ffd5e6fb38889a3669ed0d66d112e8
Author: Antonioya
Date:   Tue Jul 9 23:11:36 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB2e7dee3fb9ffd5e6fb38889a3669ed0d66d112e8

GPencil: Add "Self Overlap" parameter to materials to disable Stencil

This parameter was removed in 2.80 and we decided to back again, but now is inverted.

===================================================================

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

===================================================================

diff --git a/release/scripts/startup/bl_ui/properties_material_gpencil.py b/release/scripts/startup/bl_ui/properties_material_gpencil.py
index 29a89c7b4a3..2898213d760 100644
--- a/release/scripts/startup/bl_ui/properties_material_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_material_gpencil.py
@@ -144,6 +144,7 @@ class MATERIAL_PT_gpencil_strokecolor(GPMaterialButtonsPanel, Panel):
                 col.template_ID(gpcolor, "stroke_image", open="image.open")
                 if gpcolor.mode == 'LINE':
                     col.prop(gpcolor, "pixel_size", text="UV Factor")
+                    col.prop(gpcolor, "use_overlap_strokes")
 
                 col.prop(gpcolor, "use_stroke_pattern", text="Use As Stencil Mask")
                 if gpcolor.use_stroke_pattern is False:
@@ -161,6 +162,8 @@ class MATERIAL_PT_gpencil_strokecolor(GPMaterialButtonsPanel, Panel):
             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"
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index 4b533fd94ef..103ade8e85a 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -1396,7 +1396,8 @@ void gpencil_triangulate_stroke_fill(Object *ob, bGPDstroke *gps)
 /* 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 */
diff --git a/source/blender/makesdna/DNA_material_types.h b/source/blender/makesdna/DNA_material_types.h
index 42308f54d7a..152ecb85991 100644
--- a/source/blender/makesdna/DNA_material_types.h
+++ b/source/blender/makesdna/DNA_material_types.h
@@ -128,6 +128,8 @@ typedef enum eMaterialGPencilStyle_Flag {
   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 {
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index 28989d1dd5f..57ec4c4c87c 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -618,8 +618,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");
+
   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");



More information about the Bf-blender-cvs mailing list