Cycles: Remove unused Mix Shaders from the ShaderGraph, instead of only relinking.

Differential revision: https://developer.blender.org/D796
This commit is contained in:
Thomas Dinges
2014-09-19 13:21:25 +02:00
parent 40a1c7b9c7
commit 75b61f5346

View File

@@ -391,6 +391,8 @@ void ShaderGraph::remove_unneeded_nodes()
if(output)
connect(output, input);
}
removed[mix->id] = true;
any_node_removed = true;
}
/* remove unused mix closure input when factor is 0.0 or 1.0 */
@@ -410,6 +412,8 @@ void ShaderGraph::remove_unneeded_nodes()
if(output)
connect(output, input);
}
removed[mix->id] = true;
any_node_removed = true;
}
/* factor 1.0 */
else if(mix->inputs[0]->value.x == 1.0f) {
@@ -425,13 +429,15 @@ void ShaderGraph::remove_unneeded_nodes()
if(output)
connect(output, input);
}
removed[mix->id] = true;
any_node_removed = true;
}
}
}
}
/* remove nodes */
if (any_node_removed) {
if(any_node_removed) {
list<ShaderNode*> newnodes;
foreach(ShaderNode *node, nodes) {