[SItoA] Getting user parameters in the render tree


Arnold nodes can have user-defined parameters, like MyColor in this ASS snippet:

polymesh
{
 name grid3.SItoA.1000
#
# ...
#
 declare MyColor constant RGBA
 MyColor 0.703999996 0 0.526000023 1
}

In Softimage, there are a number of ways you can assign data like MyColor to a polygon mesh. You could use ICE:
userparam_ice_attribute
Or you could use the Arnold User Options property:
userparam_user_options
To access MyColor in the render tree, use the Color Attribute shader:
MyColor_render_tree
If you used ICE, MyColor will appear automatically in the Attribute list. But if you used the User Options property, you’ll have to use a script one-liner to set the Attribute value. That’s because Softimage doesn’t know about the user parameters on Arnold nodes: those come into existence only when SItoA translates the scene to Arnold.

Application.SetValue("Sources.Materials.DefaultLib.Material.Color_Attribute.attribute", "MyColor", "")

On a related note, the MtoA shader userDataColor does the same thing as the SItoA Color Attribute shader: it uses AiUDataGetRGBA() to get a color from a user parameter on the object being shaded. With SItoA 3.0, the Arnold > DLL Shaders menu makes it pretty easy to use an MtoA shader in Softimage.
mtoa_userDataColor