If you pass in the full name to the shape node from the instance you are wishing to find the shading group of, you will get the correct shader returned.
import maya.cmds as cmds shapeNode = 'pSphere2|pSphereShape1' shadingGroup = cmds.listConnections(shapeNode + '.instObjGroups')[0] print shadingGroup On Fri, Jul 2, 2010 at 3:56 PM, Ling <[email protected]> wrote: > Hi guys: > > Normally when dealing with a non-instanced shape node, it's easy to > get its shading group assighnment like: > > shadingGroup = cmds.listConnections(shapeNode + '.instObjGroups[0]') > [0] > > > > but when it comes to instanced the shapde nodes, one shape node > might have several shader assignments. > > if I do a list connection to the instanced shape node, all the > shading groups assigned to it will be listed, and don't know which one > is assigned to a particular transform node's children shape node. > > so how can I query which shader is assign to a given transform node? > > > many thanks > > > -ling > > -- > http://groups.google.com/group/python_inside_maya -- http://groups.google.com/group/python_inside_maya
