This question is slightly off topic, but still related. When a shape from a referenced file is instanced a bunch of groupid nodes are created relating to the shading network, and it is possible to assign new materials to this instance. I am wondering if there is a way to prevent the creation of these groupid nodes and all of the related edits. We have a usage case wherein we know that we will never need or want to modify the materials of one of these "library" shapes. We have some cleanup code that removes all of these edits, but I would much rather find a more elegant solution.
thanks, -Judah On Fri, Jul 2, 2010 at 11:00 PM, John Creson <[email protected]> wrote: > 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 > -- http://groups.google.com/group/python_inside_maya
