Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-07-05 13:44:15 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-07-05 19:43:48 +0300
commitdbdafe1209a4787d6f8dcafa034bc9ced3c7f365 (patch)
treeb9457d3f0c2c8e54de05dbc594d0e8caa4f514e0 /source/blender/makesrna/intern/rna_nodetree.c
parent5bd57aaa052d9578d089a92338d6f0977b5d6c5c (diff)
Shaders: add target setting to material output node.
This makes it possible to have a single shading nodetree that contains separate Cycles and Eevee shaders. By default the target is set to All so shaders are shared.
Diffstat (limited to 'source/blender/makesrna/intern/rna_nodetree.c')
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 492335d4d25..9e800d3b875 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -175,6 +175,14 @@ static const EnumPropertyItem node_sampler_type_items[] = {
{2, "BICUBIC", 0, "Bicubic", ""},
{0, NULL, 0, NULL, NULL}
};
+
+
+static const EnumPropertyItem prop_shader_output_target_items[] = {
+ {SHD_OUTPUT_ALL, "ALL", 0, "All", "Use shaders for all renderers and viewports, unless there exists a more specific output"},
+ {SHD_OUTPUT_EEVEE, "EEVEE", 0, "Eevee", "Use shaders for Eevee renderer"},
+ {SHD_OUTPUT_CYCLES, "CYCLES", 0, "Cycles", "Use shaders for Cycles renderer"},
+ {0, NULL, 0, NULL, NULL}
+};
#endif
#ifdef RNA_RUNTIME
@@ -3536,6 +3544,12 @@ static void def_sh_output(StructRNA *srna)
RNA_def_property_boolean_sdna(prop, NULL, "flag", NODE_DO_OUTPUT);
RNA_def_property_ui_text(prop, "Active Output", "True if this node is used as the active output");
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "target", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, prop_shader_output_target_items);
+ RNA_def_property_ui_text(prop, "Target", "Which renderer and viewport shading types to use the shaders for");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_sh_output_linestyle(StructRNA *srna)
@@ -8377,12 +8391,21 @@ static void rna_def_composite_nodetree(BlenderRNA *brna)
static void rna_def_shader_nodetree(BlenderRNA *brna)
{
StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
srna = RNA_def_struct(brna, "ShaderNodeTree", "NodeTree");
RNA_def_struct_ui_text(srna, "Shader Node Tree",
"Node tree consisting of linked nodes used for materials (and other shading data-blocks)");
RNA_def_struct_sdna(srna, "bNodeTree");
RNA_def_struct_ui_icon(srna, ICON_MATERIAL);
+
+ func = RNA_def_function(srna, "get_output_node", "ntreeShaderOutputNode");
+ RNA_def_function_ui_description(func, "Return active shader output node for the specified target");
+ parm = RNA_def_enum(func, "target", prop_shader_output_target_items, SHD_OUTPUT_ALL, "Target", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "node", "ShaderNode", "Node", "");
+ RNA_def_function_return(func, parm);
}
static void rna_def_texture_nodetree(BlenderRNA *brna)