diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2014-07-11 11:51:04 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2014-08-12 05:10:14 +0400 |
commit | 87f75299e1b07fd026ecdfa1c993130a60d65280 (patch) | |
tree | 28195cd6d00694f8a66a803f62126ae28e250e49 /source/blender/makesrna | |
parent | d956a074e31b278d06c6ee4841ee735b90ba22ea (diff) |
Implemented a basic framework for node-based shaders.
Shader nodes will be used to define materials for stroke rendering, so as to
allow users to interactively configure textures.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_linestyle.c | 18 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 1 |
2 files changed, 16 insertions, 3 deletions
diff --git a/source/blender/makesrna/intern/rna_linestyle.c b/source/blender/makesrna/intern/rna_linestyle.c index 50b888b0247..f6f329e6b4d 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,6 +285,16 @@ 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) + ED_node_shader_default(C, &linestyle->id); + + 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) { @@ -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) diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 7dc77814ad5..201428a0a43 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -3418,6 +3418,7 @@ static void rna_def_space_node(BlenderRNA *brna) static EnumPropertyItem shader_type_items[] = { {SNODE_SHADER_OBJECT, "OBJECT", ICON_OBJECT_DATA, "Object", "Edit shader nodes from Object"}, {SNODE_SHADER_WORLD, "WORLD", ICON_WORLD_DATA, "World", "Edit shader nodes from World"}, + {SNODE_SHADER_LINESTYLE, "LINESTYLE", ICON_LINE_DATA, "Line Style", "Edit shader nodes from Line Style"}, {0, NULL, 0, NULL, NULL} }; |