I am trying to get hold of the objects included in a collection in Mayas new renderlayer system. I can get the ones in the include field, but not the ones added through add or drag and drop.
Basically what I am trying to do is finding all the lights that are active in the scene but as the new lighteditor is to unstabile we have decided to use collections instead so I will need to figure out which lights in the scene is within a collection or a child of a group that's in a collection and whether that group has been disabled. This is my super simple script so far that only works as long as the lights are added as a "pattern" next to the include text field.
#modules
import maya.app.renderSetup.model.override as override
import maya.app.renderSetup.model.selector as selector
import maya.app.renderSetup.model.collection as collection
import maya.app.renderSetup.model.renderLayer as renderLayer
import maya.app.renderSetup.model.renderSetup as renderSetup
import maya.cmds as mc
rs = renderSetup.instance()
rl_test = rs.createRenderLayer("Layer") # create renderlayer
cl_test_lights = rl_test.createCollection("Prod_lights")
cl_test_lights.getSelector().setPattern('Prod_lights_grp')
cl_test_lights.setSelfEnabled(0) #disable collection
collections = rl_test.getCollections() #get collections within renderlayer
DeactivatedLightsLi=[]
for each in collections:
if each.isSelfEnabled()==False: #if collection is disabled
pattern = each.getSelector().getPattern()
DeactivatedLightsLi.append(pattern) #add this pattern to the list