[Bf-blender-cvs] [65700fc0644] eevee-gpencil: EEVEE: Add Shadow option as GPencil Layer level
Antonio Vazquez
noreply at git.blender.org
Fri Mar 19 16:20:03 CET 2021
Commit: 65700fc06447a49510677a5d0fcd2679d434b7ac
Author: Antonio Vazquez
Date: Fri Mar 19 16:19:56 2021 +0100
Branches: eevee-gpencil
https://developer.blender.org/rB65700fc06447a49510677a5d0fcd2679d434b7ac
EEVEE: Add Shadow option as GPencil Layer level
Now there are tow options to enable the shadows, at material level and layer level.
Also, renamed `show_shadows` to `use_cast_shadows`
===================================================================
M release/scripts/startup/bl_ui/properties_data_gpencil.py
M release/scripts/startup/bl_ui/properties_material_gpencil.py
M release/scripts/startup/bl_ui/space_dopesheet.py
M release/scripts/startup/bl_ui/space_topbar.py
M source/blender/draw/engines/eevee/eevee_materials.c
M source/blender/makesdna/DNA_gpencil_types.h
M source/blender/makesdna/DNA_material_types.h
M source/blender/makesrna/intern/rna_gpencil.c
M source/blender/makesrna/intern/rna_material.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_data_gpencil.py b/release/scripts/startup/bl_ui/properties_data_gpencil.py
index 69720a6c54b..5691d6d489b 100644
--- a/release/scripts/startup/bl_ui/properties_data_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_data_gpencil.py
@@ -132,7 +132,7 @@ class DATA_PT_gpencil_layers(DataButtonsPanel, Panel):
else:
self.draw_layers(context, layout, gpd)
- def draw_layers(self, _context, layout, gpd):
+ def draw_layers(self, context, layout, gpd):
gpl = gpd.layers.active
@@ -174,16 +174,18 @@ class DATA_PT_gpencil_layers(DataButtonsPanel, Panel):
layout = self.layout
layout.use_property_split = True
layout.use_property_decorate = True
- col = layout.column(align=True)
+ row = layout.row(align=True)
+ row.prop(gpl, "blend_mode", text="Blend")
- col = layout.row(align=True)
- col.prop(gpl, "blend_mode", text="Blend")
+ row = layout.row(align=True)
+ row.prop(gpl, "opacity", text="Opacity", slider=True)
- col = layout.row(align=True)
- col.prop(gpl, "opacity", text="Opacity", slider=True)
+ row = layout.row(align=True)
+ row.prop(gpl, "use_lights")
- col = layout.row(align=True)
- col.prop(gpl, "use_lights")
+ row = layout.row(align=True)
+ row.enabled = context.engine == 'BLENDER_EEVEE'
+ row.prop(gpl, "use_cast_shadows")
class DATA_PT_gpencil_layer_masks(LayerDataButtonsPanel, GreasePencilLayerMasksPanel, Panel):
diff --git a/release/scripts/startup/bl_ui/properties_material_gpencil.py b/release/scripts/startup/bl_ui/properties_material_gpencil.py
index 3b8aafed5ca..a5f52a3b25a 100644
--- a/release/scripts/startup/bl_ui/properties_material_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_material_gpencil.py
@@ -255,8 +255,11 @@ class MATERIAL_PT_gpencil_settings(GPMaterialButtonsPanel, Panel):
ma = context.material
gpcolor = ma.grease_pencil
+
row = layout.row()
- row.prop(gpcolor, "show_shadows")
+ row.enabled = context.engine == 'BLENDER_EEVEE'
+ row.prop(gpcolor, "use_cast_shadows")
+
row = layout.row()
row.prop(gpcolor, "pass_index")
diff --git a/release/scripts/startup/bl_ui/space_dopesheet.py b/release/scripts/startup/bl_ui/space_dopesheet.py
index f7ba9ebcb43..108589e2f45 100644
--- a/release/scripts/startup/bl_ui/space_dopesheet.py
+++ b/release/scripts/startup/bl_ui/space_dopesheet.py
@@ -730,6 +730,10 @@ class DOPESHEET_PT_gpencil_mode(LayersDopeSheetPanel, Panel):
row = layout.row(align=True)
row.prop(gpl, "use_lights")
+ row = layout.row(align=True)
+ row.enabled = context.engine == 'BLENDER_EEVEE'
+ row.prop(gpl, "use_cast_shadows")
+
class DOPESHEET_PT_gpencil_layer_masks(LayersDopeSheetPanel, GreasePencilLayerMasksPanel, Panel):
bl_label = "Masks"
diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py
index 7219922c379..2406c9bef1d 100644
--- a/release/scripts/startup/bl_ui/space_topbar.py
+++ b/release/scripts/startup/bl_ui/space_topbar.py
@@ -171,6 +171,10 @@ class TOPBAR_PT_gpencil_layers(Panel):
srow = col.row(align=True)
srow.prop(gpl, "use_lights")
+ srow = col.row(align=True)
+ srow.enabled = context.engine == 'BLENDER_EEVEE'
+ srow.prop(gpl, "use_cast_shadows")
+
col = row.column()
sub = col.column(align=True)
diff --git a/source/blender/draw/engines/eevee/eevee_materials.c b/source/blender/draw/engines/eevee/eevee_materials.c
index b2a86fe2c9a..f55fddc5ac2 100644
--- a/source/blender/draw/engines/eevee/eevee_materials.c
+++ b/source/blender/draw/engines/eevee/eevee_materials.c
@@ -980,7 +980,7 @@ static void eevee_gpencil_layer_cache_populate(bGPDlayer *gpl,
DRW_shgroup_uniform_vec4_copy(grp, "gpDepthPlane", iter->plane);
}
-static void eevee_gpencil_stroke_cache_populate(bGPDlayer *UNUSED(gpl),
+static void eevee_gpencil_stroke_cache_populate(bGPDlayer *gpl,
bGPDframe *UNUSED(gpf),
bGPDstroke *gps,
void *thunk)
@@ -989,14 +989,15 @@ static void eevee_gpencil_stroke_cache_populate(bGPDlayer *UNUSED(gpl),
MaterialGPencilStyle *gp_style = BKE_gpencil_material_settings(iter->ob, gps->mat_nr + 1);
- const bool show_shadows = (gp_style->flag & GP_MATERIAL_SHOW_SHADOWS) != 0;
+ const bool cast_layer_shadows = (gpl->flag & GP_LAYER_CAST_SHADOWS) != 0;
+ const bool cast_material_shadows = (gp_style->flag & GP_MATERIAL_CAST_SHADOWS) != 0;
const bool simplify_fill = iter->pd->gpencil_simplify_fill;
const bool hide_material = (gp_style->flag & GP_MATERIAL_HIDE) != 0;
const bool show_stroke = (gp_style->flag & GP_MATERIAL_STROKE_SHOW) != 0;
const bool show_fill = (!simplify_fill) && (gps->tot_triangles > 0) &&
(gp_style->flag & GP_MATERIAL_FILL_SHOW) != 0;
- if ((hide_material) || (!show_shadows)) {
+ if ((hide_material) || (!cast_layer_shadows) || (!cast_material_shadows)) {
return;
}
diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h
index 8facdca2f9c..d69984cda17 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -548,6 +548,8 @@ typedef enum eGPDlayer_Flag {
GP_LAYER_FRAMELOCK = (1 << 6),
/* don't render xray (which is default) */
GP_LAYER_NO_XRAY = (1 << 7),
+ /* Show render shadows */
+ GP_LAYER_CAST_SHADOWS = (1 << 8),
/* "volumetric" strokes */
GP_LAYER_VOLUMETRIC = (1 << 10),
/* Use Scene lights */
diff --git a/source/blender/makesdna/DNA_material_types.h b/source/blender/makesdna/DNA_material_types.h
index 2417e2ea4f4..84392cd2029 100644
--- a/source/blender/makesdna/DNA_material_types.h
+++ b/source/blender/makesdna/DNA_material_types.h
@@ -138,7 +138,7 @@ typedef enum eMaterialGPencilStyle_Flag {
/* Material used as fill masking. */
GP_MATERIAL_IS_FILL_HOLDOUT = (1 << 14),
/* Show Eevee shadows */
- GP_MATERIAL_SHOW_SHADOWS = (1 << 15),
+ GP_MATERIAL_CAST_SHADOWS = (1 << 15),
} eMaterialGPencilStyle_Flag;
typedef enum eMaterialGPencilStyle_Mode {
diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c
index 1a0497b72f4..7172ddd9a73 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -2206,6 +2206,11 @@ static void rna_def_gpencil_layer(BlenderRNA *brna)
prop, "Use Lights", "Enable the use of lights on stroke and fill materials");
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+ prop = RNA_def_property(srna, "use_cast_shadows", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_CAST_SHADOWS);
+ RNA_def_property_ui_text(prop, "Cast Shadows", "Show shadows produced by grease pencil object");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
/* solo mode: Only display frames with keyframe */
prop = RNA_def_property(srna, "use_solo_mode", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_SOLO_MODE);
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index b6bb10524ee..e9f927e1416 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -596,9 +596,9 @@ 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");
+ prop = RNA_def_property(srna, "use_cast_shadows", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_MATERIAL_CAST_SHADOWS);
+ RNA_def_property_ui_text(prop, "Cast 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 */
More information about the Bf-blender-cvs
mailing list