MEL: a script for creating handCtrl's ?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Search this Thread Display Modes
Old 11 November 2002   #1
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..

Old 11 November 2002   #2

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);

jason schleifer
Animator -
Co-Founder -
Old 11 November 2002   #3
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....:-(

Old 11 November 2002   #4
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

jason schleifer
Animator -
Co-Founder -
Old 11 November 2002   #5
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
*Insert pretentious quote here*
Old 11 November 2002   #6
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 :-))


Old 11 November 2002   #7
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;
Old 11 November 2002   #8
hmm.. setting it keyable usually puts the attribute in the channel box.. are you sure it's not there?
jason schleifer
Animator -
Co-Founder -
Old 11 November 2002   #9
talk about service with a 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: )
Old 11 November 2002   #10
It works fine for me!!

Old 11 November 2002   #11
i'll try it on a diff file later on. must.......keep.......rigging...........

Old 11 November 2002   #12

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..
Old 01 January 2006   #13
Thread automatically closed

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.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 04:16 AM.

Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.