Share

Iterate an Arnold Array With the Python Bindings - Arnold Developer Guide

The following snippet code opens the "test.ass" file attached in this wiki, find the object named "mesh", get the shader array, and print a list of its shaders.

#!/usr/bin/env python
from arnold import *

AiBegin()
universe = AiUniverse()
AiSceneLoad(universe, "test.ass")

mesh = AiNodeLookUpByName(universe, 'mesh')
shaders = AiNodeGetArray(mesh, "shader");
for i in range(AiArrayGetNumElements(shaders)):
   shader = AiArrayGetPtr(shaders, i)
   print(AiNodeGetName(shader))
AiEnd() 

Was this information helpful?