PDA

View Full Version : MEL: a script for creating handCtrl's ?


pigbelly
11-17-2002, 10:46 PM
Hi,

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

Example:
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..

Thanks
/Tommie

jschleifer
11-17-2002, 11:20 PM
Heya,

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

pigbelly
11-19-2002, 01:10 PM
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....:-(

/Tommie

jschleifer
11-19-2002, 04:59 PM
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
}
}


??

Ckerr812
11-19-2002, 08:08 PM
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 ;)

pigbelly
11-19-2002, 08:13 PM
Super!!
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 :-))

Thanks!!

/Tommie
www.pigbelly.com
tommie@pigbelly.com

MosaFacku
11-20-2002, 06:11 AM
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;

jschleifer
11-20-2002, 06:22 AM
hmm.. setting it keyable usually puts the attribute in the channel box.. are you sure it's not there?

MosaFacku
11-20-2002, 06:32 AM
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: )

pigbelly
11-20-2002, 06:42 AM
It works fine for me!!

/Tommie

MosaFacku
11-20-2002, 06:45 AM
i'll try it on a diff file later on. must.......keep.......rigging...........

:surprised

ivo D
11-26-2002, 09:20 AM
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..

CGTalk Moderation
01-13-2006, 09:00 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.