WIP: GPv3: UI and RNA for layer use lights #110186

Closed
casey-bianco-davis wants to merge 6 commits from casey-bianco-davis/blender:GPv3-layer-use-lights-ui into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
6 changed files with 31 additions and 1 deletions

View File

@ -69,6 +69,9 @@ class DATA_PT_grease_pencil_layers(DataButtonsPanel, Panel):
col = layout.row(align=True)
col.prop(layer, "opacity", text="Opacity", slider=True)
col = layout.row(align=True)
col.prop(layer, "use_lights")
classes = (

View File

@ -297,6 +297,7 @@ class Layer : public ::GreasePencilLayer {
bool is_editable() const;
bool is_empty() const;
bool is_selected() const;
bool use_lights() const;
bool use_onion_skinning() const;

View File

@ -434,7 +434,7 @@ TreeNode::TreeNode()
this->parent = nullptr;
this->name = nullptr;
this->flag = 0;
this->flag = GP_LAYER_TREE_NODE_USE_LIGHTS;
this->color[0] = this->color[1] = this->color[2] = 0;
}
@ -605,6 +605,11 @@ bool Layer::is_selected() const
return ((this->base.flag & GP_LAYER_TREE_NODE_SELECT) != 0);
}
bool Layer::use_lights() const
{
return (this->base.flag & GP_LAYER_TREE_NODE_USE_LIGHTS) != 0;
}
bool Layer::use_onion_skinning() const
{
return ((this->base.flag & GP_LAYER_TREE_NODE_USE_ONION_SKINNING) != 0);

View File

@ -47,6 +47,17 @@ class LayerModule {
do_layer_blending = true;
}
bool ob_shadeless = false; // TODO: ob.is_shadeless
if (ob_shadeless) {
gp_layer.use_lights = false;
}
else {
gp_layer.use_lights = layer.use_lights();
if (!gp_layer.use_lights) {
do_layer_blending = true;
}
}
layers_buf_.append(gp_layer);
}

View File

@ -161,6 +161,9 @@ struct gpLayer {
float stroke_index_offset;
/** Color to multiply to the final mixed color. */
float4 tint;
/** If the layer uses the scene lights. */
bool1 use_lights;
bool1 _pad0[3];
};
BLI_STATIC_ASSERT_ALIGN(gpLayer, 16)

View File

@ -214,6 +214,13 @@ static void rna_def_grease_pencil_layer(BlenderRNA *brna)
prop = RNA_def_property(srna, "opacity", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, "GreasePencilLayer", "opacity");
RNA_def_property_ui_text(prop, "Opacity", "Layer Opacity");
/* Use Lights */
prop = RNA_def_property(srna, "use_lights", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(
prop, "GreasePencilLayerTreeNode", "flag", GP_LAYER_TREE_NODE_USE_LIGHTS);
RNA_def_property_ui_text(
prop, "Use Lights", "Enable the use of lights on stroke and fill materials");
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
/* Onion Skinning. */