[Bf-blender-cvs] [88395ad654f] eevee-gpencil: EEVEE: Add a parameter to disable shadows by material
Antonio Vazquez
noreply at git.blender.org
Thu Mar 18 17:19:00 CET 2021
Commit: 88395ad654f1663f41cd0671121d3e71524a119c
Author: Antonio Vazquez
Date: Thu Mar 18 17:18:53 2021 +0100
Branches: eevee-gpencil
https://developer.blender.org/rB88395ad654f1663f41cd0671121d3e71524a119c
EEVEE: Add a parameter to disable shadows by material
The new option is in the Options panels, but it can be moved in the future.
===================================================================
M release/scripts/startup/bl_ui/properties_material_gpencil.py
M source/blender/draw/engines/eevee/eevee_materials.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 7c8f6b2309a..ebc36c7654a 100644
--- a/release/scripts/startup/bl_ui/properties_material_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_material_gpencil.py
@@ -255,7 +255,11 @@ class MATERIAL_PT_gpencil_options(GPMaterialButtonsPanel, Panel):
ma = context.material
gpcolor = ma.grease_pencil
- layout.prop(gpcolor, "pass_index")
+ row = layout.row()
+ row.prop(gpcolor, "show_shadows")
+ row = layout.row()
+ row.prop(gpcolor, "pass_index")
+
class MATERIAL_PT_gpencil_material_presets(PresetPanel, Panel):
diff --git a/source/blender/draw/engines/eevee/eevee_materials.c b/source/blender/draw/engines/eevee/eevee_materials.c
index 0cfec812913..ed4d0b48741 100644
--- a/source/blender/draw/engines/eevee/eevee_materials.c
+++ b/source/blender/draw/engines/eevee/eevee_materials.c
@@ -980,12 +980,13 @@ static void eevee_gpencil_stroke_cache_populate(bGPDlayer *UNUSED(gpl),
MaterialGPencilStyle *gp_style = BKE_gpencil_material_settings(iter->ob, gps->mat_nr + 1);
- bool hide_material = (gp_style->flag & GP_MATERIAL_HIDE) != 0;
- bool show_stroke = (gp_style->flag & GP_MATERIAL_STROKE_SHOW) != 0;
+ const bool show_shadows = (gp_style->flag & GP_MATERIAL_SHOW_SHADOWS) != 0;
+ const bool hide_material = (gp_style->flag & GP_MATERIAL_HIDE) != 0;
+ const bool show_stroke = (gp_style->flag & GP_MATERIAL_STROKE_SHOW) != 0;
// TODO: What about simplify Fill?
- bool show_fill = (gps->tot_triangles > 0) && (gp_style->flag & GP_MATERIAL_FILL_SHOW) != 0;
+ const bool show_fill = (gps->tot_triangles > 0) && (gp_style->flag & GP_MATERIAL_FILL_SHOW) != 0;
- if (hide_material) {
+ if ((hide_material) || (!show_shadows)) {
return;
}
diff --git a/source/blender/makesdna/DNA_material_types.h b/source/blender/makesdna/DNA_material_types.h
index 884c2df6480..c0b5936709c 100644
--- a/source/blender/makesdna/DNA_material_types.h
+++ b/source/blender/makesdna/DNA_material_types.h
@@ -137,6 +137,8 @@ typedef enum eMaterialGPencilStyle_Flag {
GP_MATERIAL_IS_STROKE_HOLDOUT = (1 << 13),
/* Material used as fill masking. */
GP_MATERIAL_IS_FILL_HOLDOUT = (1 << 14),
+ /* Show Eevee shadows */
+ GP_MATERIAL_SHOW_SHADOWS = (1 << 15),
} 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 84c831a178e..bc4f5f6ab1c 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -588,6 +588,11 @@ static void rna_def_material_greasepencil(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Show Fill", "Show stroke fills of this material");
RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
+ prop = RNA_def_property(srna, "show_shadows", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_MATERIAL_SHOW_SHADOWS);
+ RNA_def_property_ui_text(prop, "Show Shadows", "Show shadows produced by grease pencil object");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
+
/* Mode to align Dots and Boxes to drawing path and object rotation */
prop = RNA_def_property(srna, "alignment_mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_bitflag_sdna(prop, NULL, "alignment_mode");
More information about the Bf-blender-cvs
mailing list