Is it possible to query in a scene that has thougsands of lights, that a given light has illuminates by default checkbox , checked or unchecked.
I have tried
cmds.isConnected( ‘aiLight_test_01:aiAreaLight2.instObjGroups[0]’, ‘defaultLightSet.dagSetMembers[60]’ ), but for this case, I need dagSetMembers[60].
Is their a workaround ?
hey, your thread is 6 years old but i guess this is still an interesting subject because as of 2020, there is not yet such functionality or tool within Maya. It also gets worse with external renderer like Redshift, Arnold etc…
For eg. Redshift lights doesn’t even have the ‘Illuminates by Default’ checkbox, which is a shame !
So here is my trick to get that information with any kind of renderer. I’m using arrays difference in python to establish a list of lights which are not connected to the defaultlightSet node.
Here is the code :
import maya.cmds as cmds
lightsDefault = cmds.listRelatives('defaultLightSet', c=1)
allLightShapes = cmds.ls(cmds.ls("*.lightData", o=True), dag=True)
def diff(lightsDefault, allLightShapes):
return list(set(lightsDefault).symmetric_difference(set(allLightShapes)))
lightsNonDefault = cmds.listRelatives(diff(lightsDefault, allLightShapes),parent=True)
print lightsNonDefault
hey, your thread is 6 years old but i guess this is still an interesting subject because as of 2020, there is not yet such functionality or tool within Maya. It also gets worse with external renderer like Redshift, Arnold etc…For eg. Redshift lights doesn’t even have the ‘Illuminates by Default’ checkbox, which is a shame !
So here is my trick to get that information with any kind of renderer. I’m using arrays difference in python to establish a list of lights which are not connected to the defaultlightSet node.
Here is the code :
import maya.cmds as cmds
lightsDefault = cmds.listRelatives(‘defaultLightSet’, c=1)allLightShapes = cmds.ls(cmds.ls(“*.lightData”, o=True), dag=True)
def diff(lightsDefault, allLightShapes): return list(set(lightsDefault).symmetric_difference(set(allLightShapes)))
lightsNonDefault = cmds.listRelatives(diff(lightsDefault, allLightShapes),parent=True)print lightsNonDefault
For a single light, don’t compare against a hardcoded dagSetMembers index; query whether the shape is a member of defaultLightSet, or inspect connections from its instObjGroups[0] plug and check that the destination plug belongs to defaultLightSet. In the listing snippet, use set(allLightShapes) - set(lightsDefault) instead of symmetric_difference, otherwise default lights missing from allLightShapes can be included incorrectly.