GPv3: Add layer blend mode to the UI #119460

Merged
Falk David merged 1 commits from filedescriptor/blender:gpv3-expose-blend-mode into main 2024-03-14 14:05:41 +01:00
2 changed files with 27 additions and 7 deletions

View File

@ -91,14 +91,19 @@ class DATA_PT_grease_pencil_layers(DataButtonsPanel, Panel):
col.operator("grease_pencil.layer_remove", icon='REMOVE', text="")
# Layer main properties
if layer:
layout.use_property_split = True
layout.use_property_decorate = True
col = layout.column(align=True)
if not layer:
return
row = layout.row(align=True)
row.prop(layer, "opacity", text="Opacity", slider=True)
layout.use_property_split = True
layout.use_property_decorate = True
col = layout.column(align=True)
# Layer main properties
row = layout.row(align=True)
row.prop(layer, "blend_mode", text="Blend Mode")
row = layout.row(align=True)
row.prop(layer, "opacity", text="Opacity", slider=True)
class DATA_PT_grease_pencil_layer_transform(LayerDataButtonsPanel, Panel):

View File

@ -236,6 +236,15 @@ static void rna_def_grease_pencil_layer(BlenderRNA *brna)
static const float scale_defaults[3] = {1.0f, 1.0f, 1.0f};
static const EnumPropertyItem rna_enum_layer_blend_modes_items[] = {
{GP_LAYER_BLEND_NONE, "REGULAR", 0, "Regular", ""},
{GP_LAYER_BLEND_HARDLIGHT, "HARDLIGHT", 0, "Hard Light", ""},
{GP_LAYER_BLEND_ADD, "ADD", 0, "Add", ""},
{GP_LAYER_BLEND_SUBTRACT, "SUBTRACT", 0, "Subtract", ""},
{GP_LAYER_BLEND_MULTIPLY, "MULTIPLY", 0, "Multiply", ""},
{GP_LAYER_BLEND_DIVIDE, "DIVIDE", 0, "Divide", ""},
{0, nullptr, 0, nullptr, nullptr}};
srna = RNA_def_struct(brna, "GreasePencilLayer", nullptr);
RNA_def_struct_sdna(srna, "GreasePencilLayer");
RNA_def_struct_ui_text(srna, "Grease Pencil Layer", "Collection of related drawings");
@ -332,6 +341,12 @@ static void rna_def_grease_pencil_layer(BlenderRNA *brna)
prop,
"ViewLayer",
"Only include Layer in this View Layer render output (leave blank to include always)");
prop = RNA_def_property(srna, "blend_mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, nullptr, "blend_mode");
RNA_def_property_enum_items(prop, rna_enum_layer_blend_modes_items);
RNA_def_property_ui_text(prop, "Blend Mode", "Blend mode");
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
}
static void rna_def_grease_pencil_layers_api(BlenderRNA *brna, PropertyRNA *cprop)