Here’s a snippet that loops over the shape nodes in an ASS file.
from arnold import * AiBegin() AiMsgSetConsoleFlags(AI_LOG_ALL) # Required if the ASS file uses any SItoA shaders AiLoadPlugins('C:/softimage/workgroups/sitoa-3.4.0-2015/Addons/SItoA/Application/Plugins/bin/nt-x86-64') AiASSLoad('C:/softimage/projects/Support/Arnold_Scenes/Default_Pass_Main.1.ass') # Iterate over all shape nodes iter = AiUniverseGetNodeIterator(AI_NODE_SHAPE); while not AiNodeIteratorFinished(iter): node = AiNodeIteratorGetNext(iter) print "[script] AiNodeGetName: {0}".format( AiNodeGetName( node ) ) ne = AiNodeGetNodeEntry( node ) print "[script] AiNodeEntryGetName: {0}".format( AiNodeEntryGetName( ne ) ) print "[script] AiNodeEntryGetType: {0}".format( AiNodeEntryGetType( ne ) ) print "[script] AiNodeEntryGetTypeName: {0}".format( AiNodeEntryGetTypeName( ne ) ) AiNodeIteratorDestroy(iter) AiEnd()
This would print something like this:
C:\solidangle\scripts>python shapes.py [script] AiNodeGetName: root [script] AiNodeEntryGetName: list_aggregate [script] AiNodeEntryGetType: 8 [script] AiNodeEntryGetTypeName: shape [script] AiNodeGetName: cube.SItoA.1000 [script] AiNodeEntryGetName: polymesh [script] AiNodeEntryGetType: 8 [script] AiNodeEntryGetTypeName: shape
Note the root node of type list_aggregate. It’s shape used internally by Arnold. Just be aware that that root node is there in the universe, because even if you load an ASS file that contains just polymesh nodes, there will be a root node that you’ll have to skip over.
