Search code examples
mayapymelmaya-api

getting defaultArnoldRenderOptions attributes


I'm trying to write plugin for Maya using pymel. There is a little problem with using default attributes of Arnold renderer (outputfile format).

Code:

import maya.cmds as cmds

cmds.getAttr('defaultRenderGlobals.imageFormat') #return id of used format, for example png - 32
cmds.getAttr('defaultRenderGlobals.imageFormat') #return constant id=51 if Arnold Renderer set as current renderer
cmds.getAttr('defaultArnoldRenderOptions.?????') #how do the same with arnold options?

Solution

  • The code you have above is not PyMEL. I'll answer with PyMEL since it's what you asked for, and it's better than maya.cmds.

    To get a list of all available attributes on a node, use listAttr. There are many attributes on defaultArnoldRenderOptions, and they are returned unsorted, so you may want to sort or filter the list to make it easier to find.

    import pymel.core as pm
    
    # all attributes
    print pm.listAttr("defaultArnoldRenderOptions")
    
    # print names of attributes sorted, one per line.
    print ("\n").join(sorted(pm.listAttr("defaultArnoldRenderOptions")))
    
    #result
    ...
    ignoreSubdivision
    ignoreTextures
    ignore_list
    imageFormat
    indirectSampleClamp
    indirectSpecularBlur
    ...
    

    There's no outputfileformat, only imageFormat

    Get and print the value of the imageFormat attribute

    print pm.PyNode("defaultArnoldRenderOptions").attr("imageFormat").get()
    #result
    None