[Bf-blender-cvs] [722951e] master: Freestyle: Added "blend_type" and "use_clamp" options to the Output Line Style shader node.

Tamito Kajiyama noreply at git.blender.org
Tue Aug 12 03:17:31 CEST 2014


Commit: 722951ecebc24063bd6d8e59ded6a61e05bd4b46
Author: Tamito Kajiyama
Date:   Wed Jul 16 22:25:37 2014 +0900
Branches: master
https://developer.blender.org/rB722951ecebc24063bd6d8e59ded6a61e05bd4b46

Freestyle: Added "blend_type" and "use_clamp" options to the Output Line Style shader node.

===================================================================

M	source/blender/blenkernel/intern/linestyle.c
M	source/blender/editors/space_node/drawnode.c
M	source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
M	source/blender/makesrna/intern/rna_nodetree.c
M	source/blender/nodes/NOD_static_types.h

===================================================================

diff --git a/source/blender/blenkernel/intern/linestyle.c b/source/blender/blenkernel/intern/linestyle.c
index 2080007..1d67908 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 6fa9290..c517ae7 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 86bba6fd..6587680 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 8a177c6..c975f6c 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 4cb3756..76e309c 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",        ""       )




More information about the Bf-blender-cvs mailing list