I have a working script to get a shader from current selection.
def gShader():
obj = selected()
shdGrp = obj[0].shadingGroups()
shader = ls(listConnections(shdGrp),materials=True)
print shader
But I was wondering if I could make it more pyMel. I mean, I was surprised to
find out I could just replace these lines
shapes = ls(dag=1,o=1,s=1,sl=1)
shdGrp = listConnections(shapes,type='shadingEngine')
with this one
shdGrp = obj[0].shadingGroups()
so I am trying to find out if there is a pymel way of writing this line
shader = ls(listConnections(shdGrp),materials=True)
Any help or info would be very much appreciated.
Thank you.
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/e28e2d0e-cf37-4cfb-ab2e-d1adab68359c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.