You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
throwExceptionShaderGenError("Output '"+outputName+"' not found on NodeDef '"+nodeDefName+"'");
787
+
}
788
+
789
+
InputPtr nodeDefInput = nullptr;
790
+
if (!inputName.empty())
791
+
{
792
+
// Only look for the input if we are given an inputName. It's valid to insert the node
793
+
// without any upstream connection, and so an input name is not required.
794
+
nodeDefInput = nodeDef->getInput(inputName);
795
+
if (!nodeDefInput)
796
+
{
797
+
throwExceptionShaderGenError("Input '"+inputName+"' not found on NodeDef '"+nodeDefName+"'");
798
+
}
799
+
}
800
+
801
+
// record the previously connected upstream
802
+
auto originalUpstream = output->getConnection();
803
+
804
+
if (nodeDefInput && originalUpstream)
805
+
{
806
+
// if we're going to attempt to connect these - we need to check the types match
807
+
// we do this before creating any new data
808
+
if (nodeDefInput->getType() != originalUpstream->getType().getName())
809
+
{
810
+
throwExceptionShaderGenError("Cannot connect ports of mismatched types '"+nodeDefInput->getType()+"' and '"+originalUpstream->getType().getName()+"' when inserting node");
811
+
}
812
+
}
813
+
814
+
// create the new node, and connect its output to the provided graph output
815
+
auto newNode = createNode(newNodeName, nodeDef, context);
816
+
if (!newNode)
817
+
{
818
+
throwExceptionShaderGenError("Error while creating node '"+newNodeName+"' of type '"+nodeDefName+"'");
819
+
}
820
+
auto newNodeOutput = newNode->getOutput(outputName);
0 commit comments