mat_list = cmds.ls(mat=True, sl=True)for mat in mat_list:
    sg_list = cmds.listConnections(type='shadingEngine')

    for sg in sg_list:
        member_list = cmds.sets(sg, q=True)
        if not member_list:
            continue

        for member in member_list:
            print member

​





On Mon, Aug 25, 2014 at 7:14 PM, johan Borgström <[email protected]>
wrote:

> 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
> <https://groups.google.com/d/msgid/python_inside_maya/355d3b26-4e3e-46ca-9344-691bf8cc5140%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAPGFgA1aPx%3DKHgy_DMR518tV7dYyhGoaAo47vn%2BDFwFeD%3DieqA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to