From 722951ecebc24063bd6d8e59ded6a61e05bd4b46 Mon Sep 17 00:00:00 2001 From: Tamito Kajiyama Date: Wed, 16 Jul 2014 22:25:37 +0900 Subject: Freestyle: Added "blend_type" and "use_clamp" options to the Output Line Style shader node. --- source/blender/blenkernel/intern/linestyle.c | 2 ++ source/blender/editors/space_node/drawnode.c | 15 +++++++++++++++ .../intern/blender_interface/BlenderStrokeRenderer.cpp | 3 +++ source/blender/makesrna/intern/rna_nodetree.c | 6 ++++++ source/blender/nodes/NOD_static_types.h | 2 +- 5 files changed, 27 insertions(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/linestyle.c b/source/blender/blenkernel/intern/linestyle.c index 2080007075b..1d6790856bb 100644 --- a/source/blender/blenkernel/intern/linestyle.c +++ b/source/blender/blenkernel/intern/linestyle.c @@ -1174,6 +1174,8 @@ void BKE_linestyle_default_shader(const bContext *C, FreestyleLineStyle *linesty output_linestyle = nodeAddStaticNode(C, ntree, SH_NODE_OUTPUT_LINESTYLE); output_linestyle->locx = 300.0f; output_linestyle->locy = 300.0f; + output_linestyle->custom1 = MA_RAMP_BLEND; + output_linestyle->custom2 = 0; // use_clamp nodeSetActive(ntree, input_texure); diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 6fa9290c732..c517ae753c4 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -1000,6 +1000,18 @@ static void node_shader_buts_script_ex(uiLayout *layout, bContext *C, PointerRNA #endif } +static void node_buts_output_linestyle(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiLayout *row, *col; + + bNodeTree *ntree = (bNodeTree *)ptr->id.data; + + col = uiLayoutColumn(layout, false); + row = uiLayoutRow(col, true); + uiItemR(row, ptr, "blend_type", 0, "", ICON_NONE); + uiItemR(col, ptr, "use_clamp", 0, NULL, ICON_NONE); +} + /* only once called */ static void node_shader_set_butfunc(bNodeType *ntype) { @@ -1126,6 +1138,9 @@ static void node_shader_set_butfunc(bNodeType *ntype) case SH_NODE_UVMAP: ntype->draw_buttons = node_shader_buts_uvmap; break; + case SH_NODE_OUTPUT_LINESTYLE: + ntype->draw_buttons = node_buts_output_linestyle; + break; } } diff --git a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp index 86bba6fd329..6587680ce5a 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp +++ b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp @@ -296,6 +296,9 @@ Material* BlenderStrokeRenderer::GetStrokeShader(bContext *C, Main *bmain, Frees bNodeSocket *outsock; bNodeLink *link; + color_mix_rgb->custom1 = output_linestyle->custom1; // blend_type + color_mix_rgb->custom2 = output_linestyle->custom2; // use_clamp + outsock = (bNodeSocket *)BLI_findlink(&output_linestyle->inputs, 0); // Color tosock = (bNodeSocket *)BLI_findlink(&color_mix_rgb->inputs, 2); // Color2 link = (bNodeLink *)BLI_findptr(&ntree->links, outsock, offsetof(bNodeLink, tosock)); diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 8a177c6e2f9..c975f6cfe90 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -3172,6 +3172,12 @@ static void def_sh_output(StructRNA *srna) RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); } +static void def_sh_output_linestyle(StructRNA *srna) +{ + def_sh_output(srna); + def_mix_rgb(srna); +} + static void def_sh_material(StructRNA *srna) { PropertyRNA *prop; diff --git a/source/blender/nodes/NOD_static_types.h b/source/blender/nodes/NOD_static_types.h index 4cb3756c2c6..76e309c5bae 100644 --- a/source/blender/nodes/NOD_static_types.h +++ b/source/blender/nodes/NOD_static_types.h @@ -69,7 +69,7 @@ DefNode( ShaderNode, SH_NODE_HUE_SAT, 0, "HUE_S DefNode( ShaderNode, SH_NODE_OUTPUT_MATERIAL, def_sh_output, "OUTPUT_MATERIAL", OutputMaterial, "Material Output", "" ) DefNode( ShaderNode, SH_NODE_OUTPUT_LAMP, def_sh_output, "OUTPUT_LAMP", OutputLamp, "Lamp Output", "" ) DefNode( ShaderNode, SH_NODE_OUTPUT_WORLD, def_sh_output, "OUTPUT_WORLD", OutputWorld, "World Output", "" ) -DefNode( ShaderNode, SH_NODE_OUTPUT_LINESTYLE, def_sh_output, "OUTPUT_LINESTYLE", OutputLineStyle, "Line Style Output", "" ) +DefNode( ShaderNode, SH_NODE_OUTPUT_LINESTYLE, def_sh_output_linestyle,"OUTPUT_LINESTYLE", OutputLineStyle, "Line Style Output", "" ) DefNode( ShaderNode, SH_NODE_FRESNEL, 0, "FRESNEL", Fresnel, "Fresnel", "" ) DefNode( ShaderNode, SH_NODE_LAYER_WEIGHT, 0, "LAYER_WEIGHT", LayerWeight, "Layer Weight", "" ) DefNode( ShaderNode, SH_NODE_MIX_SHADER, 0, "MIX_SHADER", MixShader, "Mix Shader", "" ) -- cgit v1.2.3