Hi,

I am using the following snippet (pymel) to list the objects that are 
connected to the selected material. What would be the cmds version of doing 
the same? (listing both meshes and mesh faces)

import pymel.core as pm

# list the materials
mat_list = pm.ls(mat=True, sl=True)

for mat in mat_list:
    
    # list the shading groups
    sg_list = mat.listConnections(type='shadingEngine')
    
    for sg in sg_list:
        
        # get the members of the sg
        member_list = sg.members()
        
        for member in member_list:
            
            print(member)

Cheers,
Johan

-- 
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/355d3b26-4e3e-46ca-9344-691bf8cc5140%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to