Community
Arnold for 3ds Max
Rendering with Arnold in 3ds Max using the MaxtoA plug-in.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Query AOV existence Maya

1 REPLY 1
Reply
Message 1 of 2
eupotter
345 Views, 1 Reply

Query AOV existence Maya

Hello!

I'm trying to write a script that makes it easier to create Light AOV's using LPE's (Light Path Expressions). But I just can't find a way to query the existence of previously created AOV's and skip those.

I'm following a tutorial I found from Arvid Schneider so some steps are from his video.

Here is what I have so far:

custAovLst = []
  for lightSel in range(len(LightList)):
     lgt_name = cmds.listRelatives(LightList, shapes = 1)
     aov ='setAttr -type "string" {}.aiAov {};'.format(lgt_name[lightSel], 'lgt_' + lgt_name[lightSel].replace("Shape", ""))
     mel.eval(aov)

 for light in LightList:
     aovName = cmds.getAttr(light + '.aiAov')
     custAovLst.append(aovName)

def aovCreate():
     for aovPass in custAovLst:
         if cmds.attributeQuery(aovPass , node = ".aiAov", ex = True):
             pass
         else:
             lightAov = aovs.AOVInterface().addAOV(aovPass, aovType='rgba')
             aiAov = pmc.PyNode(lightAov.node)
             aiAov.lightPathExpression.set("C.<L.'" + aovPass + "'>.*") 

aovCreate()


Any help or advice on how to achieve this or a better way to go on hits is more than welcome!


Tags (3)
Labels (3)
1 REPLY 1
Message 2 of 2
fabriceQ224F
in reply to: eupotter

You can list all AOVs thanks to this command:

import mtoa.aovs as aov

allAOVs = aov.getAOVs()

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report