LC #42 Pipers Alley

View Full Version : [Python]remove blendShape's targets

12-10-2010, 09:06 AM
hi guys.

I've a question regarding the blendShape.

I try to remove some of my blendshape's targets but it doesn't seems to work.
I tried it like this:

cnt = cmds.blendShape('blendShape1',query=True,wc=True) tmpList = []
for i in range(cnt):
ttList =[]
print tmpList
for b in tmpList:

any ideas?

12-28-2010, 11:37 AM
this should work, you only need to have original target shapes. If you dont, create temporary shapes with same name and connect them to blendshape node.

# to get targets
blendTargets = cmds.listAttr (blendShapeNode + '.w', m = True)
# to get object influenced by blendShape
history = cmds.listHistory (blendShapeNode, f=True, lf = True)
shape = (history, type = ('mesh','nurbsSurface','nurbsCurve'))
object = cmds.listRelatives (shape, fullPath = True, parent = True, type = 'transform')[0]
for i in range(len(blendTargets)):
cmds.blendShape (blendShapeNode, edit=True, remove = True, t=(object, i, blendTargets[i], 1.0) )

CGTalk Moderation
12-28-2010, 11:37 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.