Just to add on top of Justin's version. You don't need to perform the 
actual selection, both ls() and filterExpand() can operate on input 
objects. Like so:

mat_list = cmds.ls(mat=True, sl=True) 

for mat in mat_list:
    sg_list = cmds.listConnections(mat, type='shadingEngine')
    if not sg_list:
        continue

    for sg in sg_list:
        members = cmds.sets(sg, q=True)

        meshes = cmds.ls(members, exactType="mesh")
        for mesh in meshes:
            print "[mesh]", mesh

        faces = cmds.filterExpand(members, sm=34, expand=False) or []
        for face in faces:
            print "[face]", faces

Of course this would be a micro-optimization I assume. :)

-Roy

-- 
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/b0898a82-b8bf-4d7a-97c0-0d26e03272f8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to