Cycles: Remove unused Mix Shaders from the ShaderGraph, instead of only relinking.
Differential revision: https://developer.blender.org/D796
This commit is contained in:
@@ -391,6 +391,8 @@ void ShaderGraph::remove_unneeded_nodes()
|
|||||||
if(output)
|
if(output)
|
||||||
connect(output, input);
|
connect(output, input);
|
||||||
}
|
}
|
||||||
|
removed[mix->id] = true;
|
||||||
|
any_node_removed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* remove unused mix closure input when factor is 0.0 or 1.0 */
|
/* remove unused mix closure input when factor is 0.0 or 1.0 */
|
||||||
@@ -410,6 +412,8 @@ void ShaderGraph::remove_unneeded_nodes()
|
|||||||
if(output)
|
if(output)
|
||||||
connect(output, input);
|
connect(output, input);
|
||||||
}
|
}
|
||||||
|
removed[mix->id] = true;
|
||||||
|
any_node_removed = true;
|
||||||
}
|
}
|
||||||
/* factor 1.0 */
|
/* factor 1.0 */
|
||||||
else if(mix->inputs[0]->value.x == 1.0f) {
|
else if(mix->inputs[0]->value.x == 1.0f) {
|
||||||
@@ -425,13 +429,15 @@ void ShaderGraph::remove_unneeded_nodes()
|
|||||||
if(output)
|
if(output)
|
||||||
connect(output, input);
|
connect(output, input);
|
||||||
}
|
}
|
||||||
|
removed[mix->id] = true;
|
||||||
|
any_node_removed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* remove nodes */
|
/* remove nodes */
|
||||||
if (any_node_removed) {
|
if(any_node_removed) {
|
||||||
list<ShaderNode*> newnodes;
|
list<ShaderNode*> newnodes;
|
||||||
|
|
||||||
foreach(ShaderNode *node, nodes) {
|
foreach(ShaderNode *node, nodes) {
|
||||||
|
Reference in New Issue
Block a user