MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/MaterialX / create

Method create

source/MaterialXGenShader/ShaderGraph.cpp:440–471  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

438}
439
440ShaderGraphPtr ShaderGraph::create(const ShaderGraph* parent, const NodeGraph& nodeGraph, GenContext& context)
441{
442 NodeDefPtr nodeDef = nodeGraph.getNodeDef();
443 if (!nodeDef)
444 {
445 throw ExceptionShaderGenError("Can't find nodedef '" + nodeGraph.getNodeDefString() + "' referenced by nodegraph '" + nodeGraph.getName() + "'");
446 }
447
448 string graphName = nodeGraph.getName();
449 context.getShaderGenerator().getSyntax().makeValidName(graphName);
450 ShaderGraphPtr graph = std::make_shared<ShaderGraph>(parent, graphName, nodeGraph.getDocument(), context);
451
452 // Clear classification
453 graph->_classification = 0;
454
455 // Create input sockets from the nodedef
456 graph->addInputSockets(*nodeDef, context);
457
458 // Create output sockets from the nodegraph
459 graph->addOutputSockets(nodeGraph, context);
460
461 // Traverse all outputs and create all internal nodes
462 for (OutputPtr graphOutput : nodeGraph.getActiveOutputs())
463 {
464 graph->addUpstreamDependencies(*graphOutput, context);
465 }
466
467 // Finalize the graph
468 graph->finalize(context);
469
470 return graph;
471}
472
473ShaderGraphPtr ShaderGraph::create(const ShaderGraph* parent, const string& name, ElementPtr element, GenContext& context)
474{

Callers

nothing calls this directly

Calls 15

addInputSocketsMethod · 0.80
addOutputSocketsMethod · 0.80
getActiveOutputsMethod · 0.80
addOutputSocketMethod · 0.80
getNamePathMethod · 0.80
setColorSpaceMethod · 0.80
makeConnectionMethod · 0.80
getActiveInputsMethod · 0.80
getResolvedValueMethod · 0.80
getInterfaceInputMethod · 0.80
applyInputTransformsMethod · 0.80

Tested by

no test coverage detected