diff options
author | Brecht Van Lommel <brecht@blender.org> | 2020-11-16 21:30:37 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2020-11-16 21:30:37 +0300 |
commit | 5d13cb5c2a8e5c2728185e7d1e6b186ce86154e5 (patch) | |
tree | 091dfe1e8c06888570c1f29200e28214b0015782 /intern/cycles/render/nodes.cpp | |
parent | 07bd8eab97608421d43e1c9305050a73a656e1e2 (diff) | |
parent | 457d537fe4f33cfb16e5672404aa9f87797d9d23 (diff) |
Merge branch 'blender-v2.91-release'
Diffstat (limited to 'intern/cycles/render/nodes.cpp')
-rw-r--r-- | intern/cycles/render/nodes.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp index bde573bf0dc..b59dd124040 100644 --- a/intern/cycles/render/nodes.cpp +++ b/intern/cycles/render/nodes.cpp @@ -2791,7 +2791,7 @@ void PrincipledBsdfNode::expand(ShaderGraph *graph) ShaderInput *emission_strength_in = input("Emission Strength"); if ((emission_in->link || emission != make_float3(0.0f, 0.0f, 0.0f)) && (emission_strength_in->link || emission_strength != 0.0f)) { - /* Create add closure and emission. */ + /* Create add closure and emission, and relink inputs. */ AddClosureNode *add = graph->create_node<AddClosureNode>(); EmissionNode *emission_node = graph->create_node<EmissionNode>(); ShaderOutput *new_out = add->output("Closure"); @@ -2807,6 +2807,16 @@ void PrincipledBsdfNode::expand(ShaderGraph *graph) principled_out = new_out; } + else { + /* Disconnect unused links if the other value is zero, required before + * we remove the input from the node entirely. */ + if (emission_in->link) { + emission_in->disconnect(); + } + if (emission_strength_in->link) { + emission_strength_in->disconnect(); + } + } ShaderInput *alpha_in = input("Alpha"); if (alpha_in->link || alpha != 1.0f) { @@ -2824,6 +2834,7 @@ void PrincipledBsdfNode::expand(ShaderGraph *graph) } remove_input(emission_in); + remove_input(emission_strength_in); remove_input(alpha_in); } |