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

This commit is contained in:
Tamito Kajiyama 2014-07-16 22:25:37 +09:00
parent 833353b25e
commit 722951eceb
5 changed files with 27 additions and 1 deletions

View File

@ -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);

View File

@ -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;
}
}

View File

@ -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));

View File

@ -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;

View File

@ -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", "" )