List Associated Passes for a Layer possible?

25 views
Skip to first unread message

sam.ma...@gmail.com

unread,
Dec 6, 2013, 2:11:57 PM12/6/13
to python_in...@googlegroups.com
I know that it is possible to list all the Layers in a maya scene, and all the (possible) RenderPasses with the following:

print
print
print "ALL Layers:"
AllLayers = cmds.ls(type='renderLayer')
for ThisLayer in AllLayers:
print " " + ThisLayer
print
print "ALL Passes:"
AllPasses = cmds.ls(type='renderPass')
for ThisPass in AllPasses:
print " " + ThisPass

However, I'm looking for a method for show the Layer to which a Pass is associated (in maya, the Associated Passes for each layer). Something that I can then display as of:

FirstLayer
FirstPass
SecondPass
ThirdPass
SecondLayer
FirstPass
SecondPass

Is there a method of showing this association?

Justin Israel

unread,
Dec 6, 2013, 3:13:42 PM12/6/13
to python_in...@googlegroups.com
Try this out. They are represented as connections:

for layer in cmds.ls(type="renderLayer"):
    print layer
    src = "%s.renderPass" % layer
    r_passes = cmds.listConnections(src, s=False, d=True, plugs=True, type="renderPass")
    if not r_passes:
        continue
    for r_pass in r_passes:
        name = r_pass.split('.', 1)[0]
        print "\t", name


--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/d69884bc-476a-4da8-8ba2-b3e022154e90%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages