Skip to content

Commit 6a01a2e

Browse files
Validate nodegraph output types (#1361)
This changelist adds a check for nodegraph output types in document validation, providing more useful feedback when evaluating new node proposals.
1 parent 7f838b5 commit 6a01a2e

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

source/MaterialXCore/Node.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,13 @@ bool NodeGraph::validate(string* message) const
749749
validateRequire(nodeDef != nullptr, res, message, "NodeGraph implementation refers to non-existent NodeDef");
750750
if (nodeDef)
751751
{
752-
validateRequire(getOutputCount() == nodeDef->getActiveOutputs().size(), res, message, "NodeGraph implementation has a different number of outputs than its NodeDef");
752+
vector<OutputPtr> graphOutputs = getOutputs();
753+
vector<OutputPtr> nodeDefOutputs = nodeDef->getActiveOutputs();
754+
validateRequire(graphOutputs.size() == nodeDefOutputs.size(), res, message, "NodeGraph implementation has a different number of outputs than its NodeDef");
755+
if (graphOutputs.size() == 1 && nodeDefOutputs.size() == 1)
756+
{
757+
validateRequire(graphOutputs[0]->getType() == nodeDefOutputs[0]->getType(), res, message, "NodeGraph implementation has a different output type than its NodeDef");
758+
}
753759
}
754760
}
755761

0 commit comments

Comments
 (0)