Fix cycles render issue with a (useless) mix node that has the same shader

plugged into both sockets.
This commit is contained in:
Brecht Van Lommel
2012-05-23 17:55:34 +00:00
parent 7505102668
commit 7f7ba3243d

View File

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