Monday, January 28, 2013

Changing the name of a blendshape attribute

Have you ever created a blendshape in Maya, and wished you could update the names of the blendshape attributes to be something more intuitive or descriptive than the shape that created the attribute?

Well it's not as painful as you may think.


//name of your blendshape node
string $blendShapeNode = "blendShape1";

//the new name you want for attribute
string $attributeName = "blend0";
//This give you all the blendshapes and which weight slot they are going into
//Not necessary to run, but if you have more than one blendshape attribute, it's helpful to know which one you want to update
string $name[] = `aliasAttr -q $blendShapeNode`; 
//This will update the name of the blenshape for the first weight[0] attribute
aliasAttr  $attributeName ($blendShapeNode + ".weight[0]");

You may need to refresh your attribute editor to see the change, but it should go from something like this:



 

to something like this: