Maya retrieve blendshape name



Hello guys, is there a way, given the name of a mesh, to retrieve the name of the blendshape linket to it through Maya.cmds?


Definitely. Something like:

history = cmds.listHistory( mesh )
blendshapes = history, type = ‘blendShape’)

then you should be able to access the name with blendshapes[0].name()


The name is just in blendshape[0] without the name(), but except for this it works!
Thank you man!


Is this what you’re looking to do?

Get the Mesh

my_mesh =

Get the blendShape

my_history = cmds.listHistory(my_mesh)

my_blendShape_node = my_history, type=‘blendShape’)

Get the blend Shape Names

my_blendShape_names = cmds.listAttr( my_blendShape_node[0] + ‘.w’ , m=True )



What’s the difference between print just my_blendShape_node[0] and my_blandShape_names?


The difference is that he is getting the names of each blendshape weight in the blendshape node.

If you iterate over my_blendshape_node.w you’ll get weight[0], weight[1], weight[2]

But if you get the “alias” of the weights, you get “smile_left”, “smile_right”, “ooh”, “mmm”, etc.

In your original question, are you trying to get the name of the blendshape node, or the individual weights inside the blendshape?


The name of the blendshape node!


import pymel.core as pm
from maya import cmds

def getBlendShapeAttributeNames():
“”" Gets all the the attributes names on blendshape at each weight index
#the node var only has to list some blendshape. I have it listing all blendshapes in scene which you probably don’t want
node =‘blendShape’)
# returns tuple of weight attrs
blendAttrSize = cmds.getAttr(node[0]+’.weight’)

#loop over the attributes now and get their name info
for i in range(len(blendAttrSize[0])):
    attrName = node[0] + ".weight[" + str(i) + "]"
    print(cmds.aliasAttr(attrName, q=True))

def getTargetsFromSelection():
“”“This function will get the blendshape on selected and print out
the blendshape name,
the base shape name, and
all the targets at their weight index
selectedNode =
#I only have this getting history from first selected.
nodeHis = pm.listHistory(selectedNode[0])
objectBlendshape = []

#append blendshape to a list
for each in nodeHis:
	if (pm.nodeType(each) == 'blendShape'): 
print("Blendshape node name: {0}".format(objectBlendshape[0]))
#loop through number of blendshapes get the targets and base shape on blendshape 
for psds in objectBlendshape:
	targets = psds.getTarget()
	baseShape = psds.getBaseObjects()
	print("Base Shape: {0}".format(baseShape[0]))
	for i in range(len(targets)):
		print("Target Shape at Index {0}: {1}".format(str(i), targets[i]))

I am not entirely sure what you are asking for. However, I got a list of attrs from the blendshape and listed a bunch of other things that might be useful for blenshapes.


I want only the name of the blendshape, like “blendShape1”.
I’ve obtained it with the first solution:
history = cmds.listHistory( mesh )
blendshapes = history, type = ‘blendShape’)
print blendshapes[0]