[Maya-Python] Get the current render for each render layer

714 views
Skip to first unread message

Leonardo Bruni

unread,
Mar 8, 2016, 1:23:08 PM3/8/16
to python_in...@googlegroups.com
Hi guys, 
i'm tryng to get the renderer used by each renderLayer, there's something that i don't understand.
normally without renderLayers the command is simple:

cmds.getAttr('defaultRenderGlobals.currentRenderer')

My wrong logic said: "ok, just get each renderLayer and get the currentRenderer"

so:

import sys
import maya.cmds as cmds
import maya.mel as mel

render_layers = cmds.ls(type = 'renderLayer')
for rl in render_layers:
print cmds.getAttr('%s.currentRenderer' % rl)

But is not the way apparently...
So the question is: how i can get for each renderLayer the current render engine ?

Thanks in advance

Leo


Andres Weber

unread,
Mar 8, 2016, 2:53:32 PM3/8/16
to Python Programming for Autodesk Maya
Didn't test this out very thoroughly...but you can check all of the adjustments (layer overrides) for any layer using this (if you're using pymel):

pm.PyNode('layer1').listAdjustments()

then if you find an adjustment you like that's connected to the defaultRenderGlobals.currentRenderer:
adjustment.get()

That will give you what you're looking for I believe.

Andres Weber

unread,
Mar 8, 2016, 2:55:20 PM3/8/16
to Python Programming for Autodesk Maya
Oh and sorry, I forgot to point out that this is ONLY in the case that you've created layer overrides per render layer (which is what I figured you did since you'd just simply check defaultRenderGlobals.currentRenderer otherwise).
Reply all
Reply to author
Forward
0 new messages