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
path: root/intern
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2020-11-16 21:28:58 +0300
committerBrecht Van Lommel <brecht@blender.org>2020-11-16 21:29:59 +0300
commit457d537fe4f33cfb16e5672404aa9f87797d9d23 (patch)
treefa191e3cc888749b839a879762a26a81977e49d9 /intern
parent13ec512f4b9a9232d04a8995fab1837798ef4c39 (diff)
Fix T82673: Cycles crash with zero emission strength and linked emission color
Diffstat (limited to 'intern')
-rw-r--r--intern/cycles/render/nodes.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp
index fa6096ff39b..5e21ad15cc8 100644
--- a/intern/cycles/render/nodes.cpp
+++ b/intern/cycles/render/nodes.cpp
@@ -2785,7 +2785,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");
@@ -2801,6 +2801,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) {
@@ -2818,6 +2828,7 @@ void PrincipledBsdfNode::expand(ShaderGraph *graph)
}
remove_input(emission_in);
+ remove_input(emission_strength_in);
remove_input(alpha_in);
}