m.listConnections() will list all connections (inputs and outputs). better use m.outputs() so you check only outgoing connections (implying this shape is indeed contributing to a deformation chain). Input connections can exist even when the shape isn't used in a deformation chain (such as connections to a poly-creation node, a layer, for example)
- Ofer www.mrbroken.com On Wed, Nov 17, 2010 at 8:43 PM, Christian Akesson <[email protected]> wrote: > Not sure if it is overkill to do both, but this seems to do that trick and > get rid of what you want to get rid of regardless if the mesh is deformed or > not... > for m in meshes: > if not m.isReferenced(): > shapes = m.getShapes() > for s in shapes: > if s.intermediateObject.get(): > if not s.listConnections(): > delete(s) > rename(m.getShape(), '%sShape' % m.name()) > /Christian > > > On Wed, Nov 17, 2010 at 9:18 AM, Christian Akesson <[email protected]> > wrote: >> >> Gotcha, I misread your original post. Thanks! >> /Christian >> >> >> On Wed, Nov 17, 2010 at 8:07 AM, Viktoras <[email protected]> wrote: >>> >>> On 2010.11.17 18:04, Christian Akesson wrote: >>> >>> Viktoras: >>> I want to remove the intermediate shape nodes, but only if the mesh is >>> not being deformed by any deformer in which case those are needed >>> (meshNameShapeOrig, sometimes meshNameShapeDeformed when referenced). These >>> intermediate shapes are sometimes retained on the mesh when duplicating or >>> delete history to get rid of deformers. They cause some issues in our >>> pipeline.... >>> >>> that's exactly what i said. if you list outgoing connections from a >>> shape, which is marked as intermediate, and it does not connect anywhere >>> (usually garbage shapes won't at all) - you can delete it. >>> >>> -- >>> http://groups.google.com/group/python_inside_maya >> > > -- > http://groups.google.com/group/python_inside_maya > -- http://groups.google.com/group/python_inside_maya
