/* Name: acFingerCurl.mel Author: Allen Curtis Date: October 2008 Description: A quick Set Driven Key setup of fingers and thumb rotation. Select a locator, 12 finger joints, and 3 thumb joints. (It is important to select thumb joints last.) Run script. New curl attribute of locator drives rotation of fingers. Use sliders in locator attribute editor to move fingers. */ global proc acFingerCurl(){ string $getSelected[] =`ls -sl -fl`; string $command[]; //Add curl attribute to selected locator. addAttr -ln fingerCurl1 -at double -min 0 -max 10 $getSelected[0]; addAttr -ln fingerCurl2 -at double -min 0 -max 10 $getSelected[0]; addAttr -ln fingerCurl3 -at double -min 0 -max 10 $getSelected[0]; addAttr -ln fingerCurl4 -at double -min 0 -max 10 $getSelected[0]; string $attrCurl1 = $getSelected[0] + ".fingerCurl1"; $command = `setAttr -e -keyable true $attrCurl1`; string $attrCurl2 = $getSelected[0] + ".fingerCurl2"; $command = `setAttr -e -keyable true $attrCurl2`; string $attrCurl3 = $getSelected[0] + ".fingerCurl3"; $command = `setAttr -e -keyable true $attrCurl1`; string $attrCurl4 = $getSelected[0] + ".fingerCurl4"; $command = `setAttr -e -keyable true $attrCurl4`; //Finger joints rotation attribute. string $attrRot1 = $getSelected[1] + ".rotateZ"; string $attrRot2 = $getSelected[2] + ".rotateZ"; string $attrRot3 = $getSelected[3] + ".rotateZ"; string $attrRot4 = $getSelected[4] + ".rotateZ"; string $attrRot5 = $getSelected[5] + ".rotateZ"; string $attrRot6 = $getSelected[6] + ".rotateZ"; string $attrRot7 = $getSelected[7] + ".rotateZ"; string $attrRot8 = $getSelected[8] + ".rotateZ"; string $attrRot9 = $getSelected[9] + ".rotateZ"; string $attrRot10 = $getSelected[10] + ".rotateZ"; string $attrRot11 = $getSelected[11] + ".rotateZ"; string $attrRot12 = $getSelected[12] + ".rotateZ"; //Set attributes. $command = `setAttr $attrCurl1 0`; $command = `setAttr $attrCurl2 0`; $command = `setAttr $attrCurl3 0`; $command = `setAttr $attrCurl4 0`; $command = `setAttr $attrRot1 0`; $command = `setAttr $attrRot2 0`; $command = `setAttr $attrRot3 0`; $command = `setAttr $attrRot4 0`; $command = `setAttr $attrRot5 0`; $command = `setAttr $attrRot6 0`; $command = `setAttr $attrRot7 0`; $command = `setAttr $attrRot8 0`; $command = `setAttr $attrRot9 0`; $command = `setAttr $attrRot10 0`; $command = `setAttr $attrRot11 0`; $command = `setAttr $attrRot12 0`; //Set driven key. //Curl attribute of locator drives rotation attribute of fingers. int $setDriven = `setDrivenKeyframe -cd $attrCurl1 $attrRot1`; $setDriven = `setDrivenKeyframe -cd $attrCurl1 $attrRot2`; $setDriven = `setDrivenKeyframe -cd $attrCurl1 $attrRot3`; $setDriven = `setDrivenKeyframe -cd $attrCurl2 $attrRot4`; $setDriven = `setDrivenKeyframe -cd $attrCurl2 $attrRot5`; $setDriven = `setDrivenKeyframe -cd $attrCurl2 $attrRot6`; $setDriven = `setDrivenKeyframe -cd $attrCurl3 $attrRot7`; $setDriven = `setDrivenKeyframe -cd $attrCurl3 $attrRot8`; $setDriven = `setDrivenKeyframe -cd $attrCurl3 $attrRot9`; $setDriven = `setDrivenKeyframe -cd $attrCurl4 $attrRot10`; $setDriven = `setDrivenKeyframe -cd $attrCurl4 $attrRot11`; $setDriven = `setDrivenKeyframe -cd $attrCurl4 $attrRot12`; //Set curl attributes. $command = `setAttr $attrCurl1 10`; $command = `setAttr $attrCurl2 10`; $command = `setAttr $attrCurl3 10`; $command = `setAttr $attrCurl4 10`; //Set rotation attributes. Edit these settings to get desired results. $command = `setAttr $attrRot1 -85`; $command = `setAttr $attrRot2 -105`; $command = `setAttr $attrRot3 -75`; $command = `setAttr $attrRot4 -85`; $command = `setAttr $attrRot5 -105`; $command = `setAttr $attrRot6 -75`; $command = `setAttr $attrRot7 -85`; $command = `setAttr $attrRot8 -105`; $command = `setAttr $attrRot9 -75`; $command = `setAttr $attrRot10 -85`; $command = `setAttr $attrRot11 -105`; $command = `setAttr $attrRot12 -75`; //Set driven key. $setDriven = `setDrivenKeyframe -cd $attrCurl1 $attrRot1`; $setDriven = `setDrivenKeyframe -cd $attrCurl1 $attrRot2`; $setDriven = `setDrivenKeyframe -cd $attrCurl1 $attrRot3`; $setDriven = `setDrivenKeyframe -cd $attrCurl2 $attrRot4`; $setDriven = `setDrivenKeyframe -cd $attrCurl2 $attrRot5`; $setDriven = `setDrivenKeyframe -cd $attrCurl2 $attrRot6`; $setDriven = `setDrivenKeyframe -cd $attrCurl3 $attrRot7`; $setDriven = `setDrivenKeyframe -cd $attrCurl3 $attrRot8`; $setDriven = `setDrivenKeyframe -cd $attrCurl3 $attrRot9`; $setDriven = `setDrivenKeyframe -cd $attrCurl4 $attrRot10`; $setDriven = `setDrivenKeyframe -cd $attrCurl4 $attrRot11`; $setDriven = `setDrivenKeyframe -cd $attrCurl4 $attrRot12`; //Thumb rotation. //The thumb settings work with xyz joint orientation and local rotation axis //pointing the X-axis toward child joints. //If your Orient Joint settings are different, then this section //will require different settings. addAttr -ln thumbCurl -at double -min 0 -max 10 $getSelected[0]; string $attrThumbCurl = $getSelected[0] + ".thumbCurl"; $command = `setAttr -e -keyable true $attrThumbCurl`; string $attrRot13 = $getSelected[13] + ".rotateY"; string $attrRot14 = $getSelected[14] + ".rotateY"; string $attrRot15 = $getSelected[15] + ".rotateZ"; //2nd axis rotation for top thumb joint. string $attrRot16 = $getSelected[15] + ".rotateY"; $command = `setAttr $attrThumbCurl 0`; $command = `setAttr $attrRot13 0`; $command = `setAttr $attrRot14 0`; $command = `setAttr $attrRot15 0`; $command = `setAttr $attrRot16 0`; $setDriven = `setDrivenKeyframe -cd $attrThumbCurl $attrRot13`; $setDriven = `setDrivenKeyframe -cd $attrThumbCurl $attrRot14`; $setDriven = `setDrivenKeyframe -cd $attrThumbCurl $attrRot15`; $setDriven = `setDrivenKeyframe -cd $attrThumbCurl $attrRot16`; //Set curl and thumb rotation attributes. //Edit rotation settings here to get satisfactory results. $command = `setAttr $attrThumbCurl 10`; $command = `setAttr $attrRot13 50`; $command = `setAttr $attrRot14 25`; $command = `setAttr $attrRot15 -60`; $command = `setAttr $attrRot16 20`; $setDriven = `setDrivenKeyframe -cd $attrThumbCurl $attrRot13`; $setDriven = `setDrivenKeyframe -cd $attrThumbCurl $attrRot14`; $setDriven = `setDrivenKeyframe -cd $attrThumbCurl $attrRot15`; $setDriven = `setDrivenKeyframe -cd $attrThumbCurl $attrRot16`; }