PDA

View Full Version : MEL - get the name of blendShape targets


lordsme
10-09-2009, 02:15 PM
Hi everyone,
I'm trying to get via MEL the name of the targets of a blendShape node: I mean the array of strings corresponding to the names of targets, having the same size of the .weight attribute array of floats.
I don't have the real target objects in the scene anymore, they have been deleted. I just need in MEL the names, that I can see in the Channel Editor next to the weights...
Thank you!

Darksuit
10-09-2009, 09:53 PM
The Script editor will tell you the name of the targets of the Blend shapes

So if I create a Box with two Box Blend Shapes

Box (Original)
BoxA
BoxB

I make a blend shape called BoxBlend

then proceed to delete BoxA and BoxB

I can set the value of the Blend via MEL with the command

setAttr "BoxBlend.BoxA" #;
//where # is the float value that I want to use

I can do the same thing with BoxB by replacing the name BoxA with BoxB


if you are just attempting the Dynamically derive the name of the Blendshape from the weight attribute you can use the following command

listAttr -sn BoxBlend.weight[0]

just parse that into a string value
replace 0 with the value you need, remember that Blends start numbering with 0

Mark-J
10-12-2009, 08:24 AM
If you already know the blendshape node that you're querying use the :

string $temp[] = `aliasAttr -q $BlendShape`;

This returns you a list in the form "targetName","weight[x]", then you've just got to process the list to either get the target names of weights

Mark

lordsme
10-12-2009, 08:46 AM
It works, thank you!

jaydru
10-12-2009, 10:59 AM
or you can use on the blend shape node

$blendShapes = "blendShape1";
listAttr -m ($blendShape + ".w");

returns the names of the transform nodes used to make the blend shapes

CGTalk Moderation
10-12-2009, 10:59 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.