MEL: a script for creating handCtrl's ?



I would like to know if there is a script that can create attributes for the hand?

Say that you have to rig about 10 characters, and on every hand you want to have about 5 attributes (fist, grab and so on)
This would add up to 100 attributes and say that it takes about 2minits for every setup. That’s 200 minutes, 3,3 hours of repeatedly waste of time:-)))

So could some MEL geniuses tell me how to create a script that creates this for me?
I guess you would be forced to great some kind of menu to state what kind of hand you have, four or five fingers and so on!!

I have been trying to create this but I’m not that good at MEL…




pretty simple to add the attributes really… you can do something like this:

// create an array of control names
string $names[] = { "fist", "grab", flipOff", "point" };

// get the selected objects
string $objs[0];
$objs = `ls -sl`;

// looop through the selected objects and add the attributes
for ($ob in $objs)
	for ($attr in $names)
		addAttr -longName $attr -at double $ob;
		setAttr -k 1 ($ob + "." + $attr);


Great works like a charm but:-)) (always a but:-)

I would like it to actually create the setDrivenKey animations on the fist, grab and so on!!

That’s what I meant with the need for some kind of UI to determine the hands construction and then I have to figure out a way to make MEL understand which bone hierarchy is the thumb or pinky:-))

I’m lost…:frowning:



ah ,can’t you do it based on name? if you have a consistent naming scheme, you should be able to do something like:

$children = listRelatives -c $handJoint;
string $child;
for ($child in $children)
// thumb
if (gmatch $child "*thumb*")
// do thumb stuff



Hi, I don’t know that much about mel script, but if you have a consistent naming scheme for your joints, like Mr.schleifer said, then you can make hand controls with Set driven keys, and then copy and paste from the script editor to the tool bar, and Viola! Instant Mel script, will work on any scene if you have the joints named the same. Saves alot of repetitive work, no sense in re-inventing the wheel :wink:


It works perfectly.
But I’m a bit allergic to repetitive tasks so I will make a naming script:-))

Laziness is the mother of inventions :-))




hey jason,

i’m able to add attribs to an object no prob, but i can’t get it to show up in the channel box. it shows up in the attrib editor, but i usually like to animate from the channel box. any hints?

here’s my script:

addAttr -ln ThumbCurl -at double -min -1 -max 1 -dv 0 l_hnd_cntrlr;
setAttr -e -keyable true l_hnd_cntrlr.ThumbCurl;


hmm… setting it keyable usually puts the attribute in the channel box… are you sure it’s not there?


talk about service with a smile :slight_smile: that was quick. yah, i clicked on and off the object and it wasn’t there. it does show up in the attrib editor under extra attributes though. didn’t know if i was missing a step or anything. thanks for the help.

(and you’re siggraph lecture rocked by the way :xtreme: )


It works fine for me!!



i’ll try it on a diff file later on. must…keep…rigging…



damn oke this goes above my head… really great do… but im using max… rigging my character soon … but im not good at it yet,but whats up with the scripts and so on… dont know… could someone teach mee or something caus i really want to learn it all the right way…

could someone help mee…


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.