[Bf-blender-cvs] [0245e613f33] greasepencil-object: GPencil: Change Holdout to Solid Stroke only
Antonio Vazquez
noreply at git.blender.org
Mon Sep 14 17:26:03 CEST 2020
Commit: 0245e613f33529ea76a139dfec9c74ef88a25bf9
Author: Antonio Vazquez
Date: Mon Sep 14 16:56:57 2020 +0200
Branches: greasepencil-object
https://developer.blender.org/rB0245e613f33529ea76a139dfec9c74ef88a25bf9
GPencil: Change Holdout to Solid Stroke only
Now the Holdout only supports:
* Solid Strokes. (Textured strokes not supported)
* Solid Fill.
* Texture Fills (Alpha section of the texture).
===================================================================
M release/scripts/startup/bl_ui/properties_material_gpencil.py
M source/blender/draw/engines/gpencil/gpencil_draw_data.c
M source/blender/draw/engines/gpencil/shaders/gpencil_frag.glsl
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_material_gpencil.py b/release/scripts/startup/bl_ui/properties_material_gpencil.py
index a1af447d402..57b5eaa81bf 100644
--- a/release/scripts/startup/bl_ui/properties_material_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_material_gpencil.py
@@ -169,7 +169,8 @@ class MATERIAL_PT_gpencil_strokecolor(GPMaterialButtonsPanel, Panel):
if gpcolor.mode == 'LINE':
col.prop(gpcolor, "use_overlap_strokes")
- col.prop(gpcolor, "use_stroke_holdout")
+ if gpcolor.stroke_style == 'SOLID':
+ col.prop(gpcolor, "use_stroke_holdout")
class MATERIAL_PT_gpencil_fillcolor(GPMaterialButtonsPanel, Panel):
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_data.c b/source/blender/draw/engines/gpencil/gpencil_draw_data.c
index aa12c47e510..00e2768b3db 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_data.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_data.c
@@ -238,7 +238,8 @@ GPENCIL_MaterialPool *gpencil_material_pool_create(GPENCIL_PrivateData *pd, Obje
}
/* Material with masking. */
- if (gp_style->flag & GP_MATERIAL_IS_STROKE_HOLDOUT) {
+ if ((gp_style->stroke_style == GP_MATERIAL_STROKE_STYLE_SOLID) &&
+ (gp_style->flag & GP_MATERIAL_IS_STROKE_HOLDOUT)) {
mat_data->flag |= GP_STROKE_HOLDOUT;
}
if (gp_style->flag & GP_MATERIAL_IS_FILL_HOLDOUT) {
diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_frag.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_frag.glsl
index 6a117b28398..c35ceea803e 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_frag.glsl
@@ -90,15 +90,11 @@ void main()
strokePt1, strokePt2, strokeAspect, strokeThickness, strokeHardeness);
/* Holdout materials. */
- if (GP_FLAG_TEST(matFlag, GP_STROKE_HOLDOUT | GP_FILL_HOLDOUT)) {
- /* If texture, use only the visible area of the texture for holdout. */
- if (GP_FLAG_TEST(matFlag, GP_STROKE_TEXTURE_USE | GP_FILL_TEXTURE_USE)) {
- revealColor = vec4(col.aaa * fragColor.aaa, 1.0);
- }
- else {
- revealColor = vec4(1.0 - fragColor.aaa, 1.0);
- fragColor = vec4(fragColor.rgb, 1.0);
- }
+ if ((!GP_FLAG_TEST(matFlag, GP_STROKE_TEXTURE_USE) &&
+ GP_FLAG_TEST(matFlag, GP_STROKE_HOLDOUT)) ||
+ (GP_FLAG_TEST(matFlag, GP_FILL_HOLDOUT))) {
+ revealColor = vec4(1.0 - fragColor.aaa, 1.0);
+ fragColor = vec4(fragColor.rgb, 1.0);
}
else {
/* NOT holdout materials.
More information about the Bf-blender-cvs
mailing list