diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-05-23 21:55:34 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-05-23 21:55:34 +0400 |
commit | 7f7ba3243d843a1d7702cd1c8bab0dd1a5b9fb35 (patch) | |
tree | 2fd2c4b46eeda5ab3bb38863a6a0d9ab204e3066 /intern/cycles/render/graph.cpp | |
parent | 7505102668cf5339c391c0f7407f326541b2811b (diff) |
Fix cycles render issue with a (useless) mix node that has the same shader
plugged into both sockets.
Diffstat (limited to 'intern/cycles/render/graph.cpp')
-rw-r--r-- | intern/cycles/render/graph.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/intern/cycles/render/graph.cpp b/intern/cycles/render/graph.cpp index d9486de47c9..77bc9cf27ec 100644 --- a/intern/cycles/render/graph.cpp +++ b/intern/cycles/render/graph.cpp @@ -325,6 +325,25 @@ void ShaderGraph::remove_proxy_nodes(vector<bool>& removed) removed[proxy->id] = true; } + + /* remove useless mix closures nodes */ + MixClosureNode *mix = dynamic_cast<MixClosureNode*>(node); + + if(mix) { + if(mix->outputs[0]->links.size() && mix->inputs[1]->link == mix->inputs[2]->link) { + ShaderOutput *output = mix->inputs[1]->link; + vector<ShaderInput*> inputs = mix->outputs[0]->links; + + foreach(ShaderInput *sock, mix->inputs) + if(sock->link) + disconnect(sock); + + foreach(ShaderInput *input, inputs) { + disconnect(input); + connect(output, input); + } + } + } } } |