[MtoA] Setting defaults for options and drivers


If you want to set default rendering options, or change the defaults for AOVs, you can use the hook functions provided by mtoadeploy/2015/scripts/mtoa/hooks.py.

hooks.py provides a number of setup functions that MtoA calls during initialization. You can override the default hook functions to do your own custom setup. For example, you could put this Python in your userSetup.py:

import mtoa.hooks

#
# Set some defaults for the defaultArnoldRenderOptions node
#
def setupOptions(options):
    options.AASamples.set(2)
    options.display_gamma.set(1)
    options.light_gamma.set(2.2)
    options.shader_gamma.set(2.2)
    options.texture_gamma.set(2.2)
    options.GITotalDepth.set(6)    
mtoa.hooks.setupOptions = setupOptions    

#
# Enable Merge AOVs for the defaultArnoldDriver and
# any other drivers created later by the user 
#
def setupDriver(driver, aovName=None):
    driver.mergeAOVs.set(1)
mtoa.hooks.setupDriver = setupDriver    

The setupOptions() function gets a pymel.PyNode object that holds the defaultArnoldRenderOptions. setupDriver() gets an aiAOVDriver pynode and the name of the AOV as a string.

Here’s a snippet that shows how to work with the pynode for an aiAOVDriver node.

import pymel.core as pm
driver = pm.PyNode('defaultArnoldDriver')

print driver
print driver.aiTranslator.get()
print driver.mergeAOVs.get()

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 )

Facebook photo

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

Connecting to %s