WIP: GPv3: UI and RNA for layer use lights #110186
|
@ -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 = (
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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. */
|
||||
|
|
Loading…
Reference in New Issue