diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_linestyle.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_linestyle.c | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/source/blender/makesrna/intern/rna_linestyle.c b/source/blender/makesrna/intern/rna_linestyle.c index faff39e679a..96b81f12620 100644 --- a/source/blender/makesrna/intern/rna_linestyle.c +++ b/source/blender/makesrna/intern/rna_linestyle.c @@ -87,6 +87,8 @@ EnumPropertyItem linestyle_geometry_modifier_type_items[] = { #include "BKE_texture.h" #include "BKE_depsgraph.h" +#include "ED_node.h" + #include "RNA_access.h" static StructRNA *rna_LineStyle_color_modifier_refine(struct PointerRNA *ptr) @@ -283,10 +285,20 @@ static void rna_LineStyle_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Poin WM_main_add_notifier(NC_LINESTYLE, linestyle); } +static void rna_LineStyle_use_nodes_update(bContext *C, PointerRNA *ptr) +{ + FreestyleLineStyle *linestyle = (FreestyleLineStyle *)ptr->data; + + if (linestyle->use_nodes && linestyle->nodetree == NULL) + BKE_linestyle_default_shader(C, linestyle); + + rna_LineStyle_update(CTX_data_main(C), CTX_data_scene(C), ptr); +} + static LineStyleModifier *rna_LineStyle_color_modifier_add(FreestyleLineStyle *linestyle, ReportList *reports, const char *name, int type) { - LineStyleModifier *modifier = BKE_add_linestyle_color_modifier(linestyle, name, type); + LineStyleModifier *modifier = BKE_linestyle_color_modifier_add(linestyle, name, type); if (!modifier) { BKE_report(reports, RPT_ERROR, "Failed to add the color modifier"); @@ -304,7 +316,7 @@ static void rna_LineStyle_color_modifier_remove(FreestyleLineStyle *linestyle, R { LineStyleModifier *modifier = modifier_ptr->data; - if (BKE_remove_linestyle_color_modifier(linestyle, modifier) == -1) { + if (BKE_linestyle_color_modifier_remove(linestyle, modifier) == -1) { BKE_reportf(reports, RPT_ERROR, "Color modifier '%s' could not be removed", modifier->name); return; } @@ -318,7 +330,7 @@ static void rna_LineStyle_color_modifier_remove(FreestyleLineStyle *linestyle, R static LineStyleModifier *rna_LineStyle_alpha_modifier_add(FreestyleLineStyle *linestyle, ReportList *reports, const char *name, int type) { - LineStyleModifier *modifier = BKE_add_linestyle_alpha_modifier(linestyle, name, type); + LineStyleModifier *modifier = BKE_linestyle_alpha_modifier_add(linestyle, name, type); if (!modifier) { BKE_report(reports, RPT_ERROR, "Failed to add the alpha modifier"); @@ -336,7 +348,7 @@ static void rna_LineStyle_alpha_modifier_remove(FreestyleLineStyle *linestyle, R { LineStyleModifier *modifier = modifier_ptr->data; - if (BKE_remove_linestyle_alpha_modifier(linestyle, modifier) == -1) { + if (BKE_linestyle_alpha_modifier_remove(linestyle, modifier) == -1) { BKE_reportf(reports, RPT_ERROR, "Alpha modifier '%s' could not be removed", modifier->name); return; } @@ -350,7 +362,7 @@ static void rna_LineStyle_alpha_modifier_remove(FreestyleLineStyle *linestyle, R static LineStyleModifier *rna_LineStyle_thickness_modifier_add(FreestyleLineStyle *linestyle, ReportList *reports, const char *name, int type) { - LineStyleModifier *modifier = BKE_add_linestyle_thickness_modifier(linestyle, name, type); + LineStyleModifier *modifier = BKE_linestyle_thickness_modifier_add(linestyle, name, type); if (!modifier) { BKE_report(reports, RPT_ERROR, "Failed to add the thickness modifier"); @@ -368,7 +380,7 @@ static void rna_LineStyle_thickness_modifier_remove(FreestyleLineStyle *linestyl { LineStyleModifier *modifier = modifier_ptr->data; - if (BKE_remove_linestyle_thickness_modifier(linestyle, modifier) == -1) { + if (BKE_linestyle_thickness_modifier_remove(linestyle, modifier) == -1) { BKE_reportf(reports, RPT_ERROR, "Thickness modifier '%s' could not be removed", modifier->name); return; } @@ -382,7 +394,7 @@ static void rna_LineStyle_thickness_modifier_remove(FreestyleLineStyle *linestyl static LineStyleModifier *rna_LineStyle_geometry_modifier_add(FreestyleLineStyle *linestyle, ReportList *reports, const char *name, int type) { - LineStyleModifier *modifier = BKE_add_linestyle_geometry_modifier(linestyle, name, type); + LineStyleModifier *modifier = BKE_linestyle_geometry_modifier_add(linestyle, name, type); if (!modifier) { BKE_report(reports, RPT_ERROR, "Failed to add the geometry modifier"); @@ -400,7 +412,7 @@ static void rna_LineStyle_geometry_modifier_remove(FreestyleLineStyle *linestyle { LineStyleModifier *modifier = modifier_ptr->data; - if (BKE_remove_linestyle_geometry_modifier(linestyle, modifier) == -1) { + if (BKE_linestyle_geometry_modifier_remove(linestyle, modifier) == -1) { BKE_reportf(reports, RPT_ERROR, "Geometry modifier '%s' could not be removed", modifier->name); return; } @@ -500,7 +512,7 @@ static void rna_def_linestyle_mtex(BlenderRNA *brna) prop = RNA_def_property(srna, "use_tips", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "texflag", MTEX_TIPS); - RNA_def_property_ui_text(prop, "Use tips", "Lower half of the texture is for tips of the stroke"); + RNA_def_property_ui_text(prop, "Use Tips", "Lower half of the texture is for tips of the stroke"); RNA_def_property_update(prop, 0, "rna_LineStyle_update"); prop = RNA_def_property(srna, "texture_coords", PROP_ENUM, PROP_NONE); @@ -571,6 +583,7 @@ static void rna_def_modifier_type_common(StructRNA *srna, EnumPropertyItem *modi prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "modifier.flags", LS_MODIFIER_ENABLED); RNA_def_property_ui_text(prop, "Use", "Enable or disable this modifier during stroke rendering"); + RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update"); prop = RNA_def_property(srna, "expanded", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "modifier.flags", LS_MODIFIER_EXPANDED); @@ -1337,7 +1350,6 @@ static void rna_def_linestyle(BlenderRNA *brna) RNA_def_property_enum_bitflag_sdna(prop, NULL, "panel"); RNA_def_property_enum_items(prop, panel_items); RNA_def_property_ui_text(prop, "Panel", "Select the property panel to be shown"); - RNA_def_property_update(prop, NC_LINESTYLE, NULL); prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR); RNA_def_property_float_sdna(prop, NULL, "r"); @@ -1606,14 +1618,14 @@ static void rna_def_linestyle(BlenderRNA *brna) /* nodes */ prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "nodetree"); - RNA_def_property_ui_text(prop, "Node Tree", "Node tree for node based textures"); + RNA_def_property_ui_text(prop, "Node Tree", "Node tree for node-based shaders"); prop = RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "use_nodes", 1); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); - RNA_def_property_ui_text(prop, "Use Nodes", "Use texture nodes for the line style"); - RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update"); + RNA_def_property_ui_text(prop, "Use Nodes", "Use shader nodes for the line style"); + RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_use_nodes_update"); } void RNA_def_linestyle(BlenderRNA *brna) |