I'm trying to make a Python code to render only selected objects in Maya, and want to know how to add selected objects to renderLayerSetup in Maya 2017 ?
I've tried to use some code I found
import maya.app.renderSetup.model.renderSetup as renderSetup
rs = renderSetup.instance()
test = rs.createRenderLayer('render')
scene_Assets = test.createCollection('scene_Assets')
scene_Assets.getSelector().setPattern('name')
but this code required me to use the objects name to add to the collection
I expecting the output to be able to add objects to collection without having to rename all the names.