[Bf-blender-cvs] [6d88f8eaade] greasepencil-object: GPencil: Remove parameter and use Stencil for lines solid only

Antonioya noreply at git.blender.org
Sat Jun 22 17:56:10 CEST 2019


Commit: 6d88f8eaadef29971e6931e5b117032a94955d1c
Author: Antonioya
Date:   Tue Jun 18 20:44:40 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB6d88f8eaadef29971e6931e5b117032a94955d1c

GPencil: Remove parameter and use Stencil for lines solid only

Also removed the parameter from UI

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

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 2215fa40c27..7cd68f34e9e 100644
--- a/release/scripts/startup/bl_ui/properties_material_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_material_gpencil.py
@@ -144,7 +144,6 @@ 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_stencil_clipping")
 
                 col.prop(gpcolor, "use_stroke_pattern", text="Use As Pattern")
                 if gpcolor.use_stroke_pattern is False:
@@ -161,8 +160,6 @@ 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_stencil_clipping")
 
 
 class MATERIAL_PT_gpencil_fillcolor(GPMaterialButtonsPanel, Panel):
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index bf82623cd54..89fe479c7d9 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -1458,6 +1458,12 @@ void DRW_gpencil_triangulate_stroke_fill(Object *ob, bGPDstroke *gps)
   MEM_SAFE_FREE(uv);
 }
 
+/* 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);
+}
+
 /* draw stroke in drawing buffer */
 void DRW_gpencil_populate_buffer_strokes(GPENCIL_e_data *e_data,
                                          void *vedata,
@@ -1522,7 +1528,7 @@ void DRW_gpencil_populate_buffer_strokes(GPENCIL_e_data *e_data,
               1.0f,
               (const int *)stl->storage->shade_render);
 
-          if (gp_style->flag & GP_STYLE_DISABLE_STENCIL) {
+          if (!gpencil_is_stencil_required(gp_style)) {
             /* Disable stencil for this type */
             DRW_shgroup_state_disable(stl->g_data->shgrps_drawing_stroke,
                                       DRW_STATE_WRITE_STENCIL | DRW_STATE_STENCIL_NEQUAL);
@@ -1753,16 +1759,16 @@ static void DRW_gpencil_shgroups_create(GPENCIL_e_data *e_data,
         start_stroke = elm->vertex_idx;
 
         /* set stencil mask id */
-        if (gp_style->flag & GP_STYLE_DISABLE_STENCIL) {
+        if (gpencil_is_stencil_required(gp_style)) {
+          DRW_shgroup_stencil_mask(shgrp, stencil_id);
+          stencil_id++;
+        }
+        else {
           /* Disable stencil for this type */
           DRW_shgroup_state_disable(shgrp, DRW_STATE_WRITE_STENCIL | DRW_STATE_STENCIL_NEQUAL);
           /* set stencil mask id as not used */
           DRW_shgroup_stencil_mask(shgrp, 0x00f);
         }
-        else {
-          DRW_shgroup_stencil_mask(shgrp, stencil_id);
-          stencil_id++;
-        }
         break;
       }
       case eGpencilBatchGroupType_Point: {
diff --git a/source/blender/makesdna/DNA_material_types.h b/source/blender/makesdna/DNA_material_types.h
index 480e7cd397f..d65a4896758 100644
--- a/source/blender/makesdna/DNA_material_types.h
+++ b/source/blender/makesdna/DNA_material_types.h
@@ -128,8 +128,6 @@ typedef enum eMaterialGPencilStyle_Flag {
   GP_STYLE_FILL_SHOW = (1 << 9),
   /* mix stroke texture */
   GP_STYLE_STROKE_TEX_MIX = (1 << 11),
-  /* disable stencil clipping */
-  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 bc8d040587d..3ff2e884d92 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -620,12 +620,6 @@ static void rna_def_material_greasepencil(BlenderRNA *brna)
   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_stencil_clipping", PROP_BOOLEAN, PROP_NONE);
-  RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GP_STYLE_DISABLE_STENCIL);
-  RNA_def_property_ui_text(
-      prop, "Stencil", "Use Stencil Clipping for avoiding glitches 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