Search code examples
pythonmaya

Maya Python Arnold Area Light Shapes


I'm making a basic lighting set up in Maya with python and was wondering if anyone knows how to change the shape of the arnold area light with python.

I've tried a few things but nothing has worked so far. Here is what I have right now (commented line is the issue)

import maya.cmds as cmds
import mtoa.utils as mutils

PFX = "PS_"
if cmds.objExists(f"{PFX}*"):
    cmds.delete(f"{PFX}*")

def Lights():    
    ### Key Light ###
    mutils.createLocator('aiAreaLight', asLight=True)
    area01 = cmds.rename('aiAreaLight1', f"{PFX}Key")
    cmds.select(f"{PFX}Key")
    cmds.move(21.517,6.564,25.303)
    cmds.rotate(11.583,45,0)
    cmds.scale(8.902,8.902,8.902)
    #cmds.setAttr(f"{PFX}KeyShape.aiLightShape","disk", type="string")
    cmds.setAttr(f"{PFX}KeyShape.color", 1,.744,.609)
    cmds.setAttr(f"{PFX}KeyShape.exposure", 0)
    cmds.setAttr(f"{PFX}KeyShape.intensity", 2025)
    cmds.setAttr(f"{PFX}KeyShape.aiSamples", 3)

Lights()

Solution

  • The attribute is called aiTranslator and you can access it via:

    cmds.setAttr(f"{PFX}KeyShape.aiTranslator", "disk", type="string")