[MtoA] [Scripting] Setting the output image format


Settings like the image format and compression come from the defaultArnoldDriver node, so to set them through scripting, you need to set defaultArnoldDriver attributes.
ImageFormat_ai_translator

The image format corresponds to the ai_translator attribute.

# Python
import maya.cmds as cmds
cmds.setAttr( 'defaultArnoldDriver.ai_translator', 'exr', type='string' )
# PyMel
import pymel.core as pm
d = pm.PyNode( 'defaultArnoldDriver' )
d.ai_translator.set( 'exr )
// Mel
setAttr "defaultArnoldDriver.ai_translator" -type "string" "jpeg";

The rest of the attributes are named a little… better 😉 Here’s a Python snippet to list the driver attributes and their values:



from maya.cmds import *
sn = cmds.attributeInfo( inherited=False, short=True, type="aiAOVDriver" )
for s in sn:
    print "defaultArnoldDriver.%s = %s" %( s, cmds.getAttr( "defaultArnoldDriver.%s" % s ) )

One thought on “[MtoA] [Scripting] Setting the output image format

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s