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

Method getNodeDef

source/MaterialXCore/Node.cpp:82–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80}
81
82NodeDefPtr Node::getNodeDef(const string& target, bool allowRoughMatch) const
83{
84 if (hasNodeDefString())
85 {
86 return resolveNameReference<NodeDef>(getNodeDefString());
87 }
88 vector<NodeDefPtr> nodeDefs = getDocument()->getMatchingNodeDefs(getQualifiedName(getCategory()));
89 vector<NodeDefPtr> secondary = getDocument()->getMatchingNodeDefs(getCategory());
90 vector<NodeDefPtr> roughMatches;
91 nodeDefs.insert(nodeDefs.end(), secondary.begin(), secondary.end());
92 for (NodeDefPtr nodeDef : nodeDefs)
93 {
94 if (!targetStringsMatch(nodeDef->getTarget(), target) ||
95 !nodeDef->isVersionCompatible(getVersionString()) ||
96 nodeDef->getType() != getType())
97 {
98 continue;
99 }
100 if (!hasExactInputMatch(nodeDef))
101 {
102 if (allowRoughMatch)
103 {
104 roughMatches.push_back(nodeDef);
105 }
106 continue;
107 }
108 return nodeDef;
109 }
110 if (!roughMatches.empty())
111 {
112 return roughMatches[0];
113 }
114 return NodeDefPtr();
115}
116
117Edge Node::getUpstreamEdge(size_t index) const
118{

Callers 15

test_ShaderInterfaceMethod · 0.45
_getReferencedNodeDefFunction · 0.45
listContentsFunction · 0.45
bindLightingMethod · 0.45
GenSlang.cppFile · 0.45
GenMsl.cppFile · 0.45
GenOsl.cppFile · 0.45
Document.cppFile · 0.45
Node.cppFile · 0.45
Material.cppFile · 0.45
GenGlsl.cppFile · 0.45
XmlIo.cppFile · 0.45

Calls 15

hasNodeDefStringFunction · 0.85
getDocumentFunction · 0.85
getQualifiedNameFunction · 0.85
targetStringsMatchFunction · 0.85
getVersionStringFunction · 0.85
insertMethod · 0.80
isVersionCompatibleMethod · 0.80
push_backMethod · 0.80
getNodeGraphMethod · 0.80
getTypeFunction · 0.50
getMatchingNodeDefsMethod · 0.45
endMethod · 0.45

Tested by 1

test_ShaderInterfaceMethod · 0.36