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

Function listContents

python/Scripts/mxvalidate.py:74–233  ·  view source on GitHub ↗
(elemlist, resolve)

Source from the content-addressed store, hash-verified

72 print("----------------------------------")
73
74def listContents(elemlist, resolve):
75 if len(elemlist) == 0:
76 return ''
77 names = []
78 for elem in elemlist:
79
80 if elem.isA(mx.NodeDef):
81 outtype = elem.getType()
82 outs = ""
83 if outtype == "multioutput":
84 for ot in elem.getOutputs():
85 outs = outs + \
86 '\n\t %s output "%s"' % (ot.getType(), ot.getName())
87 names.append('%s %s "%s"%s' %
88 (outtype, elem.getNodeString(), elem.getName(), outs))
89 names.append(listNodedefInterface(elem))
90
91 elif elem.isA(mx.Implementation):
92 impl = elem.getName()
93 targs = []
94 if elem.hasTarget():
95 targs.append("target %s" % elem.getTarget())
96 if targs:
97 impl = "%s (%s)" % (impl, ", ".join(targs))
98 if elem.hasFunction():
99 if elem.hasFile():
100 impl = "%s [%s:%s()]" % (
101 impl, elem.getFile(), elem.getFunction())
102 else:
103 impl = "%s [function %s()]" % (impl, elem.getFunction())
104 elif elem.hasFile():
105 impl = "%s [%s]" % (impl, elem.getFile())
106 names.append(impl)
107
108 elif elem.isA(mx.Backdrop):
109 names.append('%s: contains "%s"' %
110 (elem.getName(), elem.getContainsString()))
111
112 elif elem.isA(mx.NodeGraph):
113 nchildnodes = len(elem.getChildren()) - elem.getOutputCount()
114 backdrops = elem.getBackdrops()
115 nbackdrops = len(backdrops)
116 outs = ""
117 if nbackdrops > 0:
118 for bd in backdrops:
119 outs = outs + '\n\t backdrop "%s"' % (bd.getName())
120 outs = outs + ' contains "%s"' % bd.getContainsString()
121 if elem.getOutputCount() > 0:
122 for ot in elem.getOutputs():
123 outs = outs + '\n\t %s output "%s"' % (ot.getType(), ot.getName())
124 outs = outs + traverseInputs(ot, "", 0)
125 nd = elem.getNodeDef()
126 if nd:
127 names.append('%s (implementation for nodedef "%s"): %d nodes%s' % (
128 elem.getName(), nd.getName(), nchildnodes, outs))
129 else:
130 names.append("%s: %d nodes, %d backdrop%s%s" % (
131 elem.getName(), nchildnodes, nbackdrops, pl(backdrops), outs))

Callers 1

mainFunction · 0.85

Calls 15

lenFunction · 0.85
listNodedefInterfaceFunction · 0.85
traverseInputsFunction · 0.85
plFunction · 0.85
listShaderBindingsFunction · 0.85
mapFunction · 0.85
getConvertedValueFunction · 0.85
getTargetFunction · 0.85
getGeomsFunction · 0.85
getViewerGeomsFunction · 0.85
isAMethod · 0.80
getFileMethod · 0.80

Tested by

no test coverage detected