Created
November 18, 2017 13:42
-
-
Save JustinPedersen/0f14246bfa7f0129c53635a1bf45448d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Sheep's Advanced Auto Limb v1 | |
Developed by Justin Pedersen | |
mail: justin@tcgcape.co.za | |
05/19/2017 | |
5:35 PM | |
*/ | |
string $Ver = "v1"; | |
string $WinName = ("AutoLimb_" + $Ver); | |
if (`window -exists ("AutoLimb_" + $Ver)`) | |
deleteUI ("AutoLimb_" + $Ver); | |
window -title ("AutoLimb." + $Ver) -rtf true ("AutoLimb_" + $Ver); | |
frameLayout -w 200-h 195 ("Sheep's Auto Limb " + $Ver); | |
rowColumnLayout -nc 1 -cw 1 200; | |
//all UI sits in here//////////////////////// | |
tabLayout tabList; | |
//begin contents of first tab/////////////// | |
string $tab1 = `columnLayout -w 200 -h 210 firstTab`; | |
//create frame for first tab contents/////// | |
frameLayout -w 200 Creation_Prefs_Arm; | |
//create layout for new frame/////////////// | |
rowColumnLayout -nc 1 -cw 1 190; | |
rowColumnLayout -numberOfRows 1 ; | |
checkBox -label "IK/FK" Arm_IKFK_Check; | |
checkBox -label "Hand" Arm_Hand_Check; | |
setParent ..; | |
separator; | |
optionMenu -label "Rotate Order" ArmRoo; | |
menuItem -label "Choose" -en 0; | |
menuItem -label "xyz"; | |
menuItem -label "yzx"; | |
menuItem -label "zxy"; | |
menuItem -label "xzy"; | |
menuItem -label "yxz"; | |
menuItem -label "zyx"; | |
separator -height 4 -style "out"; | |
button -label "CREATE LOCS" -c ArmCreateLOCS CreateArmLocs; | |
separator -height 4 -style "out"; | |
button -label "CREATE ARM" -c CreateArm CreateArm; | |
separator -height 4 -style "out"; | |
rowColumnLayout -numberOfRows 1; | |
button -l "Mirror" -w 95 -c MirrorArmSetup; | |
button -l "Delete Setup" -w 95 -c DeleteSetupArm; | |
separator -height 4 -style "out"; | |
setParent..; | |
setParent..; | |
setParent..; | |
setParent..; | |
//begin contents of second tab////////////// | |
string $tab2 = `columnLayout -w 200 -h 240 secondTab`; | |
frameLayout -w 200 Creation_Prefs_Leg; | |
rowColumnLayout -nc 1 -cw 1 190; | |
rowColumnLayout -numberOfRows 1 ; | |
checkBox -label "IK/FK" Leg_IKFK_Check; | |
checkBox -label "Foot" Leg_Foot_Check; | |
setParent ..; | |
separator; | |
optionMenu -label "Rotate Order" LegRoo; | |
menuItem -label "Choose" -en 0; | |
menuItem -label "xyz"; | |
menuItem -label "yzx"; | |
menuItem -label "zxy"; | |
menuItem -label "xzy"; | |
menuItem -label "yxz"; | |
menuItem -label "zyx"; | |
separator -height 4 -style "out"; | |
button -label "CREATE LOCS" -c LegCreateLOCS CreateLegLocs; | |
separator -height 4 -style "out"; | |
button -label "CREATE LEG" -c CreateLeg CreateLeg; | |
separator -height 4 -style "out"; | |
rowColumnLayout -numberOfRows 1; | |
button -l "Mirror" -w 95 -c MirrorLegSetup; | |
button -l "Delete Setup" -w 95 -c DeleteSetupLeg; | |
setParent..; | |
//return to masterLayout//////////////////// | |
setParent..; | |
//label tabs and build////////////////// | |
tabLayout -edit | |
-tabLabel $tab1 "Arm" | |
-tabLabel $tab2 "Leg" | |
tabList; | |
showWindow $WinName; | |
// Arm PROCs | |
proc ArmCreateLOCS(){ | |
string $LR = "L_"; | |
string $LocNameShoulder = ($LR + "arm_IK_Shoulder_LOC"); | |
string $LocNameElbow = ($LR + "arm_IK_Elbow_LOC"); | |
string $LocNameWrist = ($LR + "arm_IK_Wrist_LOC"); | |
string $CTRLdistLocName = ($LR + "arm_CTRLdist_LOC"); | |
string $SoftBlendLocName = ($LR + "arm_softBlend_LOC"); | |
if( `objExists $LocNameShoulder` ){ | |
warning "Locators Already Created"; | |
} else { | |
select -cl ; | |
spaceLocator -n $LocNameShoulder -p 0 0 0; | |
xform -t 20 60 0; | |
spaceLocator -n $LocNameElbow -p 0 0 0; | |
xform -t 40 60 -5; | |
spaceLocator -n $LocNameWrist -p 0 0 0; | |
xform -t 60 60 0; | |
select -r $LocNameShoulder; | |
select -add $LocNameElbow; | |
select -add $LocNameWrist; | |
string $BoneLocs[]=`ls -sl`; | |
int $amount=`size($BoneLocs)`; | |
for ($n=0; $n<$amount; $n++) { | |
setAttr ($BoneLocs[$n] + ".localScaleX") 5; | |
setAttr ($BoneLocs[$n] + ".localScaleY") 5; | |
setAttr ($BoneLocs[$n] + ".localScaleZ") 5; | |
setAttr ($BoneLocs[$n] + ".overrideEnabled") 1; | |
setAttr ($BoneLocs[$n] + ".overrideColor") 17; | |
} | |
} | |
} | |
proc CreateArm(){ | |
string $AllRoo[] = {"xyz", "xyz", "yzx", "zxy", "xzy", "yxz", "zyx" }; | |
int $A_RooIndex = `optionMenu -q -sl ArmRoo`; | |
string $LR = "L_"; | |
string $LocNameShoulder = ($LR + "arm_IK_Shoulder_LOC"); | |
string $LocNameElbow = ($LR + "arm_IK_Elbow_LOC"); | |
string $LocNameWrist = ($LR + "arm_IK_Wrist_LOC"); | |
string $CTRLdistLocName = ($LR + "arm_CTRLdist_LOC"); | |
string $SoftBlendLocName = ($LR + "arm_softBlend_LOC"); | |
// Joint Sting names | |
string $JT1 = ($LR + "arm_IK_Shoulder_01"); | |
string $JT2 = ($LR + "arm_IK_Elbow_01"); | |
string $JT3 = ($LR + "arm_IK_Wrist_01"); | |
// Attrib Naming Strings | |
string $SlideName = ($LR + "arm_slideP"); | |
string $StretchName = ($LR + "arm_stretchP"); | |
string $SoftName = ($LR + "arm_softP"); | |
string $PinName = ($LR + "arm_pinP"); | |
// Misc String Names | |
string $ArmCtrl = ($LR + "arm_IK_CTRL"); | |
string $ElbowCtrl = ($LR + "elbow_IK_CTRL"); | |
string $L_RootName = "L_arm_Root"; | |
// Distance tool Name strings (-DT distance tool) | |
string $ControlDistDT = ($LR + "arm_controlDist"); | |
string $SoftDistDT = ($LR + "arm_softDist"); | |
string $ShoulderDistDT = ($LR + "arm_shoulderDist"); | |
string $ElbowDistDT = ($LR + "arm_elbowDist"); | |
string $StretchDistDT = ($LR + "arm_stretchDist"); | |
// Node Name Strings | |
//Cnd Nodes | |
string $Cnd1 = ($LR + "arm_Cond1"); | |
string $Cnd2 = ($LR + "arm_Cond2"); | |
// Pin CND Nodes | |
string $Cnd3 = ($LR + "arm_Cond3"); | |
string $Cnd4 = ($LR + "arm_Cond4"); | |
// Slide CND Node | |
string $Cnd5 = ($LR + "arm_Cond5"); | |
string $Cnd6 = ($LR + "arm_Cond6"); | |
//PMA nodes | |
string $PMA1 = ($LR + "arm_PMA1"); | |
string $PMA2 = ($LR + "arm_PMA2"); | |
string $PMA3 = ($LR + "arm_PMA3"); | |
// Pma nodes for Stretch soft IK | |
string $PMA4 = ($LR + "arm_PMA4"); | |
string $PMA5 = ($LR + "arm_PMA5"); | |
// Pma nodes for Slide | |
string $PMA6 = ($LR + "arm_PMA6"); | |
string $PMA7 = ($LR + "arm_PMA7"); | |
string $PMA8 = ($LR + "arm_PMA8"); | |
string $PMA9 = ($LR + "arm_PMA9"); | |
//Multiply Divide Nodes | |
string $MD1 = ($LR + "arm_MD1"); | |
string $MD2 = ($LR + "arm_MD2"); | |
string $MD3 = ($LR + "arm_MD3"); | |
string $MD4 = ($LR + "arm_MD4"); | |
string $MD5 = ($LR + "arm_MD5"); | |
string $MD6 = ($LR + "arm_MD6"); | |
//Multiply Divide Nodes for Stretch Soft IK | |
string $MD7 = ($LR + "arm_MD7"); | |
string $MD8 = ($LR + "arm_MD8"); | |
string $MD9 = ($LR + "arm_MD9"); | |
string $MD10 = ($LR + "arm_MD10"); | |
string $MD11 = ($LR + "arm_MD11"); | |
string $MD12 = ($LR + "arm_MD12"); | |
// Special MD nodes for stretch | |
string $MD13 = ($LR + "arm_MD_ShoulderByChainLen"); | |
string $MD14 = ($LR + "arm_MD_ElbowByChainLen"); | |
// Pin MD nodes | |
string $MD15 = ($LR + "arm_MD15"); | |
string $MD16 = ($LR + "arm_MD16"); | |
// Slide MD nodes | |
string $MD17 = ($LR + "arm_MD17"); | |
string $MD18 = ($LR + "arm_MD18"); | |
string $MD19 = ($LR + "arm_MD19"); | |
string $MD20 = ($LR + "arm_MD20"); | |
string $MD21 = ($LR + "arm_MD21"); | |
// Pin Blend ATTR nodes | |
string $B2A1 = ($LR + "arm_BL2Atr01"); | |
string $B2A2 = ($LR + "arm_BL2Atr02"); | |
// creation of joins on locators | |
// Bound Arm names | |
string $Bn1 = ($LR + "arm_Bound_Shoulder_01"); | |
string $Bn2 = ($LR + "arm_Bound_Elbow_01"); | |
string $Bn3 = ($LR + "arm_Bound_Wrist_01"); | |
// FK Arm names | |
string $FK1 = ($LR + "arm_FK_Shoulder_01"); | |
string $FK2 = ($LR + "arm_FK_Elbow_01"); | |
string $FK3 = ($LR + "arm_FK_Wrist_01"); | |
if ( `objExists $L_RootName`){ | |
warning "Arm has already been created"; | |
}else{ | |
if ( `objExists $LocNameShoulder`){ | |
select -r $LocNameShoulder; | |
select -add $LocNameElbow; | |
select -add $LocNameWrist; | |
string $BoneLocs[]=`ls -sl`; | |
int $amount=`size($BoneLocs)`; | |
for ($n=0; $n<$amount; $n++) { | |
setAttr ($BoneLocs[$n] + ".overrideEnabled") 0; | |
} | |
select -cl ; | |
float $Loc1[] = `xform -worldSpace -q -translation $LocNameShoulder`; | |
float $Loc2[] = `xform -worldSpace -q -translation $LocNameElbow`; | |
float $Loc3[] = `xform -worldSpace -q -translation $LocNameWrist`; | |
joint -p $Loc1[0] $Loc1[1] $Loc1[2] ; | |
joint -p $Loc2[0] $Loc2[1] $Loc2[2] ; | |
joint -e -zso -oj xyz -sao yup joint1; | |
joint -p $Loc3[0] $Loc3[1] $Loc3[2] ; | |
joint -e -zso -oj xyz -sao yup joint2; | |
rename "joint1" $JT1; | |
rename "joint2" $JT2; | |
rename "joint3" $JT3; | |
//Setting the Joint Roo according to the user defined box | |
xform -roo $AllRoo[$A_RooIndex-1] $JT1; | |
xform -roo $AllRoo[$A_RooIndex-1] $JT2; | |
xform -roo $AllRoo[$A_RooIndex-1] $JT3; | |
////////////////////////////////////////////////////////////////////// | |
// Creating the Arm Control | |
circle -c 0 0 0 -nr 0 1 0 -sw 360 -r 4 -d 3 -ut 0 -tol 0.01 -s 8 -ch 0 -n $ArmCtrl; | |
// adding atributes to the Arm CTRL | |
addAttr -ln "Ik_Controls" -at double -dv 0 -k true; | |
setAttr -lock true ($ArmCtrl + ".Ik_Controls"); | |
addAttr -ln $SlideName -nn "Slide" -at double -max 1 -min -1 -dv 0 -k true; | |
addAttr -ln $StretchName -nn "Stretch" -at double -max 1 -min 0 -dv 0 -k true; | |
addAttr -ln $SoftName -nn "Soft" -at double -max 1 -min 0 -dv 0 -k true; | |
addAttr -ln $PinName -nn "Pin" -at double -max 1 -min 0 -dv 0 -k true; | |
xform -ro 0 0 -90 $ArmCtrl; | |
setAttr ($ArmCtrl + ".overrideEnabled") 1; | |
setAttr ($ArmCtrl + ".overrideColor") 18; | |
// creating wrist control dist Loc | |
spaceLocator -n $CTRLdistLocName -p 0 0 0; | |
parent ($LR + "arm_CTRLdist_LOC") $ArmCtrl; | |
spaceLocator -n $SoftBlendLocName -p 0 0 0; | |
parent ($LR + "arm_softBlend_LOC") $ArmCtrl; | |
// moving CTRL to wrist | |
select -r $LocNameWrist; | |
select -add $ArmCtrl; | |
pointConstraint -offset 0 0 0 -n CTRLtoWristConst; | |
select -r CTRLtoWristConst; | |
doDelete; | |
makeIdentity -apply true -t 1 -r 1 -s 1 -n 0 -pn 1 $ArmCtrl; | |
////////////////////////////////////////////////////////////////////// | |
// create Root node | |
group -em -n $L_RootName; | |
connectAttr -f ($L_RootName + ".scaleX") ($L_RootName + ".scaleY"); | |
connectAttr -f ($L_RootName + ".scaleX") ($L_RootName + ".scaleZ"); | |
setAttr -lock true -keyable false -channelBox false ($L_RootName + ".sy"); | |
setAttr -lock true -keyable false -channelBox false ($L_RootName + ".sz"); | |
////////////////////////////////////////////////////////////////////// | |
// Parenting all the things | |
parent $JT1 $LocNameShoulder; | |
parent $LocNameWrist $LocNameShoulder; | |
parent $LocNameShoulder $L_RootName; | |
parent $LocNameElbow $L_RootName; | |
parent $SoftBlendLocName $L_RootName; | |
parent $ArmCtrl $L_RootName; | |
////////////////////////////////////////////////////////////////////// | |
ikHandle -n ($LR + "arm_IK") -sj $JT1 -ee $JT3; | |
poleVectorConstraint $LocNameElbow ($LR + "arm_IK"); | |
parent ($LR + "arm_IK") $SoftBlendLocName; | |
// aim constrain the Shoulder loc to the Hand CTRL | |
// aim for Left hand side | |
aimConstraint -mo -weight 1 -aimVector 1 0 0 -upVector 0 1 0 -worldUpType "objectrotation" -worldUpVector 0 1 0 -worldUpObject $L_RootName $ArmCtrl $LocNameShoulder; | |
// aim for Right hand mirrored side | |
// creation of distance tools | |
distanceDimension -sp 0 0 -100 -ep 50 0 -100 ; | |
distanceDimension -sp 0 0 -90 -ep 50 0 -90 ; | |
distanceDimension -sp 0 0 -80 -ep 50 0 -80 ; | |
distanceDimension -sp 0 0 -70 -ep 50 0 -70 ; | |
distanceDimension -sp 0 0 -60 -ep 50 0 -60 ; | |
rename "distanceDimension1" $ControlDistDT; | |
rename "distanceDimension2" $SoftDistDT; | |
rename "distanceDimension3" $ShoulderDistDT; | |
rename "distanceDimension4" $ElbowDistDT; | |
rename "distanceDimension5" $StretchDistDT; | |
connectAttr -f ($LocNameShoulder + ".worldPosition[0]")($ControlDistDT + "Shape.startPoint"); | |
connectAttr -f ($CTRLdistLocName + ".worldPosition[0]")($ControlDistDT + "Shape.endPoint"); | |
connectAttr -f ($LocNameWrist + ".worldPosition[0]")($SoftDistDT + "Shape.startPoint"); | |
connectAttr -f ($SoftBlendLocName + ".worldPosition[0]")($SoftDistDT + "Shape.endPoint"); | |
connectAttr -f ($LocNameShoulder + ".worldPosition[0]")($ShoulderDistDT + "Shape.startPoint"); | |
connectAttr -f ($LocNameElbow + ".worldPosition[0]")($ShoulderDistDT + "Shape.endPoint"); | |
connectAttr -f ($LocNameElbow + ".worldPosition[0]")($ElbowDistDT + "Shape.startPoint"); | |
connectAttr -f ($SoftBlendLocName + ".worldPosition[0]")($ElbowDistDT + "Shape.endPoint"); | |
connectAttr -f ($LocNameShoulder + ".worldPosition[0]")($StretchDistDT + "Shape.startPoint"); | |
connectAttr -f ($SoftBlendLocName + ".worldPosition[0]")($StretchDistDT + "Shape.endPoint"); | |
// This will cause problems if any of these are already in the scene. | |
select -r locator1 locator2 locator3 locator4 locator5 locator6 locator7 locator8 locator9 locator10 ; | |
doDelete; | |
select -r $ControlDistDT $SoftDistDT $ShoulderDistDT $ElbowDistDT $StretchDistDT; | |
group -n ($LR + "arm_DistTools_GRP"); | |
parent ($LR + "arm_DistTools_GRP") $L_RootName; | |
setAttr ($LR + "arm_DistTools_GRP" + ".visibility") 0; | |
////////////////////////////////////////////////////////////////////// | |
// finding the chain length | |
float $ShoulderDist = `getAttr ($ShoulderDistDT + "Shape.distance")`; | |
float $ElbowDist = `getAttr ($ElbowDistDT + "Shape.distance")`; | |
float $ChainLength = ($ShoulderDist + $ElbowDist); | |
//print $ChainLength; | |
// Creating all the nodes | |
/* | |
Normalising the Root Scale And working that into the node network. | |
*/ | |
// Create the Fith Multiply Divide Node | |
shadingNode -asUtility multiplyDivide -n $MD5; | |
setAttr ($MD5 + ".operation") 2; | |
setAttr ($MD5 + ".input1X") 1; | |
connectAttr -f ($L_RootName + ".scaleX") ($MD5 + ".input2X"); | |
// Create the Sixth Multiply Divide Node | |
shadingNode -asUtility multiplyDivide -n $MD6; | |
setAttr ($MD6 + ".operation") 1; | |
connectAttr -f ($MD5 + ".outputX") ($MD6 + ".input2X"); | |
connectAttr -f ($ControlDistDT + "Shape.distance") ($MD6 + ".input1X"); | |
////////////////////////////////////////////////////////////////////// | |
// create the First condition node | |
createNode condition -n $Cnd1; | |
setAttr ($Cnd1 + ".operation") 2; | |
connectAttr -f ($MD6 + ".outputX")($Cnd1 + ".firstTerm"); | |
// create the First plusMinusAverage node | |
shadingNode -asUtility plusMinusAverage -n $PMA1; | |
setAttr ($PMA1 + ".operation") 2; | |
setAttr ($PMA1 + ".input1D[0]") $ChainLength; | |
connectAttr -f ($ArmCtrl + "." + $SoftName) ($PMA1 + ".input1D[1]"); | |
connectAttr -f ($PMA1 + ".output1D") ($Cnd1 + ".secondTerm"); | |
connectAttr -f ($MD6 + ".outputX")($Cnd1 + ".colorIfFalseR"); | |
// create the Second condition node | |
createNode condition -n $Cnd2; | |
setAttr ($Cnd2 + ".operation") 2; | |
connectAttr -f ($ArmCtrl + "." + $SoftName) ($Cnd2 + ".firstTerm"); | |
setAttr ($Cnd2 + ".colorIfFalseR") $ChainLength; | |
// create the Second plusMinusAverage node | |
shadingNode -asUtility plusMinusAverage -n $PMA2; | |
setAttr ($PMA2 + ".operation") 2; | |
connectAttr -f ($MD6 + ".outputX")($PMA2 + ".input1D[0]"); | |
connectAttr -f ($PMA1 + ".output1D") ($PMA2 + ".input1D[1]"); | |
// Create the Fist Multiply Divide Node | |
shadingNode -asUtility multiplyDivide -n $MD1; | |
setAttr ($MD1 + ".operation") 2; | |
connectAttr -f ($ArmCtrl + "." + $SoftName) ($MD1 + ".input2X"); | |
connectAttr -f ($PMA2 + ".output1D") ($MD1 + ".input1X"); | |
// Create the Second Multiply Divide Node | |
shadingNode -asUtility multiplyDivide -n $MD2; | |
setAttr ($MD2 + ".operation") 1; | |
setAttr ($MD2 + ".input1X") -1; | |
connectAttr -f ($MD1 + ".outputX") ($MD2 + ".input2X"); | |
// Create the Third Multiply Divide Node | |
shadingNode -asUtility multiplyDivide -n $MD3; | |
setAttr ($MD3 + ".operation") 3; | |
setAttr ($MD3 + ".input1X") 2.718282; | |
connectAttr -f ($MD2 + ".outputX")($MD3 + ".input2X"); | |
// Create the Forth Multiply Divide Node | |
shadingNode -asUtility multiplyDivide -n $MD4; | |
setAttr ($MD4 + ".operation") 1; | |
connectAttr -f ($ArmCtrl + "." + $SoftName) ($MD4 + ".input1X"); | |
connectAttr -f ($MD3 + ".outputX") ($MD4 + ".input2X"); | |
// create the third plusMinusAverage node | |
shadingNode -asUtility plusMinusAverage -n $PMA3; | |
setAttr ($PMA3 + ".operation") 2; | |
setAttr ($PMA3 + ".input1D[0]")$ChainLength; | |
connectAttr -f ($MD4 + ".outputX") ($PMA3 + ".input1D[1]"); | |
connectAttr -f ($PMA3 + ".output1D") ($Cnd2 + ".colorIfTrueR"); | |
// Finishing the nested condition nodes | |
connectAttr -f ($Cnd2 + ".outColorR") ($Cnd1 + ".colorIfTrueR"); | |
connectAttr -f ($Cnd1 + ".outColorR") ($LocNameWrist + ".translateX"); | |
// point constraining the SoftBlend Loc to Both WristLOC and Arm CTRL | |
select -cl ; | |
select -r $LocNameWrist; | |
select -add $ArmCtrl; | |
select -add $SoftBlendLocName; | |
pointConstraint -tl -n ($SoftBlendLocName + "PointConst01"); | |
select -cl ; | |
// creating set driven keys on the Soft blend loc and Stretch vlaues | |
setAttr ($ArmCtrl + "." + $StretchName) 1; | |
setAttr ($SoftBlendLocName + "PointConst01"+ "." + $LocNameWrist + "W0") 0; | |
setAttr ($SoftBlendLocName + "PointConst01"+ "." + $ArmCtrl + "W1") 1; | |
setDrivenKeyframe -currentDriver ($ArmCtrl + "." + $StretchName) ($SoftBlendLocName + "PointConst01" + "." + $LocNameWrist + "W0"); | |
setDrivenKeyframe -currentDriver ($ArmCtrl + "." + $StretchName) ($SoftBlendLocName + "PointConst01" + "." + $ArmCtrl + "W1"); | |
//////////////////////////////////////////// | |
setAttr ($ArmCtrl + "." + $StretchName) 0; | |
setAttr ($SoftBlendLocName + "PointConst01"+ "." + $LocNameWrist + "W0") 1; | |
setAttr ($SoftBlendLocName + "PointConst01"+ "." + $ArmCtrl + "W1") 0; | |
setDrivenKeyframe -currentDriver ($ArmCtrl + "." + $StretchName) ($SoftBlendLocName + "PointConst01" + "." + $LocNameWrist + "W0"); | |
setDrivenKeyframe -currentDriver ($ArmCtrl + "." + $StretchName) ($SoftBlendLocName + "PointConst01" + "." + $ArmCtrl + "W1"); | |
// Creating the Stretch soft IK setup | |
shadingNode -asUtility multiplyDivide -n $MD7; | |
setAttr ($MD1 + ".operation") 1; | |
setAttr ($MD7 + ".input1X") 1; | |
connectAttr -f ($L_RootName + ".scaleX") ($MD7 + ".input2X"); | |
shadingNode -asUtility multiplyDivide -n $MD8; | |
setAttr ($MD8 + ".operation") 1; | |
connectAttr -f ($MD7 + ".outputX") ($MD8 + ".input1X"); | |
connectAttr -f ($SoftDistDT + "Shape" + ".distance") ($MD8 + ".input2X"); | |
// Special Node 1 | |
shadingNode -asUtility multiplyDivide -n $MD13; | |
setAttr ($MD13 + ".operation") 2; | |
setAttr ($MD13 + ".input1X") $ShoulderDist; | |
setAttr ($MD13 + ".input2X") $ChainLength; | |
// Special Node 2 | |
shadingNode -asUtility multiplyDivide -n $MD14; | |
setAttr ($MD14 + ".operation") 2; | |
setAttr ($MD14 + ".input1X") $ElbowDist; | |
setAttr ($MD14 + ".input2X") $ChainLength; | |
shadingNode -asUtility multiplyDivide -n $MD9; | |
setAttr ($MD9 + ".operation") 1; | |
connectAttr -f ($MD8 + ".outputX") ($MD9 + ".input1X"); | |
connectAttr -f ($MD13 + ".outputX") ($MD9 + ".input2X"); | |
shadingNode -asUtility multiplyDivide -n $MD10; | |
setAttr ($MD10 + ".operation") 1; | |
connectAttr -f ($MD8 + ".outputX") ($MD10 + ".input1X"); | |
connectAttr -f ($MD14 + ".outputX") ($MD10 + ".input2X"); | |
//////////////////////////////////////////////////////////// | |
shadingNode -asUtility multiplyDivide -n $MD11; | |
setAttr ($MD11 + ".operation") 1; | |
connectAttr -f ($MD9 + ".outputX") ($MD11 + ".input1X"); | |
connectAttr -f ($ArmCtrl + "." + $StretchName) ($MD11 + ".input2X"); | |
shadingNode -asUtility multiplyDivide -n $MD12; | |
setAttr ($MD12 + ".operation") 1; | |
connectAttr -f ($MD10 + ".outputX") ($MD12 + ".input1X"); | |
connectAttr -f ($ArmCtrl + "." + $StretchName) ($MD12 + ".input2X"); | |
shadingNode -asUtility plusMinusAverage -n $PMA4; | |
setAttr ($PMA4 + ".operation") 1; | |
connectAttr -f ($MD11 + ".outputX") ($PMA4 + ".input1D[0]"); | |
setAttr ($PMA4 + ".input1D[1]")$ShoulderDist; | |
// $B2A1 is later connected to $JT2 | |
//connectAttr -f ($PMA4 + ".output1D") ($JT2 + ".translateX"); | |
shadingNode -asUtility plusMinusAverage -n $PMA5; | |
setAttr ($PMA5 + ".operation") 1; | |
connectAttr -f ($MD12 + ".outputX") ($PMA5 + ".input1D[0]"); | |
setAttr ($PMA5 + ".input1D[1]")$ElbowDist; | |
// Connected to $B2A2 Later | |
//connectAttr -f ($PMA5 + ".output1D") ($JT3 + ".translateX"); | |
// setting up the Pin atribute | |
//Pin setup for upper arm | |
shadingNode -asUtility multiplyDivide -n $MD15; | |
setAttr ($MD15 + ".operation") 1; | |
connectAttr -f ($MD7 + ".outputX") ($MD15 + ".input2X"); | |
connectAttr -f ($ShoulderDistDT + "Shape" + ".distance") ($MD15 + ".input1X"); | |
createNode condition -n $Cnd3; | |
setAttr ($Cnd3 + ".operation") 2; | |
connectAttr -f ($MD15 + ".outputX") ($Cnd3 + ".colorIfTrueR"); | |
connectAttr -f ($MD15 + ".outputX") ($Cnd3 + ".firstTerm"); | |
setAttr ($Cnd3 + ".secondTerm") $ShoulderDist; | |
setAttr ($Cnd3 + ".colorIfFalseR") $ShoulderDist; | |
shadingNode -asUtility blendTwoAttr -n $B2A1; | |
//connectAttr -f ($PMA4 + ".output1D") ($B2A1 + ".input[0]"); | |
connectAttr -f ($Cnd3 + ".outColorR") ($B2A1 + ".input[1]"); | |
connectAttr -f ($ArmCtrl + "." + $PinName) ($B2A1 + ".attributesBlender"); | |
connectAttr -f ($B2A1 + ".output") ($JT2 + ".translateX"); | |
// pin setup for lowwer arm | |
shadingNode -asUtility multiplyDivide -n $MD16; | |
setAttr ($MD16 + ".operation") 1; | |
connectAttr -f ($MD7 + ".outputX") ($MD16 + ".input2X"); | |
connectAttr -f ($ElbowDistDT + "Shape" + ".distance") ($MD16 + ".input1X"); | |
createNode condition -n $Cnd4; | |
setAttr ($Cnd4 + ".operation") 2; | |
connectAttr -f ($MD16 + ".outputX") ($Cnd4 + ".colorIfTrueR"); | |
connectAttr -f ($MD16 + ".outputX") ($Cnd4 + ".firstTerm"); | |
setAttr ($Cnd4 + ".secondTerm") $ElbowDist; | |
setAttr ($Cnd4 + ".colorIfFalseR") $ElbowDist; | |
shadingNode -asUtility blendTwoAttr -n $B2A2; | |
//connectAttr -f ($PMA5 + ".output1D") ($B2A2 + ".input[0]"); | |
connectAttr -f ($Cnd4 + ".outColorR") ($B2A2 + ".input[1]"); | |
connectAttr -f ($ArmCtrl + "." + $PinName) ($B2A2 + ".attributesBlender"); | |
connectAttr -f ($B2A2 + ".output") ($JT3 + ".translateX"); | |
// setting up the Slide atribute | |
shadingNode -asUtility multiplyDivide -n $MD17; | |
setAttr ($MD17 + ".operation") 1; | |
setAttr ($MD17 + ".input1X") $ChainLength; | |
connectAttr -f ($MD14 + ".outputX") ($MD17 + ".input2X"); | |
shadingNode -asUtility multiplyDivide -n $MD18; | |
setAttr ($MD18 + ".operation") 1; | |
connectAttr -f ($ArmCtrl + "." + $SlideName) ($MD18 + ".input2X"); | |
connectAttr -f ($MD17 + ".outputX") ($MD18 + ".input1X"); | |
shadingNode -asUtility multiplyDivide -n $MD19; | |
setAttr ($MD19 + ".operation") 1; | |
setAttr ($MD19 + ".input1X") $ChainLength; | |
connectAttr -f ($MD13 + ".outputX") ($MD19 + ".input2X"); | |
shadingNode -asUtility multiplyDivide -n $MD20; | |
setAttr ($MD20 + ".operation") 1; | |
connectAttr -f ($MD19 + ".outputX") ($MD20 + ".input1X"); | |
connectAttr -f ($ArmCtrl + "." + $SlideName) ($MD20 + ".input2X"); | |
createNode condition -n $Cnd5; | |
setAttr ($Cnd5 + ".operation") 4; | |
setAttr ($Cnd5 + ".secondTerm") 0; | |
connectAttr -f ($MD18 + ".outputX") ($Cnd5 + ".colorIfFalseR"); | |
connectAttr -f ($MD20 + ".outputX") ($Cnd5 + ".colorIfTrueR"); | |
connectAttr -f ($ArmCtrl + "." + $SlideName) ($Cnd5 + ".firstTerm"); | |
shadingNode -asUtility plusMinusAverage -n $PMA6; | |
setAttr ($PMA6 + ".operation") 1; | |
connectAttr -f ($PMA4 + ".output1D") ($PMA6 + ".input1D[0]"); | |
connectAttr -f ($Cnd5 + ".outColorR") ($PMA6 + ".input1D[1]"); | |
shadingNode -asUtility plusMinusAverage -n $PMA7; | |
setAttr ($PMA7 + ".operation") 2; | |
connectAttr -f ($PMA5 + ".output1D") ($PMA7 + ".input1D[0]"); | |
connectAttr -f ($Cnd5 + ".outColorR") ($PMA7 + ".input1D[1]"); | |
connectAttr -f ($PMA6 + ".output1D") ($B2A1 + ".input[0]"); | |
connectAttr -f ($PMA7 + ".output1D") ($B2A2 + ".input[0]"); | |
////////////////////////////////////////////////////////////////////////// | |
// Cleanup | |
shadingNode -asUtility multiplyDivide -n $MD21; | |
setAttr ($MD21 + ".operation") 1; | |
connectAttr -f ($StretchDistDT + "Shape"+ "." + "distance") ($MD21 + ".input1X"); | |
connectAttr -f ($MD7 + ".outputX") ($MD21 + ".input2X"); | |
createNode condition -n $Cnd6; | |
setAttr ($Cnd6 + ".operation") 2; | |
setAttr ($Cnd6 + ".secondTerm") $ChainLength; | |
setAttr ($Cnd6 + ".colorIfFalseR") $ChainLength; | |
connectAttr -f ($MD21 + ".outputX") ($Cnd6 + ".firstTerm"); | |
connectAttr -f ($MD21 + ".outputX") ($Cnd6 + ".colorIfTrueR"); | |
// connecting cond 6 to other mult nodes | |
connectAttr -f ($Cnd6 + ".outColorR") ($MD17 + ".input1X"); | |
connectAttr -f ($Cnd6 + ".outColorR") ($MD19 + ".input1X"); | |
// making so that slide works with pinning | |
shadingNode -asUtility plusMinusAverage -n $PMA8; | |
setAttr ($PMA8 + ".operation") 1; | |
setAttr ($PMA8 + ".input1D[0]") $ElbowDist; | |
connectAttr -f ($Cnd5 + ".outColorR") ($PMA8 + ".input1D[1]"); | |
connectAttr -f ($PMA8 + ".output1D") ($Cnd4 + ".secondTerm"); | |
connectAttr -f ($PMA8 + ".output1D") ($Cnd4 + ".colorIfFalseR"); | |
shadingNode -asUtility plusMinusAverage -n $PMA9; | |
setAttr ($PMA9 + ".operation") 2; | |
setAttr ($PMA9 + ".input1D[0]") $ShoulderDist; | |
connectAttr -f ($Cnd5 + ".outColorR") ($PMA9 + ".input1D[1]"); | |
connectAttr -f ($PMA9 + ".output1D") ($Cnd3 + ".secondTerm"); | |
connectAttr -f ($PMA9 + ".output1D") ($Cnd3 + ".colorIfFalseR"); | |
// Setting IK RP solver tolerance | |
setAttr ikRPsolver.tolerance 1e-007; | |
// Creating The Elbow CTRL | |
curve -d 1 -p -2 -2.88089e-007 0 -p -1 1.732051 0 -p 1 1.732051 0 -p 2 9.93411e-009 0 -p 1 -1.732051 0 -p -1 -1.732051 0 -p -2 -2.88089e-007 0 -p 3.97364e-008 9.93411e-009 -4 -p -1 1.732051 0 -p 3.97364e-008 9.93411e-009 -4 -p 1 1.732051 0 -p 3.97364e-008 9.93411e-009 -4 -p 2 9.93411e-009 0 -p 3.97364e-008 9.93411e-009 -4 -p 1 -1.732051 0 -p 3.97364e-008 9.93411e-009 -4 -p -1 -1.732051 0 -p 3.97364e-008 9.93411e-009 -4 -p -2 -2.88089e-007 0 -k 0 -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 -k 8 -k 9 -k 10 -k 11 -k 12 -k 13 -k 14 -k 15 -k 16 -k 17 -k 18 -n $ElbowCtrl ; | |
setAttr ($ElbowCtrl + ".overrideEnabled") 1; | |
setAttr ($ElbowCtrl + ".overrideColor") 18; | |
xform -t $Loc2[0] $Loc2[1] $Loc2[2]; | |
pointConstraint -mo -weight 1 $ElbowCtrl $LocNameElbow; | |
xform -t $Loc2[0] $Loc2[1] ($Loc2[2] - 15); | |
makeIdentity -apply true -t 1 -r 1 -s 1 -n 0 -pn 1; | |
parent $ElbowCtrl $L_RootName; | |
select -cl; | |
int $Arm_IKFK_CB = `checkBox -q -v Arm_IKFK_Check`; | |
if ($Arm_IKFK_CB == 1){ | |
// Creating the IKFK Grear | |
/// Creat GEAR control | |
curve -d 1 -p -1.327953 0 -9.954337 -p 1.341144 0 -9.938909 -p 1.780851 0 -7.269811 -p 3.678533 0 -6.513824 -p 5.961923 0 -8.079797 -p 7.890462 0 -6.197544 -p 6.30906 0 -4.022152 -p 7.203902 0 -2.078185 -p 9.880714 0 -1.599907 -p 9.993845 0 1.032165 -p 7.353172 0 1.453142 -p 6.553317 0 3.642221 -p 8.128883 0 5.924288 -p 6.369816 0 7.795225 -p 4.211166 0 6.221865 -p 1.945528 0 7.247696 -p 1.442053 0 9.953875 -p -1.094204 0 9.985343 -p -1.496984 0 7.367271 -p -3.901078 0 6.416962 -p -6.135249 0 7.958855 -p -7.92888 0 6.184105 -p -6.349226 0 4.006574 -p -7.305829 0 1.671708 -p -9.961661 0 1.1997 -p -9.936487 0 -1.38061 -p -7.280655 0 -1.802271 -p -6.361813 0 -3.967214 -p -7.878532 0 -6.188799 -p -6.028261 0 -8.032777 -p -3.819263 0 -6.44683 -p -1.811656 0 -7.25239 -p -1.327953 0 -9.954336 -k 0 -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 -k 8 -k 9 -k 10 -k 11 -k 12 -k 13 -k 14 -k 15 -k 16 -k 17 -k 18 -k 19 -k 20 -k 21 -k 22 -k 23 -k 24 -k 25 -k 26 -k 27 -k 28 -k 29 -k 30 -k 31 -k 32 -n ($LR + "arm_GEAR_CTRL"); | |
//rename "curveShape1" ($LR + "arm_GEAR_CTRL_shape"); | |
addAttr -ln "IK_FK" -at double -min 0 -max 1 -dv 0 ($LR + "arm_GEAR_CTRL"); | |
setAttr -e-keyable true ($LR + "arm_GEAR_CTRL.IK_FK"); | |
setAttr ($LR + "arm_GEAR_CTRL" + ".overrideEnabled") 1; | |
setAttr ($LR + "arm_GEAR_CTRL" + ".overrideColor") 17; | |
// F | |
curve -d 1 -p -0.8 0 -1.6 -p -0.8 0 -2.4 -p -3.6 0 -2.4 -p -3.6 0 2.4 -p -2.8 0 2.4 -p -2.8 0 0.4 -p -1 0 0.4 -p -1 0 -0.4 -p -2.8 0 -0.4 -p -2.8 0 -1.6 -p -0.8 0 -1.6 -k 0 -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 -k 8 -k 9 -k 10 -n ($LR + "F_CTRL_Curve"); | |
setAttr ($LR + "F_CTRL_Curve" + ".overrideEnabled") 1; | |
setAttr ($LR + "F_CTRL_Curve" + ".overrideColor") 17; | |
setAttr ($LR + "F_CTRL_Curve" + ".visibility") 0; | |
// I | |
curve -d 1 -p -2.4 0 -2.4 -p -1.6 0 -2.4 -p -1.6 0 2.4 -p -2.4 0 2.4 -p -2.4 0 -2.4 -k 0 -k 1 -k 2 -k 3 -k 4 -n ($LR + "I_CTRL_Curve"); | |
setAttr ($LR + "I_CTRL_Curve" + ".overrideEnabled") 1; | |
setAttr ($LR + "I_CTRL_Curve" + ".overrideColor") 17; | |
// K | |
curve -d 1 -p 0.6 0 -2.4 -p 1.4 0 -2.4 -p 1.4 0 -0.2 -p 3.2 0 -2.4 -p 4.2 0 -2.4 -p 2.2 0 0 -p 4.2 0 2.4 -p 3.2 0 2.4 -p 1.4 0 0.2 -p 1.4 0 2.4 -p 0.6 0 2.4 -p 0.6 0 -2.4 -k 0 -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 -k 8 -k 9 -k 10 -k 11 -n ($LR + "K_CTRL_Curve"); | |
setAttr ($LR + "K_CTRL_Curve" + ".overrideEnabled") 1; | |
setAttr ($LR + "K_CTRL_Curve" + ".overrideColor") 17; | |
parent ($LR + "F_CTRL_Curve") ($LR + "I_CTRL_Curve") ($LR + "K_CTRL_Curve") ($LR + "arm_GEAR_CTRL"); | |
setDrivenKeyframe -currentDriver ($LR + "arm_GEAR_CTRL" + ".IK_FK") ($LR + "F_CTRL_Curve" + ".visibility"); | |
setDrivenKeyframe -currentDriver ($LR + "arm_GEAR_CTRL" + ".IK_FK") ($LR + "I_CTRL_Curve" + ".visibility"); | |
setAttr ($LR + "arm_GEAR_CTRL" + ".IK_FK") 1; | |
setAttr ($LR + "F_CTRL_Curve" + ".visibility") 1; | |
setAttr ($LR + "I_CTRL_Curve" + ".visibility") 0; | |
setDrivenKeyframe -currentDriver ($LR + "arm_GEAR_CTRL" + ".IK_FK") ($LR + "F_CTRL_Curve" + ".visibility"); | |
setDrivenKeyframe -currentDriver ($LR + "arm_GEAR_CTRL" + ".IK_FK") ($LR + "I_CTRL_Curve" + ".visibility"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "K_CTRL_Curve" + ".tx"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "K_CTRL_Curve" + ".ty"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "K_CTRL_Curve" + ".tz"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "K_CTRL_Curve" + ".rx"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "K_CTRL_Curve" + ".ry"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "K_CTRL_Curve" + ".rz"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "K_CTRL_Curve" + ".sx"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "K_CTRL_Curve" + ".sy"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "K_CTRL_Curve" + ".sz"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "K_CTRL_Curve" + ".v"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "I_CTRL_Curve" + ".tx"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "I_CTRL_Curve" + ".ty"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "I_CTRL_Curve" + ".tz"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "I_CTRL_Curve" + ".rx"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "I_CTRL_Curve" + ".ry"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "I_CTRL_Curve" + ".rz"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "I_CTRL_Curve" + ".sx"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "I_CTRL_Curve" + ".sy"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "I_CTRL_Curve" + ".sz"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "I_CTRL_Curve" + ".v"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "F_CTRL_Curve" + ".tx"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "F_CTRL_Curve" + ".ty"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "F_CTRL_Curve" + ".tz"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "F_CTRL_Curve" + ".rx"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "F_CTRL_Curve" + ".ry"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "F_CTRL_Curve" + ".rz"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "F_CTRL_Curve" + ".sx"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "F_CTRL_Curve" + ".sy"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "F_CTRL_Curve" + ".sz"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "F_CTRL_Curve" + ".v"); | |
xform -r -t 30 0 -30 -s 0.5 0.5 0.5 ($LR + "arm_GEAR_CTRL"); | |
// creating Bound arm | |
select -cl ; | |
joint -p $Loc1[0] $Loc1[1] $Loc1[2] ; | |
joint -p $Loc2[0] $Loc2[1] $Loc2[2] ; | |
joint -e -zso -oj xyz -sao yup joint1; | |
joint -p $Loc3[0] $Loc3[1] $Loc3[2] ; | |
joint -e -zso -oj xyz -sao yup joint2; | |
rename "joint1" $Bn1; | |
rename "joint2" $Bn2; | |
rename "joint3" $Bn3; | |
// creating FK arm | |
select -cl ; | |
joint -p $Loc1[0] $Loc1[1] $Loc1[2] ; | |
joint -p $Loc2[0] $Loc2[1] $Loc2[2] ; | |
joint -e -zso -oj xyz -sao yup joint1; | |
joint -p $Loc3[0] $Loc3[1] $Loc3[2] ; | |
joint -e -zso -oj xyz -sao yup joint2; | |
rename "joint1" $FK1; | |
rename "joint2" $FK2; | |
rename "joint3" $FK3; | |
// creating FK arm CTRLs | |
circle -c 0 0 0 -nr 0 1 0 -sw 360 -r 4 -d 3 -ut 0 -tol 0.01 -s 8 -ch 1 -n ($FK1 + "CTRL"); | |
xform -ro 0 0 -90 ($FK1 + "CTRL"); | |
makeIdentity -apply true -t 1 -r 1 -s 1 -n 0 -pn 1 ($FK1 + "CTRL"); | |
select -r ($FK1 + "CTRL" + "Shape"); | |
select -add $FK1; | |
parent -r -s; | |
delete ($FK1 + "CTRL"); | |
circle -c 0 0 0 -nr 0 1 0 -sw 360 -r 4 -d 3 -ut 0 -tol 0.01 -s 8 -ch 1 -n ($FK2 + "CTRL"); | |
xform -ro 0 0 -90 ($FK2 + "CTRL"); | |
makeIdentity -apply true -t 1 -r 1 -s 1 -n 0 -pn 1 ($FK2 + "CTRL"); | |
select -r ($FK2 + "CTRL" + "Shape"); | |
select -add $FK2; | |
parent -r -s; | |
delete ($FK2 + "CTRL"); | |
circle -c 0 0 0 -nr 0 1 0 -sw 360 -r 4 -d 3 -ut 0 -tol 0.01 -s 8 -ch 1 -n ($FK3 + "CTRL"); | |
xform -ro 0 0 -90 ($FK3 + "CTRL"); | |
makeIdentity -apply true -t 1 -r 1 -s 1 -n 0 -pn 1 ($FK3 + "CTRL"); | |
select -r ($FK3 + "CTRL" + "Shape"); | |
select -add $FK3; | |
parent -r -s; | |
delete ($FK3 + "CTRL"); | |
// Parenting the Bound to IK and FK arm; | |
select -r $JT1 $FK1 $Bn1; | |
parentConstraint -weight 1 -n ($Bn1 + "ParConst"); | |
select -r $JT2 $FK2 $Bn2; | |
parentConstraint -weight 1 -n ($Bn2 + "ParConst"); | |
select -r $JT3 $FK3 $Bn3; | |
parentConstraint -weight 1 -n ($Bn3 + "ParConst"); | |
// SDK IK FK mode | |
setAttr ($Bn1 + "ParConst" + "." + $JT1 + "W0") 0; | |
setAttr ($Bn2 + "ParConst" + "." + $JT2 + "W0") 0; | |
setAttr ($Bn3 + "ParConst" + "." + $JT3 + "W0") 0; | |
setDrivenKeyframe -currentDriver ($LR + "arm_GEAR_CTRL" + ".IK_FK") ($Bn1 + "ParConst" + "." + $JT1 + "W0"); | |
setDrivenKeyframe -currentDriver ($LR + "arm_GEAR_CTRL" + ".IK_FK") ($Bn1 + "ParConst" + "." + $FK1 + "W1"); | |
setDrivenKeyframe -currentDriver ($LR + "arm_GEAR_CTRL" + ".IK_FK") ($Bn2 + "ParConst" + "." + $JT2 + "W0"); | |
setDrivenKeyframe -currentDriver ($LR + "arm_GEAR_CTRL" + ".IK_FK") ($Bn2 + "ParConst" + "." + $FK2 + "W1"); | |
setDrivenKeyframe -currentDriver ($LR + "arm_GEAR_CTRL" + ".IK_FK") ($Bn3 + "ParConst" + "." + $JT3 + "W0"); | |
setDrivenKeyframe -currentDriver ($LR + "arm_GEAR_CTRL" + ".IK_FK") ($Bn3 + "ParConst" + "." + $FK3 + "W1"); | |
setAttr ($LR + "arm_GEAR_CTRL" + ".IK_FK") 0; | |
setAttr ($Bn1 + "ParConst" + "." + $JT1 + "W0") 1; | |
setAttr ($Bn1 + "ParConst" + "." + $FK1 + "W1") 0; | |
setAttr ($Bn2 + "ParConst" + "." + $JT2 + "W0") 1; | |
setAttr ($Bn2 + "ParConst" + "." + $FK2 + "W1") 0; | |
setAttr ($Bn3 + "ParConst" + "." + $JT3 + "W0") 1; | |
setAttr ($Bn3 + "ParConst" + "." + $FK3 + "W1") 0; | |
setDrivenKeyframe -currentDriver ($LR + "arm_GEAR_CTRL" + ".IK_FK") ($Bn1 + "ParConst" + "." + $JT1 + "W0"); | |
setDrivenKeyframe -currentDriver ($LR + "arm_GEAR_CTRL" + ".IK_FK") ($Bn1 + "ParConst" + "." + $FK1 + "W1"); | |
setDrivenKeyframe -currentDriver ($LR + "arm_GEAR_CTRL" + ".IK_FK") ($Bn2 + "ParConst" + "." + $JT2 + "W0"); | |
setDrivenKeyframe -currentDriver ($LR + "arm_GEAR_CTRL" + ".IK_FK") ($Bn2 + "ParConst" + "." + $FK2 + "W1"); | |
setDrivenKeyframe -currentDriver ($LR + "arm_GEAR_CTRL" + ".IK_FK") ($Bn3 + "ParConst" + "." + $JT3 + "W0"); | |
setDrivenKeyframe -currentDriver ($LR + "arm_GEAR_CTRL" + ".IK_FK") ($Bn3 + "ParConst" + "." + $FK3 + "W1"); | |
select -cl; | |
//Cleanup of IK FK arm setup | |
parent $Bn1 $L_RootName ; | |
parent $FK1 $L_RootName ; | |
parent ($LR + "arm_GEAR_CTRL") $L_RootName ; | |
} | |
int $Arm_Hand_CB = `checkBox -q -v Arm_Hand_Check`; | |
if ($Arm_Hand_CB == 1){ | |
print "Hand Coming SOON \n"; | |
} | |
}else{ | |
warning "Must Create LOCS first"; | |
} | |
} | |
} | |
proc MirrorArmSetup(){ | |
string $L_RootName = "L_arm_Root"; | |
if( `objExists $L_RootName` ){ | |
string $LR = "R_"; | |
string $LocNameShoulder = "L_arm_IK_Shoulder_LOC"; | |
string $LocNameElbow = "L_arm_IK_Elbow_LOC"; | |
string $LocNameWrist = "L_arm_IK_Wrist_LOC"; | |
string $CTRLdistLocName = "L_arm_CTRLdist_LOC"; | |
string $SoftBlendLocName = "L_arm_softBlend_LOC"; | |
// Joint Sting names | |
string $RP_JT1 = "R_PROX_arm_IK_Shoulder_01"; | |
string $RP_JT2 = "R_PROX_arm_IK_Elbow_01"; | |
string $RP_JT3 = "R_PROX_arm_IK_Wrist_01"; | |
// Attrib Naming Strings | |
string $SlideName = ($LR + "arm_slideP"); | |
string $StretchName = ($LR + "arm_stretchP"); | |
string $SoftName = ($LR + "arm_softP"); | |
string $PinName = ($LR + "arm_pinP"); | |
// Misc String Names | |
string $R_ArmCtrl = "R_arm_IK_CTRL"; | |
string $R_ElbowCtrl = ($LR + "elbow_IK_CTRL"); | |
string $R_RootName = "R_arm_Root"; | |
// Distance tool Name strings (-DT distance tool) | |
string $ControlDistDT = ($LR + "arm_controlDist"); | |
string $SoftDistDT = ($LR + "arm_softDist"); | |
string $ShoulderDistDT = ($LR + "arm_shoulderDist"); | |
string $ElbowDistDT = ($LR + "arm_elbowDist"); | |
string $StretchDistDT = ($LR + "arm_stretchDist"); | |
// Node Name Strings | |
//Cnd Nodes | |
string $Cnd1 = ($LR + "arm_Cond1"); | |
string $Cnd2 = ($LR + "arm_Cond2"); | |
// Pin CND Nodes | |
string $Cnd3 = ($LR + "arm_Cond3"); | |
string $Cnd4 = ($LR + "arm_Cond4"); | |
// Slide CND Node | |
string $Cnd5 = ($LR + "arm_Cond5"); | |
string $Cnd6 = ($LR + "arm_Cond6"); | |
//PMA nodes | |
string $PMA1 = ($LR + "arm_PMA1"); | |
string $PMA2 = ($LR + "arm_PMA2"); | |
string $PMA3 = ($LR + "arm_PMA3"); | |
// Pma nodes for Stretch soft IK | |
string $PMA4 = ($LR + "arm_PMA4"); | |
string $PMA5 = ($LR + "arm_PMA5"); | |
// Pma nodes for Slide | |
string $PMA6 = ($LR + "arm_PMA6"); | |
string $PMA7 = ($LR + "arm_PMA7"); | |
string $PMA8 = ($LR + "arm_PMA8"); | |
string $PMA9 = ($LR + "arm_PMA9"); | |
//Multiply Divide Nodes | |
string $MD1 = ($LR + "arm_MD1"); | |
string $MD2 = ($LR + "arm_MD2"); | |
string $MD3 = ($LR + "arm_MD3"); | |
string $MD4 = ($LR + "arm_MD4"); | |
string $MD5 = ($LR + "arm_MD5"); | |
string $MD6 = ($LR + "arm_MD6"); | |
//Multiply Divide Nodes for Stretch Soft IK | |
string $MD7 = ($LR + "arm_MD7"); | |
string $MD8 = ($LR + "arm_MD8"); | |
string $MD9 = ($LR + "arm_MD9"); | |
string $MD10 = ($LR + "arm_MD10"); | |
string $MD11 = ($LR + "arm_MD11"); | |
string $MD12 = ($LR + "arm_MD12"); | |
// Special MD nodes for stretch | |
string $MD13 = ($LR + "arm_MD_ShoulderByChainLen"); | |
string $MD14 = ($LR + "arm_MD_ElbowByChainLen"); | |
// Pin MD nodes | |
string $MD15 = ($LR + "arm_MD15"); | |
string $MD16 = ($LR + "arm_MD16"); | |
// Slide MD nodes | |
string $MD17 = ($LR + "arm_MD17"); | |
string $MD18 = ($LR + "arm_MD18"); | |
string $MD19 = ($LR + "arm_MD19"); | |
string $MD20 = ($LR + "arm_MD20"); | |
string $MD21 = ($LR + "arm_MD21"); | |
// Pin Blend ATTR nodes | |
string $B2A1 = ($LR + "arm_BL2Atr01"); | |
string $B2A2 = ($LR + "arm_BL2Atr02"); | |
// new mirrored Locs | |
string $R_LocNameShoulder = "R_arm_IK_Shoulder_LOC"; | |
string $R_LocNameElbow = "R_arm_IK_Elbow_LOC"; | |
string $R_LocNameWrist = "R_arm_IK_Wrist_LOC"; | |
string $R_CTRLdistLocName = "R_arm_CTRLdist_LOC"; | |
string $R_SoftBlendLocName = "R_arm_softBlend_LOC"; | |
// new Joint Sting names | |
string $R_JT1 = "R_arm_IK_Shoulder_01"; | |
string $R_JT2 = "R_arm_IK_Elbow_01"; | |
string $R_JT3 = "R_arm_IK_Wrist_01"; | |
// New strings to apend | |
// Bound Arm names | |
string $Bn1 = ($LR + "arm_Bound_Shoulder_01"); | |
string $Bn2 = ($LR + "arm_Bound_Elbow_01"); | |
string $Bn3 = ($LR + "arm_Bound_Wrist_01"); | |
// FK Arm names | |
string $FK1 = ($LR + "arm_FK_Shoulder_01"); | |
string $FK2 = ($LR + "arm_FK_Elbow_01"); | |
string $FK3 = ($LR + "arm_FK_Wrist_01"); | |
float $R_Loc1[] = `xform -worldSpace -q -translation $LocNameShoulder`; | |
float $R_Loc2[] = `xform -worldSpace -q -translation $LocNameElbow`; | |
float $R_Loc3[] = `xform -worldSpace -q -translation $LocNameWrist`; | |
float $Loc1Invrs = ($R_Loc1[0] * -1); | |
float $Loc2Invrs = ($R_Loc2[0] * -1); | |
float $Loc3Invrs = ($R_Loc3[0] * -1); | |
spaceLocator -n $R_LocNameShoulder -p 0 0 0; | |
xform -t $Loc1Invrs $R_Loc1[1] $R_Loc1[2]; | |
spaceLocator -n $R_LocNameElbow -p 0 0 0; | |
xform -t $Loc2Invrs $R_Loc2[1] ($R_Loc2[2] + 15); | |
spaceLocator -n $R_LocNameWrist -p 0 0 0; | |
xform -t $Loc3Invrs $R_Loc3[1] $R_Loc3[2]; | |
select -r $R_LocNameShoulder; | |
select -add $R_LocNameElbow; | |
select -add $R_LocNameWrist; | |
string $R_BoneLocs[]=`ls -sl`; | |
int $R_amount=`size($R_BoneLocs)`; | |
for ($R_n=0; $R_n<$R_amount; $R_n++) { | |
setAttr ($R_BoneLocs[$R_n] + ".localScaleX") 5; | |
setAttr ($R_BoneLocs[$R_n] + ".localScaleY") 5; | |
setAttr ($R_BoneLocs[$R_n] + ".localScaleZ") 5; | |
//setAttr ($BoneLocs[$n] + ".overrideEnabled") 1; | |
//setAttr ($BoneLocs[$n] + ".overrideColor") 17; | |
} | |
// creation of joins on locators | |
select -cl ; | |
float $Loc1[] = `xform -worldSpace -q -translation $LocNameShoulder`; | |
float $Loc2[] = `xform -worldSpace -q -translation $LocNameElbow`; | |
float $Loc3[] = `xform -worldSpace -q -translation $LocNameWrist`; | |
joint -p $Loc1[0] $Loc1[1] $Loc1[2] ; | |
joint -p $Loc2[0] $Loc2[1] ($Loc2[2] + 15) ; | |
joint -e -zso -oj xyz -sao yup joint1; | |
joint -p $Loc3[0] $Loc3[1] $Loc3[2] ; | |
joint -e -zso -oj xyz -sao yup joint2; | |
rename "joint1" $RP_JT1; | |
rename "joint2" $RP_JT2; | |
rename "joint3" $RP_JT3; | |
select -r $RP_JT1; | |
mirrorJoint -mirrorYZ -mirrorBehavior -sr "R_PROX_" "R_"; | |
/*=======================================IMA=NEED=THIS=LATER====================================================*/ | |
select -r $RP_JT1; | |
mirrorJoint -mirrorYZ -mirrorBehavior -sr "R_PROX_arm_IK" "R_arm_Bound"; | |
select -r $RP_JT1; | |
mirrorJoint -mirrorYZ -mirrorBehavior -sr "R_PROX_arm_IK" "R_arm_FK"; | |
/*===============================================================================================================*/ | |
delete R_PROX_arm_IK_Shoulder_01; | |
////////////////////////////////////////////////////////////////////// | |
// Creating the Arm Control | |
circle -c 0 0 0 -nr 0 1 0 -sw 360 -r 4 -d 3 -ut 0 -tol 0.01 -s 8 -ch 0 -n $R_ArmCtrl; | |
// adding atributes to the Arm CTRL | |
addAttr -ln "Ik_Controls" -at double -dv 0 -k true; | |
setAttr -lock true ($R_ArmCtrl + ".Ik_Controls"); | |
addAttr -ln $SlideName -nn "Slide" -at double -max 1 -min -1 -dv 0 -k true; | |
addAttr -ln $StretchName -nn "Stretch" -at double -max 1 -min 0 -dv 0 -k true; | |
addAttr -ln $SoftName -nn "Soft" -at double -max 1 -min 0 -dv 0 -k true; | |
addAttr -ln $PinName -nn "Pin" -at double -max 1 -min 0 -dv 0 -k true; | |
xform -ro 0 0 -90 $R_ArmCtrl; | |
setAttr ($R_ArmCtrl + ".overrideEnabled") 1; | |
setAttr ($R_ArmCtrl + ".overrideColor") 18; | |
// creating wrist control dist Loc | |
spaceLocator -n $R_CTRLdistLocName -p 0 0 0; | |
parent ($LR + "arm_CTRLdist_LOC") $R_ArmCtrl; | |
spaceLocator -n $R_SoftBlendLocName -p 0 0 0; | |
parent ($LR + "arm_softBlend_LOC") $R_ArmCtrl; | |
// moving CTRL to wrist | |
select -r $R_LocNameWrist; | |
select -add $R_ArmCtrl; | |
pointConstraint -offset 0 0 0 -n CTRLtoWristConst; | |
select -r CTRLtoWristConst; | |
doDelete; | |
makeIdentity -apply true -t 1 -r 1 -s 1 -n 0 -pn 1 $R_ArmCtrl; | |
////////////////////////////////////////////////////////////////////// | |
// create Root node | |
group -em -n $R_RootName; | |
connectAttr -f ($R_RootName + ".scaleX") ($R_RootName + ".scaleY"); | |
connectAttr -f ($R_RootName + ".scaleX") ($R_RootName + ".scaleZ"); | |
setAttr -lock true -keyable false -channelBox false ($R_RootName + ".sy"); | |
setAttr -lock true -keyable false -channelBox false ($R_RootName + ".sz"); | |
////////////////////////////////////////////////////////////////////// | |
// Parenting all the things | |
parent $R_JT1 $R_LocNameShoulder; | |
parent $R_LocNameWrist $R_LocNameShoulder; | |
parent $R_LocNameShoulder $R_RootName; | |
parent $R_LocNameElbow $R_RootName; | |
parent $R_SoftBlendLocName $R_RootName; | |
parent $R_ArmCtrl $R_RootName; | |
////////////////////////////////////////////////////////////////////// | |
ikHandle -n ($LR + "arm_IK") -sj $R_JT1 -ee $R_JT3; | |
poleVectorConstraint $R_LocNameElbow ($LR + "arm_IK"); | |
parent ($LR + "arm_IK") $R_SoftBlendLocName; | |
// aim constrain the Shoulder loc to the Hand CTRL | |
aimConstraint -mo -weight 1 -aimVector -1 0 0 -upVector 0 1 0 -worldUpType "objectrotation" -worldUpVector 0 1 0 -worldUpObject $R_RootName $R_ArmCtrl $R_LocNameShoulder; | |
// creation of distance tools | |
distanceDimension -sp 0 0 -100 -ep 50 0 -100 ; | |
distanceDimension -sp 0 0 -90 -ep 50 0 -90 ; | |
distanceDimension -sp 0 0 -80 -ep 50 0 -80 ; | |
distanceDimension -sp 0 0 -70 -ep 50 0 -70 ; | |
distanceDimension -sp 0 0 -60 -ep 50 0 -60 ; | |
rename "distanceDimension1" $ControlDistDT; | |
rename "distanceDimension2" $SoftDistDT; | |
rename "distanceDimension3" $ShoulderDistDT; | |
rename "distanceDimension4" $ElbowDistDT; | |
rename "distanceDimension5" $StretchDistDT; | |
connectAttr -f ($R_LocNameShoulder + ".worldPosition[0]")($ControlDistDT + "Shape.startPoint"); | |
connectAttr -f ($R_CTRLdistLocName + ".worldPosition[0]")($ControlDistDT + "Shape.endPoint"); | |
connectAttr -f ($R_LocNameWrist + ".worldPosition[0]")($SoftDistDT + "Shape.startPoint"); | |
connectAttr -f ($R_SoftBlendLocName + ".worldPosition[0]")($SoftDistDT + "Shape.endPoint"); | |
connectAttr -f ($R_LocNameShoulder + ".worldPosition[0]")($ShoulderDistDT + "Shape.startPoint"); | |
connectAttr -f ($R_LocNameElbow + ".worldPosition[0]")($ShoulderDistDT + "Shape.endPoint"); | |
connectAttr -f ($R_LocNameElbow + ".worldPosition[0]")($ElbowDistDT + "Shape.startPoint"); | |
connectAttr -f ($R_SoftBlendLocName + ".worldPosition[0]")($ElbowDistDT + "Shape.endPoint"); | |
connectAttr -f ($R_LocNameShoulder + ".worldPosition[0]")($StretchDistDT + "Shape.startPoint"); | |
connectAttr -f ($R_SoftBlendLocName + ".worldPosition[0]")($StretchDistDT + "Shape.endPoint"); | |
// This will cause problems if any of these are already in the scene. | |
select -r locator1 locator2 locator3 locator4 locator5 locator6 locator7 locator8 locator9 locator10 ; | |
doDelete; | |
select -r $ControlDistDT $SoftDistDT $ShoulderDistDT $ElbowDistDT $StretchDistDT; | |
group -n ($LR + "arm_DistTools_GRP"); | |
parent ($LR + "arm_DistTools_GRP") $R_RootName; | |
setAttr ($LR + "arm_DistTools_GRP" + ".visibility") 0; | |
////////////////////////////////////////////////////////////////////// | |
// finding the chain length | |
float $ShoulderDist = `getAttr ($ShoulderDistDT + "Shape.distance")`; | |
float $ElbowDist = `getAttr ($ElbowDistDT + "Shape.distance")`; | |
float $ChainLength = ($ShoulderDist + $ElbowDist); | |
// Creating all the nodes | |
/* | |
Normalising the Root Scale And working that into the node network. | |
*/ | |
// Create the Fith Multiply Divide Node | |
shadingNode -asUtility multiplyDivide -n $MD5; | |
setAttr ($MD5 + ".operation") 2; | |
setAttr ($MD5 + ".input1X") 1; | |
connectAttr -f ($R_RootName + ".scaleX") ($MD5 + ".input2X"); | |
// Create the Sixth Multiply Divide Node | |
shadingNode -asUtility multiplyDivide -n $MD6; | |
setAttr ($MD6 + ".operation") 1; | |
connectAttr -f ($MD5 + ".outputX") ($MD6 + ".input2X"); | |
connectAttr -f ($ControlDistDT + "Shape.distance") ($MD6 + ".input1X"); | |
////////////////////////////////////////////////////////////////////// | |
// create the First condition node | |
createNode condition -n $Cnd1; | |
setAttr ($Cnd1 + ".operation") 2; | |
connectAttr -f ($MD6 + ".outputX")($Cnd1 + ".firstTerm"); | |
// create the First plusMinusAverage node | |
shadingNode -asUtility plusMinusAverage -n $PMA1; | |
setAttr ($PMA1 + ".operation") 2; | |
setAttr ($PMA1 + ".input1D[0]") $ChainLength; | |
connectAttr -f ($R_ArmCtrl + "." + $SoftName) ($PMA1 + ".input1D[1]"); | |
connectAttr -f ($PMA1 + ".output1D") ($Cnd1 + ".secondTerm"); | |
connectAttr -f ($MD6 + ".outputX")($Cnd1 + ".colorIfFalseR"); | |
// create the Second condition node | |
createNode condition -n $Cnd2; | |
setAttr ($Cnd2 + ".operation") 2; | |
connectAttr -f ($R_ArmCtrl + "." + $SoftName) ($Cnd2 + ".firstTerm"); | |
setAttr ($Cnd2 + ".colorIfFalseR") $ChainLength; | |
// create the Second plusMinusAverage node | |
shadingNode -asUtility plusMinusAverage -n $PMA2; | |
setAttr ($PMA2 + ".operation") 2; | |
connectAttr -f ($MD6 + ".outputX")($PMA2 + ".input1D[0]"); | |
connectAttr -f ($PMA1 + ".output1D") ($PMA2 + ".input1D[1]"); | |
// Create the Fist Multiply Divide Node | |
shadingNode -asUtility multiplyDivide -n $MD1; | |
setAttr ($MD1 + ".operation") 2; | |
connectAttr -f ($R_ArmCtrl + "." + $SoftName) ($MD1 + ".input2X"); | |
connectAttr -f ($PMA2 + ".output1D") ($MD1 + ".input1X"); | |
// Create the Second Multiply Divide Node | |
shadingNode -asUtility multiplyDivide -n $MD2; | |
setAttr ($MD2 + ".operation") 1; | |
setAttr ($MD2 + ".input1X") -1; | |
connectAttr -f ($MD1 + ".outputX") ($MD2 + ".input2X"); | |
// Create the Third Multiply Divide Node | |
shadingNode -asUtility multiplyDivide -n $MD3; | |
setAttr ($MD3 + ".operation") 3; | |
setAttr ($MD3 + ".input1X") 2.718282; | |
connectAttr -f ($MD2 + ".outputX")($MD3 + ".input2X"); | |
// Create the Forth Multiply Divide Node | |
shadingNode -asUtility multiplyDivide -n $MD4; | |
setAttr ($MD4 + ".operation") 1; | |
connectAttr -f ($R_ArmCtrl + "." + $SoftName) ($MD4 + ".input1X"); | |
connectAttr -f ($MD3 + ".outputX") ($MD4 + ".input2X"); | |
// create the third plusMinusAverage node | |
shadingNode -asUtility plusMinusAverage -n $PMA3; | |
setAttr ($PMA3 + ".operation") 2; | |
setAttr ($PMA3 + ".input1D[0]")$ChainLength; | |
connectAttr -f ($MD4 + ".outputX") ($PMA3 + ".input1D[1]"); | |
connectAttr -f ($PMA3 + ".output1D") ($Cnd2 + ".colorIfTrueR"); | |
// Finishing the nested condition nodes | |
connectAttr -f ($Cnd2 + ".outColorR") ($Cnd1 + ".colorIfTrueR"); | |
connectAttr -f ($Cnd1 + ".outColorR") ($R_LocNameWrist + ".translateX"); | |
// point constraining the SoftBlend Loc to Both WristLOC and Arm CTRL | |
select -cl ; | |
select -r $R_LocNameWrist; | |
select -add $R_ArmCtrl; | |
select -add $R_SoftBlendLocName; | |
pointConstraint -tl -n ($R_SoftBlendLocName + "PointConst01"); | |
select -cl ; | |
// creating set driven keys on the Soft blend loc and Stretch vlaues | |
setAttr ($R_ArmCtrl + "." + $StretchName) 1; | |
setAttr ($R_SoftBlendLocName + "PointConst01"+ "." + $R_LocNameWrist + "W0") 0; | |
setAttr ($R_SoftBlendLocName + "PointConst01"+ "." + $R_ArmCtrl + "W1") 1; | |
setDrivenKeyframe -currentDriver ($R_ArmCtrl + "." + $StretchName) ($R_SoftBlendLocName + "PointConst01" + "." + $R_LocNameWrist + "W0"); | |
setDrivenKeyframe -currentDriver ($R_ArmCtrl + "." + $StretchName) ($R_SoftBlendLocName + "PointConst01" + "." + $R_ArmCtrl + "W1"); | |
//////////////////////////////////////////// | |
setAttr ($R_ArmCtrl + "." + $StretchName) 0; | |
setAttr ($R_SoftBlendLocName + "PointConst01"+ "." + $R_LocNameWrist + "W0") 1; | |
setAttr ($R_SoftBlendLocName + "PointConst01"+ "." + $R_ArmCtrl + "W1") 0; | |
setDrivenKeyframe -currentDriver ($R_ArmCtrl + "." + $StretchName) ($R_SoftBlendLocName + "PointConst01" + "." + $R_LocNameWrist + "W0"); | |
setDrivenKeyframe -currentDriver ($R_ArmCtrl + "." + $StretchName) ($R_SoftBlendLocName + "PointConst01" + "." + $R_ArmCtrl + "W1"); | |
// Creating the Stretch soft IK setup | |
shadingNode -asUtility multiplyDivide -n $MD7; | |
setAttr ($MD1 + ".operation") 1; | |
setAttr ($MD7 + ".input1X") 1; | |
connectAttr -f ($R_RootName + ".scaleX") ($MD7 + ".input2X"); | |
shadingNode -asUtility multiplyDivide -n $MD8; | |
setAttr ($MD8 + ".operation") 1; | |
connectAttr -f ($MD7 + ".outputX") ($MD8 + ".input1X"); | |
connectAttr -f ($SoftDistDT + "Shape" + ".distance") ($MD8 + ".input2X"); | |
// Special Node 1 | |
shadingNode -asUtility multiplyDivide -n $MD13; | |
setAttr ($MD13 + ".operation") 2; | |
setAttr ($MD13 + ".input1X") $ShoulderDist; | |
setAttr ($MD13 + ".input2X") $ChainLength; | |
// Special Node 2 | |
shadingNode -asUtility multiplyDivide -n $MD14; | |
setAttr ($MD14 + ".operation") 2; | |
setAttr ($MD14 + ".input1X") $ElbowDist; | |
setAttr ($MD14 + ".input2X") $ChainLength; | |
shadingNode -asUtility multiplyDivide -n $MD9; | |
setAttr ($MD9 + ".operation") 1; | |
connectAttr -f ($MD8 + ".outputX") ($MD9 + ".input1X"); | |
connectAttr -f ($MD13 + ".outputX") ($MD9 + ".input2X"); | |
shadingNode -asUtility multiplyDivide -n $MD10; | |
setAttr ($MD10 + ".operation") 1; | |
connectAttr -f ($MD8 + ".outputX") ($MD10 + ".input1X"); | |
connectAttr -f ($MD14 + ".outputX") ($MD10 + ".input2X"); | |
//////////////////////////////////////////////////////////// | |
shadingNode -asUtility multiplyDivide -n $MD11; | |
setAttr ($MD11 + ".operation") 1; | |
connectAttr -f ($MD9 + ".outputX") ($MD11 + ".input1X"); | |
connectAttr -f ($R_ArmCtrl + "." + $StretchName) ($MD11 + ".input2X"); | |
shadingNode -asUtility multiplyDivide -n $MD12; | |
setAttr ($MD12 + ".operation") 1; | |
connectAttr -f ($MD10 + ".outputX") ($MD12 + ".input1X"); | |
connectAttr -f ($R_ArmCtrl + "." + $StretchName) ($MD12 + ".input2X"); | |
shadingNode -asUtility plusMinusAverage -n $PMA4; | |
setAttr ($PMA4 + ".operation") 1; | |
connectAttr -f ($MD11 + ".outputX") ($PMA4 + ".input1D[0]"); | |
setAttr ($PMA4 + ".input1D[1]")$ShoulderDist; | |
// $B2A1 is later connected to $R_JT2 | |
//connectAttr -f ($PMA4 + ".output1D") ($R_JT2 + ".translateX"); | |
shadingNode -asUtility plusMinusAverage -n $PMA5; | |
setAttr ($PMA5 + ".operation") 1; | |
connectAttr -f ($MD12 + ".outputX") ($PMA5 + ".input1D[0]"); | |
setAttr ($PMA5 + ".input1D[1]")$ElbowDist; | |
// Connected to $B2A2 Later | |
//connectAttr -f ($PMA5 + ".output1D") ($R_JT3 + ".translateX"); | |
// setting up the Pin atribute | |
//Pin setup for upper arm | |
shadingNode -asUtility multiplyDivide -n $MD15; | |
setAttr ($MD15 + ".operation") 1; | |
connectAttr -f ($MD7 + ".outputX") ($MD15 + ".input2X"); | |
connectAttr -f ($ShoulderDistDT + "Shape" + ".distance") ($MD15 + ".input1X"); | |
createNode condition -n $Cnd3; | |
setAttr ($Cnd3 + ".operation") 2; | |
connectAttr -f ($MD15 + ".outputX") ($Cnd3 + ".colorIfTrueR"); | |
connectAttr -f ($MD15 + ".outputX") ($Cnd3 + ".firstTerm"); | |
setAttr ($Cnd3 + ".secondTerm") $ShoulderDist; | |
setAttr ($Cnd3 + ".colorIfFalseR") $ShoulderDist; | |
shadingNode -asUtility blendTwoAttr -n $B2A1; | |
//connectAttr -f ($PMA4 + ".output1D") ($B2A1 + ".input[0]"); | |
connectAttr -f ($Cnd3 + ".outColorR") ($B2A1 + ".input[1]"); | |
connectAttr -f ($R_ArmCtrl + "." + $PinName) ($B2A1 + ".attributesBlender"); | |
connectAttr -f ($B2A1 + ".output") ($R_JT2 + ".translateX"); | |
// pin setup for lowwer arm | |
shadingNode -asUtility multiplyDivide -n $MD16; | |
setAttr ($MD16 + ".operation") 1; | |
connectAttr -f ($MD7 + ".outputX") ($MD16 + ".input2X"); | |
connectAttr -f ($ElbowDistDT + "Shape" + ".distance") ($MD16 + ".input1X"); | |
createNode condition -n $Cnd4; | |
setAttr ($Cnd4 + ".operation") 2; | |
connectAttr -f ($MD16 + ".outputX") ($Cnd4 + ".colorIfTrueR"); | |
connectAttr -f ($MD16 + ".outputX") ($Cnd4 + ".firstTerm"); | |
setAttr ($Cnd4 + ".secondTerm") $ElbowDist; | |
setAttr ($Cnd4 + ".colorIfFalseR") $ElbowDist; | |
shadingNode -asUtility blendTwoAttr -n $B2A2; | |
//connectAttr -f ($PMA5 + ".output1D") ($B2A2 + ".input[0]"); | |
connectAttr -f ($Cnd4 + ".outColorR") ($B2A2 + ".input[1]"); | |
connectAttr -f ($R_ArmCtrl + "." + $PinName) ($B2A2 + ".attributesBlender"); | |
connectAttr -f ($B2A2 + ".output") ($R_JT3 + ".translateX"); | |
// setting up the Slide atribute | |
shadingNode -asUtility multiplyDivide -n $MD17; | |
setAttr ($MD17 + ".operation") 1; | |
setAttr ($MD17 + ".input1X") $ChainLength; | |
connectAttr -f ($MD14 + ".outputX") ($MD17 + ".input2X"); | |
shadingNode -asUtility multiplyDivide -n $MD18; | |
setAttr ($MD18 + ".operation") 1; | |
connectAttr -f ($R_ArmCtrl + "." + $SlideName) ($MD18 + ".input2X"); | |
connectAttr -f ($MD17 + ".outputX") ($MD18 + ".input1X"); | |
shadingNode -asUtility multiplyDivide -n $MD19; | |
setAttr ($MD19 + ".operation") 1; | |
setAttr ($MD19 + ".input1X") $ChainLength; | |
connectAttr -f ($MD13 + ".outputX") ($MD19 + ".input2X"); | |
shadingNode -asUtility multiplyDivide -n $MD20; | |
setAttr ($MD20 + ".operation") 1; | |
connectAttr -f ($MD19 + ".outputX") ($MD20 + ".input1X"); | |
connectAttr -f ($R_ArmCtrl + "." + $SlideName) ($MD20 + ".input2X"); | |
createNode condition -n $Cnd5; | |
setAttr ($Cnd5 + ".operation") 4; | |
setAttr ($Cnd5 + ".secondTerm") 0; | |
connectAttr -f ($MD18 + ".outputX") ($Cnd5 + ".colorIfFalseR"); | |
connectAttr -f ($MD20 + ".outputX") ($Cnd5 + ".colorIfTrueR"); | |
connectAttr -f ($R_ArmCtrl + "." + $SlideName) ($Cnd5 + ".firstTerm"); | |
shadingNode -asUtility plusMinusAverage -n $PMA6; | |
setAttr ($PMA6 + ".operation") 1; | |
connectAttr -f ($PMA4 + ".output1D") ($PMA6 + ".input1D[0]"); | |
connectAttr -f ($Cnd5 + ".outColorR") ($PMA6 + ".input1D[1]"); | |
shadingNode -asUtility plusMinusAverage -n $PMA7; | |
setAttr ($PMA7 + ".operation") 2; | |
connectAttr -f ($PMA5 + ".output1D") ($PMA7 + ".input1D[0]"); | |
connectAttr -f ($Cnd5 + ".outColorR") ($PMA7 + ".input1D[1]"); | |
connectAttr -f ($PMA6 + ".output1D") ($B2A1 + ".input[0]"); | |
connectAttr -f ($PMA7 + ".output1D") ($B2A2 + ".input[0]"); | |
////////////////////////////////////////////////////////////////////////// | |
// Cleanup | |
shadingNode -asUtility multiplyDivide -n $MD21; | |
setAttr ($MD21 + ".operation") 1; | |
connectAttr -f ($StretchDistDT + "Shape"+ "." + "distance") ($MD21 + ".input1X"); | |
connectAttr -f ($MD7 + ".outputX") ($MD21 + ".input2X"); | |
createNode condition -n $Cnd6; | |
setAttr ($Cnd6 + ".operation") 2; | |
setAttr ($Cnd6 + ".secondTerm") $ChainLength; | |
setAttr ($Cnd6 + ".colorIfFalseR") $ChainLength; | |
connectAttr -f ($MD21 + ".outputX") ($Cnd6 + ".firstTerm"); | |
connectAttr -f ($MD21 + ".outputX") ($Cnd6 + ".colorIfTrueR"); | |
// connecting cond 6 to other mult nodes | |
connectAttr -f ($Cnd6 + ".outColorR") ($MD17 + ".input1X"); | |
connectAttr -f ($Cnd6 + ".outColorR") ($MD19 + ".input1X"); | |
// making so that slide works with pinning | |
shadingNode -asUtility plusMinusAverage -n $PMA8; | |
setAttr ($PMA8 + ".operation") 1; | |
setAttr ($PMA8 + ".input1D[0]") $ElbowDist; | |
connectAttr -f ($Cnd5 + ".outColorR") ($PMA8 + ".input1D[1]"); | |
connectAttr -f ($PMA8 + ".output1D") ($Cnd4 + ".secondTerm"); | |
connectAttr -f ($PMA8 + ".output1D") ($Cnd4 + ".colorIfFalseR"); | |
shadingNode -asUtility plusMinusAverage -n $PMA9; | |
setAttr ($PMA9 + ".operation") 2; | |
setAttr ($PMA9 + ".input1D[0]") $ShoulderDist; | |
connectAttr -f ($Cnd5 + ".outColorR") ($PMA9 + ".input1D[1]"); | |
connectAttr -f ($PMA9 + ".output1D") ($Cnd3 + ".secondTerm"); | |
connectAttr -f ($PMA9 + ".output1D") ($Cnd3 + ".colorIfFalseR"); | |
// Adding a last MD node so that mirroring works | |
shadingNode -asUtility multiplyDivide -n R_arm_MD_MirrorResult; | |
setAttr "R_arm_MD_MirrorResult.input1X" -1; | |
connectAttr -f ($Cnd1 + ".outColorR") ("R_arm_MD_MirrorResult" + ".input2X"); | |
connectAttr -f ("R_arm_MD_MirrorResult" + ".outputX") ($R_LocNameWrist + ".translateX"); | |
// Creating The Elbow CTRL | |
curve -d 1 -p -2 -2.88089e-007 0 -p -1 1.732051 0 -p 1 1.732051 0 -p 2 9.93411e-009 0 -p 1 -1.732051 0 -p -1 -1.732051 0 -p -2 -2.88089e-007 0 -p 3.97364e-008 9.93411e-009 -4 -p -1 1.732051 0 -p 3.97364e-008 9.93411e-009 -4 -p 1 1.732051 0 -p 3.97364e-008 9.93411e-009 -4 -p 2 9.93411e-009 0 -p 3.97364e-008 9.93411e-009 -4 -p 1 -1.732051 0 -p 3.97364e-008 9.93411e-009 -4 -p -1 -1.732051 0 -p 3.97364e-008 9.93411e-009 -4 -p -2 -2.88089e-007 0 -k 0 -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 -k 8 -k 9 -k 10 -k 11 -k 12 -k 13 -k 14 -k 15 -k 16 -k 17 -k 18 -n $R_ElbowCtrl ; | |
setAttr ($R_ElbowCtrl + ".overrideEnabled") 1; | |
setAttr ($R_ElbowCtrl + ".overrideColor") 18; | |
pointConstraint -offset 0 0 0 -weight 1 -n ($R_ElbowCtrl + "TEMP_const") $R_LocNameElbow $R_ElbowCtrl; | |
delete ($R_ElbowCtrl + "TEMP_const"); | |
pointConstraint -mo -weight 1 $R_ElbowCtrl $R_LocNameElbow; | |
float $MirrorElbowPos[] = `xform -q -t $R_LocNameElbow`; | |
xform -t $MirrorElbowPos[0] $MirrorElbowPos[1] ($MirrorElbowPos[2] - 15); | |
makeIdentity -apply true -t 1 -r 1 -s 1 -n 0 -pn 1; | |
parent $R_ElbowCtrl $R_RootName; | |
select -cl; | |
// checking if the user want IK FK setup upon mirror | |
int $Arm_IKFK_CB = `checkBox -q -v Arm_IKFK_Check`; | |
if ($Arm_IKFK_CB == 1){ | |
// creation of Bound Chain on Position of Locs | |
// Creating the IKFK Grear | |
/// Creat GEAR control | |
curve -d 1 -p -1.327953 0 -9.954337 -p 1.341144 0 -9.938909 -p 1.780851 0 -7.269811 -p 3.678533 0 -6.513824 -p 5.961923 0 -8.079797 -p 7.890462 0 -6.197544 -p 6.30906 0 -4.022152 -p 7.203902 0 -2.078185 -p 9.880714 0 -1.599907 -p 9.993845 0 1.032165 -p 7.353172 0 1.453142 -p 6.553317 0 3.642221 -p 8.128883 0 5.924288 -p 6.369816 0 7.795225 -p 4.211166 0 6.221865 -p 1.945528 0 7.247696 -p 1.442053 0 9.953875 -p -1.094204 0 9.985343 -p -1.496984 0 7.367271 -p -3.901078 0 6.416962 -p -6.135249 0 7.958855 -p -7.92888 0 6.184105 -p -6.349226 0 4.006574 -p -7.305829 0 1.671708 -p -9.961661 0 1.1997 -p -9.936487 0 -1.38061 -p -7.280655 0 -1.802271 -p -6.361813 0 -3.967214 -p -7.878532 0 -6.188799 -p -6.028261 0 -8.032777 -p -3.819263 0 -6.44683 -p -1.811656 0 -7.25239 -p -1.327953 0 -9.954336 -k 0 -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 -k 8 -k 9 -k 10 -k 11 -k 12 -k 13 -k 14 -k 15 -k 16 -k 17 -k 18 -k 19 -k 20 -k 21 -k 22 -k 23 -k 24 -k 25 -k 26 -k 27 -k 28 -k 29 -k 30 -k 31 -k 32 -n ($LR + "arm_GEAR_CTRL"); | |
//rename "curveShape1" ($LR + "arm_GEAR_CTRL_shape"); | |
addAttr -ln "IK_FK" -at double -min 0 -max 1 -dv 0 ($LR + "arm_GEAR_CTRL"); | |
setAttr -e-keyable true ($LR + "arm_GEAR_CTRL.IK_FK"); | |
setAttr ($LR + "arm_GEAR_CTRL" + ".overrideEnabled") 1; | |
setAttr ($LR + "arm_GEAR_CTRL" + ".overrideColor") 17; | |
// F | |
curve -d 1 -p -0.8 0 -1.6 -p -0.8 0 -2.4 -p -3.6 0 -2.4 -p -3.6 0 2.4 -p -2.8 0 2.4 -p -2.8 0 0.4 -p -1 0 0.4 -p -1 0 -0.4 -p -2.8 0 -0.4 -p -2.8 0 -1.6 -p -0.8 0 -1.6 -k 0 -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 -k 8 -k 9 -k 10 -n ($LR + "F_CTRL_Curve"); | |
setAttr ($LR + "F_CTRL_Curve" + ".overrideEnabled") 1; | |
setAttr ($LR + "F_CTRL_Curve" + ".overrideColor") 17; | |
setAttr ($LR + "F_CTRL_Curve" + ".visibility") 0; | |
// I | |
curve -d 1 -p -2.4 0 -2.4 -p -1.6 0 -2.4 -p -1.6 0 2.4 -p -2.4 0 2.4 -p -2.4 0 -2.4 -k 0 -k 1 -k 2 -k 3 -k 4 -n ($LR + "I_CTRL_Curve"); | |
setAttr ($LR + "I_CTRL_Curve" + ".overrideEnabled") 1; | |
setAttr ($LR + "I_CTRL_Curve" + ".overrideColor") 17; | |
// K | |
curve -d 1 -p 0.6 0 -2.4 -p 1.4 0 -2.4 -p 1.4 0 -0.2 -p 3.2 0 -2.4 -p 4.2 0 -2.4 -p 2.2 0 0 -p 4.2 0 2.4 -p 3.2 0 2.4 -p 1.4 0 0.2 -p 1.4 0 2.4 -p 0.6 0 2.4 -p 0.6 0 -2.4 -k 0 -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 -k 8 -k 9 -k 10 -k 11 -n ($LR + "K_CTRL_Curve"); | |
setAttr ($LR + "K_CTRL_Curve" + ".overrideEnabled") 1; | |
setAttr ($LR + "K_CTRL_Curve" + ".overrideColor") 17; | |
parent ($LR + "F_CTRL_Curve") ($LR + "I_CTRL_Curve") ($LR + "K_CTRL_Curve") ($LR + "arm_GEAR_CTRL"); | |
setDrivenKeyframe -currentDriver ($LR + "arm_GEAR_CTRL" + ".IK_FK") ($LR + "F_CTRL_Curve" + ".visibility"); | |
setDrivenKeyframe -currentDriver ($LR + "arm_GEAR_CTRL" + ".IK_FK") ($LR + "I_CTRL_Curve" + ".visibility"); | |
setAttr ($LR + "arm_GEAR_CTRL" + ".IK_FK") 1; | |
setAttr ($LR + "F_CTRL_Curve" + ".visibility") 1; | |
setAttr ($LR + "I_CTRL_Curve" + ".visibility") 0; | |
setDrivenKeyframe -currentDriver ($LR + "arm_GEAR_CTRL" + ".IK_FK") ($LR + "F_CTRL_Curve" + ".visibility"); | |
setDrivenKeyframe -currentDriver ($LR + "arm_GEAR_CTRL" + ".IK_FK") ($LR + "I_CTRL_Curve" + ".visibility"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "K_CTRL_Curve" + ".tx"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "K_CTRL_Curve" + ".ty"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "K_CTRL_Curve" + ".tz"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "K_CTRL_Curve" + ".rx"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "K_CTRL_Curve" + ".ry"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "K_CTRL_Curve" + ".rz"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "K_CTRL_Curve" + ".sx"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "K_CTRL_Curve" + ".sy"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "K_CTRL_Curve" + ".sz"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "K_CTRL_Curve" + ".v"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "I_CTRL_Curve" + ".tx"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "I_CTRL_Curve" + ".ty"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "I_CTRL_Curve" + ".tz"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "I_CTRL_Curve" + ".rx"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "I_CTRL_Curve" + ".ry"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "I_CTRL_Curve" + ".rz"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "I_CTRL_Curve" + ".sx"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "I_CTRL_Curve" + ".sy"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "I_CTRL_Curve" + ".sz"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "I_CTRL_Curve" + ".v"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "F_CTRL_Curve" + ".tx"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "F_CTRL_Curve" + ".ty"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "F_CTRL_Curve" + ".tz"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "F_CTRL_Curve" + ".rx"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "F_CTRL_Curve" + ".ry"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "F_CTRL_Curve" + ".rz"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "F_CTRL_Curve" + ".sx"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "F_CTRL_Curve" + ".sy"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "F_CTRL_Curve" + ".sz"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "F_CTRL_Curve" + ".v"); | |
xform -r -t -30 0 -30 -s 0.5 0.5 0.5 ($LR + "arm_GEAR_CTRL"); | |
// creating FK arm CTRLs | |
circle -c 0 0 0 -nr 0 1 0 -sw 360 -r 4 -d 3 -ut 0 -tol 0.01 -s 8 -ch 1 -n ($FK1 + "CTRL"); | |
xform -ro 0 0 -90 ($FK1 + "CTRL"); | |
makeIdentity -apply true -t 1 -r 1 -s 1 -n 0 -pn 1 ($FK1 + "CTRL"); | |
select -r ($FK1 + "CTRL" + "Shape"); | |
select -add $FK1; | |
parent -r -s; | |
delete ($FK1 + "CTRL"); | |
circle -c 0 0 0 -nr 0 1 0 -sw 360 -r 4 -d 3 -ut 0 -tol 0.01 -s 8 -ch 1 -n ($FK2 + "CTRL"); | |
xform -ro 0 0 -90 ($FK2 + "CTRL"); | |
makeIdentity -apply true -t 1 -r 1 -s 1 -n 0 -pn 1 ($FK2 + "CTRL"); | |
select -r ($FK2 + "CTRL" + "Shape"); | |
select -add $FK2; | |
parent -r -s; | |
delete ($FK2 + "CTRL"); | |
circle -c 0 0 0 -nr 0 1 0 -sw 360 -r 4 -d 3 -ut 0 -tol 0.01 -s 8 -ch 1 -n ($FK3 + "CTRL"); | |
xform -ro 0 0 -90 ($FK3 + "CTRL"); | |
makeIdentity -apply true -t 1 -r 1 -s 1 -n 0 -pn 1 ($FK3 + "CTRL"); | |
select -r ($FK3 + "CTRL" + "Shape"); | |
select -add $FK3; | |
parent -r -s; | |
delete ($FK3 + "CTRL"); | |
// Parenting the Bound to IK and FK arm; | |
select -r $R_JT1 $FK1 $Bn1; | |
parentConstraint -weight 1 -n ($Bn1 + "ParConst"); | |
select -r $R_JT2 $FK2 $Bn2; | |
parentConstraint -weight 1 -n ($Bn2 + "ParConst"); | |
select -r $R_JT3 $FK3 $Bn3; | |
parentConstraint -weight 1 -n ($Bn3 + "ParConst"); | |
// SDK IK FK mode | |
setAttr ($Bn1 + "ParConst" + "." + $R_JT1 + "W0") 0; | |
setAttr ($Bn2 + "ParConst" + "." + $R_JT2 + "W0") 0; | |
setAttr ($Bn3 + "ParConst" + "." + $R_JT3 + "W0") 0; | |
setDrivenKeyframe -currentDriver ($LR + "arm_GEAR_CTRL" + ".IK_FK") ($Bn1 + "ParConst" + "." + $R_JT1 + "W0"); | |
setDrivenKeyframe -currentDriver ($LR + "arm_GEAR_CTRL" + ".IK_FK") ($Bn1 + "ParConst" + "." + $FK1 + "W1"); | |
setDrivenKeyframe -currentDriver ($LR + "arm_GEAR_CTRL" + ".IK_FK") ($Bn2 + "ParConst" + "." + $R_JT2 + "W0"); | |
setDrivenKeyframe -currentDriver ($LR + "arm_GEAR_CTRL" + ".IK_FK") ($Bn2 + "ParConst" + "." + $FK2 + "W1"); | |
setDrivenKeyframe -currentDriver ($LR + "arm_GEAR_CTRL" + ".IK_FK") ($Bn3 + "ParConst" + "." + $R_JT3 + "W0"); | |
setDrivenKeyframe -currentDriver ($LR + "arm_GEAR_CTRL" + ".IK_FK") ($Bn3 + "ParConst" + "." + $FK3 + "W1"); | |
setAttr ($LR + "arm_GEAR_CTRL" + ".IK_FK") 0; | |
setAttr ($Bn1 + "ParConst" + "." + $R_JT1 + "W0") 1; | |
setAttr ($Bn1 + "ParConst" + "." + $FK1 + "W1") 0; | |
setAttr ($Bn2 + "ParConst" + "." + $R_JT2 + "W0") 1; | |
setAttr ($Bn2 + "ParConst" + "." + $FK2 + "W1") 0; | |
setAttr ($Bn3 + "ParConst" + "." + $R_JT3 + "W0") 1; | |
setAttr ($Bn3 + "ParConst" + "." + $FK3 + "W1") 0; | |
setDrivenKeyframe -currentDriver ($LR + "arm_GEAR_CTRL" + ".IK_FK") ($Bn1 + "ParConst" + "." + $R_JT1 + "W0"); | |
setDrivenKeyframe -currentDriver ($LR + "arm_GEAR_CTRL" + ".IK_FK") ($Bn1 + "ParConst" + "." + $FK1 + "W1"); | |
setDrivenKeyframe -currentDriver ($LR + "arm_GEAR_CTRL" + ".IK_FK") ($Bn2 + "ParConst" + "." + $R_JT2 + "W0"); | |
setDrivenKeyframe -currentDriver ($LR + "arm_GEAR_CTRL" + ".IK_FK") ($Bn2 + "ParConst" + "." + $FK2 + "W1"); | |
setDrivenKeyframe -currentDriver ($LR + "arm_GEAR_CTRL" + ".IK_FK") ($Bn3 + "ParConst" + "." + $R_JT3 + "W0"); | |
setDrivenKeyframe -currentDriver ($LR + "arm_GEAR_CTRL" + ".IK_FK") ($Bn3 + "ParConst" + "." + $FK3 + "W1"); | |
select -cl; | |
//Cleanup of IK FK arm setup | |
parent $Bn1 $R_RootName ; | |
parent $FK1 $R_RootName ; | |
parent ($LR + "arm_GEAR_CTRL") $R_RootName ; | |
} else { | |
delete $Bn1; | |
delete $FK1; | |
} | |
}else{ | |
warning "Must Create Arm Before Mirroring"; | |
} | |
} | |
proc DeleteSetupArm(){ | |
string $DeleteConfirm = `confirmDialog -title "Delete Arm" -message "Are you sure?" | |
-button "Yes" -button "No" -defaultButton "Yes" | |
-cancelButton "No" -dismissString "No"`; | |
if ($DeleteConfirm == "Yes"){ | |
string $R_RootName = "R_arm_Root"; | |
if( `objExists $R_RootName` ) { | |
select -r $R_RootName; | |
delete; | |
select -cl; | |
} | |
string $L_RootName = "L_arm_Root"; | |
if( `objExists $L_RootName` ) { | |
select -r $L_RootName; | |
delete; | |
select -cl; | |
OptimizeScene; | |
} else { | |
warning("Setup Does not Exist"); | |
} | |
} | |
} | |
/*==========================================================LEG=PROCS=================================================================*/ | |
proc LegCreateLOCS(){ | |
string $LR = "L_"; | |
string $LocNameHip = ($LR + "leg_IK_Hip_LOC"); | |
string $LocNameKnee = ($LR + "leg_IK_Knee_LOC"); | |
string $LocNameAnkle = ($LR + "leg_IK_Ankle_LOC"); | |
string $CTRLdistLocName = ($LR + "leg_CTRLdist_LOC"); | |
string $SoftBlendLocName = ($LR + "leg_softBlend_LOC"); | |
if( `objExists $LocNameHip` ){ | |
warning "Locators Already Created"; | |
} else { | |
select -cl ; | |
spaceLocator -n $LocNameHip -p 0 0 0; | |
xform -t 10 30 0; | |
spaceLocator -n $LocNameKnee -p 0 0 0; | |
xform -t 10 20 5; | |
spaceLocator -n $LocNameAnkle -p 0 0 0; | |
xform -t 10 10 0; | |
select -r $LocNameHip; | |
select -add $LocNameKnee; | |
select -add $LocNameAnkle; | |
string $BoneLocs[]=`ls -sl`; | |
int $amount=`size($BoneLocs)`; | |
for ($n=0; $n<$amount; $n++) { | |
setAttr ($BoneLocs[$n] + ".localScaleX") 5; | |
setAttr ($BoneLocs[$n] + ".localScaleY") 5; | |
setAttr ($BoneLocs[$n] + ".localScaleZ") 5; | |
//setAttr ($BoneLocs[$n] + ".overrideEnabled") 1; | |
//setAttr ($BoneLocs[$n] + ".overrideColor") 17; | |
} | |
} | |
} | |
proc CreateLeg(){ | |
string $AllRoo[] = {"xyz", "xyz", "yzx", "zxy", "xzy", "yxz", "zyx" }; | |
int $L_RooIndex = `optionMenu -q -sl LegRoo`; | |
string $LR = "L_"; | |
string $LocNameHip = ($LR + "leg_IK_Hip_LOC"); | |
string $LocNameKnee = ($LR + "leg_IK_Knee_LOC"); | |
string $LocNameAnkle = ($LR + "leg_IK_Ankle_LOC"); | |
string $CTRLdistLocName = ($LR + "leg_CTRLdist_LOC"); | |
string $SoftBlendLocName = ($LR + "leg_softBlend_LOC"); | |
// Joint Sting names | |
string $JT1 = ($LR + "leg_IK_Hip_01"); | |
string $JT2 = ($LR + "leg_IK_Knee_01"); | |
string $JT3 = ($LR + "leg_IK_Ankle_01"); | |
// Attrib Naming Strings | |
string $SlideName = ($LR + "leg_slideP"); | |
string $StretchName = ($LR + "leg_stretchP"); | |
string $SoftName = ($LR + "leg_softP"); | |
string $PinName = ($LR + "leg_pinP"); | |
// Misc String Names | |
string $legCtrl = ($LR + "leg_IK_CTRL"); | |
string $L_RootName = "L_leg_Root"; | |
// Distance tool Name strings (-DT distance tool) | |
string $ControlDistDT = ($LR + "leg_controlDist"); | |
string $SoftDistDT = ($LR + "leg_softDist"); | |
string $HipDistDT = ($LR + "leg_HipDist"); | |
string $KneeDistDT = ($LR + "leg_KneeDist"); | |
string $StretchDistDT = ($LR + "leg_stretchDist"); | |
// Node Name Strings | |
//Cnd Nodes | |
string $Cnd1 = ($LR + "leg_Cond1"); | |
string $Cnd2 = ($LR + "leg_Cond2"); | |
// Pin CND Nodes | |
string $Cnd3 = ($LR + "leg_Cond3"); | |
string $Cnd4 = ($LR + "leg_Cond4"); | |
// Slide CND Node | |
string $Cnd5 = ($LR + "leg_Cond5"); | |
string $Cnd6 = ($LR + "leg_Cond6"); | |
//PMA nodes | |
string $PMA1 = ($LR + "leg_PMA1"); | |
string $PMA2 = ($LR + "leg_PMA2"); | |
string $PMA3 = ($LR + "leg_PMA3"); | |
// Pma nodes for Stretch soft IK | |
string $PMA4 = ($LR + "leg_PMA4"); | |
string $PMA5 = ($LR + "leg_PMA5"); | |
// Pma nodes for Slide | |
string $PMA6 = ($LR + "leg_PMA6"); | |
string $PMA7 = ($LR + "leg_PMA7"); | |
string $PMA8 = ($LR + "leg_PMA8"); | |
string $PMA9 = ($LR + "leg_PMA9"); | |
//Multiply Divide Nodes | |
string $MD1 = ($LR + "leg_MD1"); | |
string $MD2 = ($LR + "leg_MD2"); | |
string $MD3 = ($LR + "leg_MD3"); | |
string $MD4 = ($LR + "leg_MD4"); | |
string $MD5 = ($LR + "leg_MD5"); | |
string $MD6 = ($LR + "leg_MD6"); | |
//Multiply Divide Nodes for Stretch Soft IK | |
string $MD7 = ($LR + "leg_MD7"); | |
string $MD8 = ($LR + "leg_MD8"); | |
string $MD9 = ($LR + "leg_MD9"); | |
string $MD10 = ($LR + "leg_MD10"); | |
string $MD11 = ($LR + "leg_MD11"); | |
string $MD12 = ($LR + "leg_MD12"); | |
// Special MD nodes for stretch | |
string $MD13 = ($LR + "leg_MD_HipByChainLen"); | |
string $MD14 = ($LR + "leg_MD_KneeByChainLen"); | |
// Pin MD nodes | |
string $MD15 = ($LR + "leg_MD15"); | |
string $MD16 = ($LR + "leg_MD16"); | |
// Slide MD nodes | |
string $MD17 = ($LR + "leg_MD17"); | |
string $MD18 = ($LR + "leg_MD18"); | |
string $MD19 = ($LR + "leg_MD19"); | |
string $MD20 = ($LR + "leg_MD20"); | |
string $MD21 = ($LR + "leg_MD21"); | |
string $MD22 = ($LR + "leg_MD22"); | |
// Pin Blend ATTR nodes | |
string $B2A1 = ($LR + "leg_BL2Atr01"); | |
string $B2A2 = ($LR + "leg_BL2Atr02"); | |
// creation of joins on locators | |
// Bound leg names | |
string $Bn1 = ($LR + "leg_Bound_Hip_01"); | |
string $Bn2 = ($LR + "leg_Bound_Knee_01"); | |
string $Bn3 = ($LR + "leg_Bound_Ankle_01"); | |
// FK leg names | |
string $FK1 = ($LR + "leg_FK_Hip_01"); | |
string $FK2 = ($LR + "leg_FK_Knee_01"); | |
string $FK3 = ($LR + "leg_FK_Ankle_01"); | |
if ( `objExists $L_RootName`){ | |
warning "Leg has already been created"; | |
}else{ | |
if( `objExists $LocNameHip`){ | |
select -cl ; | |
float $Loc1[] = `xform -worldSpace -q -translation $LocNameHip`; | |
float $Loc2[] = `xform -worldSpace -q -translation $LocNameKnee`; | |
float $Loc3[] = `xform -worldSpace -q -translation $LocNameAnkle`; | |
joint -p $Loc1[0] $Loc1[1] $Loc1[2] ; | |
joint -p $Loc2[0] $Loc2[1] $Loc2[2] ; | |
joint -e -zso -oj xyz -sao yup joint1; | |
joint -p $Loc3[0] $Loc3[1] $Loc3[2] ; | |
joint -e -zso -oj xyz -sao yup joint2; | |
rename "joint1" $JT1; | |
rename "joint2" $JT2; | |
rename "joint3" $JT3; | |
////////////////////////////////////////////////////////////////////// | |
// Creating the leg Control | |
circle -c 0 0 0 -nr 0 1 0 -sw 360 -r 4 -d 3 -ut 0 -tol 0.01 -s 8 -ch 0 -n $legCtrl; | |
// adding atributes to the leg CTRL | |
addAttr -ln "Ik_Controls" -at double -dv 0 -k true; | |
setAttr -lock true ($legCtrl + ".Ik_Controls"); | |
addAttr -ln $SlideName -nn "Slide" -at double -max 1 -min -1 -dv 0 -k true; | |
addAttr -ln $StretchName -nn "Stretch" -at double -max 1 -min 0 -dv 0 -k true; | |
addAttr -ln $SoftName -nn "Soft" -at double -max 1 -min 0 -dv 0 -k true; | |
addAttr -ln $PinName -nn "Pin" -at double -max 1 -min 0 -dv 0 -k true; | |
xform -ro 0 0 -90 $legCtrl; | |
setAttr ($legCtrl + ".overrideEnabled") 1; | |
setAttr ($legCtrl + ".overrideColor") 18; | |
// creating Ankle control dist Loc | |
spaceLocator -n $CTRLdistLocName -p 0 0 0; | |
parent ($LR + "leg_CTRLdist_LOC") $legCtrl; | |
spaceLocator -n $SoftBlendLocName -p 0 0 0; | |
parent ($LR + "leg_softBlend_LOC") $legCtrl; | |
// moving CTRL to Ankle | |
select -r $LocNameAnkle; | |
select -add $legCtrl; | |
pointConstraint -offset 0 0 0 -n CTRLtoAnkleConst; | |
select -r CTRLtoAnkleConst; | |
doDelete; | |
makeIdentity -apply true -t 1 -r 1 -s 1 -n 0 -pn 1 $legCtrl; | |
////////////////////////////////////////////////////////////////////// | |
// create Root node | |
group -em -n $L_RootName; | |
connectAttr -f ($L_RootName + ".scaleX") ($L_RootName + ".scaleY"); | |
connectAttr -f ($L_RootName + ".scaleX") ($L_RootName + ".scaleZ"); | |
setAttr -lock true -keyable false -channelBox false ($L_RootName + ".sy"); | |
setAttr -lock true -keyable false -channelBox false ($L_RootName + ".sz"); | |
////////////////////////////////////////////////////////////////////// | |
// Parenting all the things | |
parent $JT1 $LocNameHip; | |
parent $LocNameAnkle $LocNameHip; | |
parent $LocNameHip $L_RootName; | |
parent $LocNameKnee $L_RootName; | |
parent $SoftBlendLocName $L_RootName; | |
parent $legCtrl $L_RootName; | |
////////////////////////////////////////////////////////////////////// | |
ikHandle -n ($LR + "leg_IK") -sj $JT1 -ee $JT3; | |
poleVectorConstraint $LocNameKnee ($LR + "leg_IK"); | |
parent ($LR + "leg_IK") $SoftBlendLocName; | |
// aim constrain the Hip loc to the Hand CTRL | |
// aim for Left hand side | |
aimConstraint -mo -weight 1 -aimVector 0 -1 0 -upVector 0 1 0 -worldUpType "object" -worldUpObject $L_RootName $legCtrl $LocNameHip; | |
// aim for Right hand mirrored side | |
// creation of distance tools | |
distanceDimension -sp 0 0 -100 -ep 50 0 -100 ; | |
distanceDimension -sp 0 0 -90 -ep 50 0 -90 ; | |
distanceDimension -sp 0 0 -80 -ep 50 0 -80 ; | |
distanceDimension -sp 0 0 -70 -ep 50 0 -70 ; | |
distanceDimension -sp 0 0 -60 -ep 50 0 -60 ; | |
rename "distanceDimension1" $ControlDistDT; | |
rename "distanceDimension2" $SoftDistDT; | |
rename "distanceDimension3" $HipDistDT; | |
rename "distanceDimension4" $KneeDistDT; | |
rename "distanceDimension5" $StretchDistDT; | |
connectAttr -f ($LocNameHip + ".worldPosition[0]")($ControlDistDT + "Shape.startPoint"); | |
connectAttr -f ($CTRLdistLocName + ".worldPosition[0]")($ControlDistDT + "Shape.endPoint"); | |
connectAttr -f ($LocNameAnkle + ".worldPosition[0]")($SoftDistDT + "Shape.startPoint"); | |
connectAttr -f ($SoftBlendLocName + ".worldPosition[0]")($SoftDistDT + "Shape.endPoint"); | |
connectAttr -f ($LocNameHip + ".worldPosition[0]")($HipDistDT + "Shape.startPoint"); | |
connectAttr -f ($LocNameKnee + ".worldPosition[0]")($HipDistDT + "Shape.endPoint"); | |
connectAttr -f ($LocNameKnee + ".worldPosition[0]")($KneeDistDT + "Shape.startPoint"); | |
connectAttr -f ($SoftBlendLocName + ".worldPosition[0]")($KneeDistDT + "Shape.endPoint"); | |
connectAttr -f ($LocNameHip + ".worldPosition[0]")($StretchDistDT + "Shape.startPoint"); | |
connectAttr -f ($SoftBlendLocName + ".worldPosition[0]")($StretchDistDT + "Shape.endPoint"); | |
// This will cause problems if any of these are already in the scene. | |
select -r locator1 locator2 locator3 locator4 locator5 locator6 locator7 locator8 locator9 locator10 ; | |
doDelete; | |
select -r $ControlDistDT $SoftDistDT $HipDistDT $KneeDistDT $StretchDistDT ; | |
group -n ($LR + "leg_DistTools_GRP"); | |
parent ($LR + "leg_DistTools_GRP") $L_RootName; | |
setAttr ($LR + "leg_DistTools_GRP" + ".visibility") 0; | |
////////////////////////////////////////////////////////////////////// | |
// finding the chain length | |
float $HipDist = `getAttr ($HipDistDT + "Shape.distance")`; | |
float $KneeDist = `getAttr ($KneeDistDT + "Shape.distance")`; | |
float $ChainLength = ($HipDist + $KneeDist); | |
//print $ChainLength; | |
// Creating all the nodes | |
/* | |
Normalising the Root Scale And working that into the node network. | |
*/ | |
// Create the Fith Multiply Divide Node | |
shadingNode -asUtility multiplyDivide -n $MD5; | |
setAttr ($MD5 + ".operation") 2; | |
setAttr ($MD5 + ".input1X") 1; | |
connectAttr -f ($L_RootName + ".scaleX") ($MD5 + ".input2X"); | |
// Create the Sixth Multiply Divide Node | |
shadingNode -asUtility multiplyDivide -n $MD6; | |
setAttr ($MD6 + ".operation") 1; | |
connectAttr -f ($MD5 + ".outputX") ($MD6 + ".input2X"); | |
connectAttr -f ($ControlDistDT + "Shape.distance") ($MD6 + ".input1X"); | |
////////////////////////////////////////////////////////////////////// | |
// create the First condition node | |
createNode condition -n $Cnd1; | |
setAttr ($Cnd1 + ".operation") 2; | |
connectAttr -f ($MD6 + ".outputX")($Cnd1 + ".firstTerm"); | |
// create the First plusMinusAverage node | |
shadingNode -asUtility plusMinusAverage -n $PMA1; | |
setAttr ($PMA1 + ".operation") 2; | |
setAttr ($PMA1 + ".input1D[0]") $ChainLength; | |
connectAttr -f ($legCtrl + "." + $SoftName) ($PMA1 + ".input1D[1]"); | |
connectAttr -f ($PMA1 + ".output1D") ($Cnd1 + ".secondTerm"); | |
connectAttr -f ($MD6 + ".outputX")($Cnd1 + ".colorIfFalseR"); | |
// create the Second condition node | |
createNode condition -n $Cnd2; | |
setAttr ($Cnd2 + ".operation") 2; | |
connectAttr -f ($legCtrl + "." + $SoftName) ($Cnd2 + ".firstTerm"); | |
setAttr ($Cnd2 + ".colorIfFalseR") $ChainLength; | |
// create the Second plusMinusAverage node | |
shadingNode -asUtility plusMinusAverage -n $PMA2; | |
setAttr ($PMA2 + ".operation") 2; | |
connectAttr -f ($MD6 + ".outputX")($PMA2 + ".input1D[0]"); | |
connectAttr -f ($PMA1 + ".output1D") ($PMA2 + ".input1D[1]"); | |
// Create the Fist Multiply Divide Node | |
shadingNode -asUtility multiplyDivide -n $MD1; | |
setAttr ($MD1 + ".operation") 2; | |
connectAttr -f ($legCtrl + "." + $SoftName) ($MD1 + ".input2X"); | |
connectAttr -f ($PMA2 + ".output1D") ($MD1 + ".input1X"); | |
// Create the Second Multiply Divide Node | |
shadingNode -asUtility multiplyDivide -n $MD2; | |
setAttr ($MD2 + ".operation") 1; | |
setAttr ($MD2 + ".input1X") -1; | |
connectAttr -f ($MD1 + ".outputX") ($MD2 + ".input2X"); | |
// Create the Third Multiply Divide Node | |
shadingNode -asUtility multiplyDivide -n $MD3; | |
setAttr ($MD3 + ".operation") 3; | |
setAttr ($MD3 + ".input1X") 2.718282; | |
connectAttr -f ($MD2 + ".outputX")($MD3 + ".input2X"); | |
// Create the Forth Multiply Divide Node | |
shadingNode -asUtility multiplyDivide -n $MD4; | |
setAttr ($MD4 + ".operation") 1; | |
connectAttr -f ($legCtrl + "." + $SoftName) ($MD4 + ".input1X"); | |
connectAttr -f ($MD3 + ".outputX") ($MD4 + ".input2X"); | |
// create the third plusMinusAverage node | |
shadingNode -asUtility plusMinusAverage -n $PMA3; | |
setAttr ($PMA3 + ".operation") 2; | |
setAttr ($PMA3 + ".input1D[0]")$ChainLength; | |
connectAttr -f ($MD4 + ".outputX") ($PMA3 + ".input1D[1]"); | |
connectAttr -f ($PMA3 + ".output1D") ($Cnd2 + ".colorIfTrueR"); | |
// Finishing the nested condition nodes | |
connectAttr -f ($Cnd2 + ".outColorR") ($Cnd1 + ".colorIfTrueR"); | |
//connectAttr -f ($Cnd1 + ".outColorR") ($LocNameAnkle + ".translateX"); | |
/*=======================================================================================================================================*/ | |
shadingNode -asUtility multiplyDivide -n $MD22; | |
setAttr ($MD22+ ".input1X") -1; | |
connectAttr -f ($Cnd1 + ".outColorR") ($MD22 + ".input2X"); | |
connectAttr -f ($MD22 + ".outputX") ($LocNameAnkle + ".translateY"); | |
// point constraining the SoftBlend Loc to Both AnkleLOC and leg CTRL | |
select -cl ; | |
select -r $LocNameAnkle; | |
select -add $legCtrl; | |
select -add $SoftBlendLocName; | |
pointConstraint -tl -n ($SoftBlendLocName + "PointConst01"); | |
select -cl ; | |
// creating set driven keys on the Soft blend loc and Stretch vlaues | |
setAttr ($legCtrl + "." + $StretchName) 1; | |
setAttr ($SoftBlendLocName + "PointConst01"+ "." + $LocNameAnkle + "W0") 0; | |
setAttr ($SoftBlendLocName + "PointConst01"+ "." + $legCtrl + "W1") 1; | |
setDrivenKeyframe -currentDriver ($legCtrl + "." + $StretchName) ($SoftBlendLocName + "PointConst01" + "." + $LocNameAnkle + "W0"); | |
setDrivenKeyframe -currentDriver ($legCtrl + "." + $StretchName) ($SoftBlendLocName + "PointConst01" + "." + $legCtrl + "W1"); | |
//////////////////////////////////////////// | |
setAttr ($legCtrl + "." + $StretchName) 0; | |
setAttr ($SoftBlendLocName + "PointConst01"+ "." + $LocNameAnkle + "W0") 1; | |
setAttr ($SoftBlendLocName + "PointConst01"+ "." + $legCtrl + "W1") 0; | |
setDrivenKeyframe -currentDriver ($legCtrl + "." + $StretchName) ($SoftBlendLocName + "PointConst01" + "." + $LocNameAnkle + "W0"); | |
setDrivenKeyframe -currentDriver ($legCtrl + "." + $StretchName) ($SoftBlendLocName + "PointConst01" + "." + $legCtrl + "W1"); | |
// Creating the Stretch soft IK setup | |
shadingNode -asUtility multiplyDivide -n $MD7; | |
setAttr ($MD1 + ".operation") 1; | |
setAttr ($MD7 + ".input1X") 1; | |
connectAttr -f ($L_RootName + ".scaleX") ($MD7 + ".input2X"); | |
shadingNode -asUtility multiplyDivide -n $MD8; | |
setAttr ($MD8 + ".operation") 1; | |
connectAttr -f ($MD7 + ".outputX") ($MD8 + ".input1X"); | |
connectAttr -f ($SoftDistDT + "Shape" + ".distance") ($MD8 + ".input2X"); | |
// Special Node 1 | |
shadingNode -asUtility multiplyDivide -n $MD13; | |
setAttr ($MD13 + ".operation") 2; | |
setAttr ($MD13 + ".input1X") $HipDist; | |
setAttr ($MD13 + ".input2X") $ChainLength; | |
// Special Node 2 | |
shadingNode -asUtility multiplyDivide -n $MD14; | |
setAttr ($MD14 + ".operation") 2; | |
setAttr ($MD14 + ".input1X") $KneeDist; | |
setAttr ($MD14 + ".input2X") $ChainLength; | |
shadingNode -asUtility multiplyDivide -n $MD9; | |
setAttr ($MD9 + ".operation") 1; | |
connectAttr -f ($MD8 + ".outputX") ($MD9 + ".input1X"); | |
connectAttr -f ($MD13 + ".outputX") ($MD9 + ".input2X"); | |
shadingNode -asUtility multiplyDivide -n $MD10; | |
setAttr ($MD10 + ".operation") 1; | |
connectAttr -f ($MD8 + ".outputX") ($MD10 + ".input1X"); | |
connectAttr -f ($MD14 + ".outputX") ($MD10 + ".input2X"); | |
//////////////////////////////////////////////////////////// | |
shadingNode -asUtility multiplyDivide -n $MD11; | |
setAttr ($MD11 + ".operation") 1; | |
connectAttr -f ($MD9 + ".outputX") ($MD11 + ".input1X"); | |
connectAttr -f ($legCtrl + "." + $StretchName) ($MD11 + ".input2X"); | |
shadingNode -asUtility multiplyDivide -n $MD12; | |
setAttr ($MD12 + ".operation") 1; | |
connectAttr -f ($MD10 + ".outputX") ($MD12 + ".input1X"); | |
connectAttr -f ($legCtrl + "." + $StretchName) ($MD12 + ".input2X"); | |
shadingNode -asUtility plusMinusAverage -n $PMA4; | |
setAttr ($PMA4 + ".operation") 1; | |
connectAttr -f ($MD11 + ".outputX") ($PMA4 + ".input1D[0]"); | |
setAttr ($PMA4 + ".input1D[1]")$HipDist; | |
// $B2A1 is later connected to $JT2 | |
//connectAttr -f ($PMA4 + ".output1D") ($JT2 + ".translateX"); | |
shadingNode -asUtility plusMinusAverage -n $PMA5; | |
setAttr ($PMA5 + ".operation") 1; | |
connectAttr -f ($MD12 + ".outputX") ($PMA5 + ".input1D[0]"); | |
setAttr ($PMA5 + ".input1D[1]")$KneeDist; | |
// Connected to $B2A2 Later | |
//connectAttr -f ($PMA5 + ".output1D") ($JT3 + ".translateX"); | |
// setting up the Pin atribute | |
//Pin setup for upper leg | |
shadingNode -asUtility multiplyDivide -n $MD15; | |
setAttr ($MD15 + ".operation") 1; | |
connectAttr -f ($MD7 + ".outputX") ($MD15 + ".input2X"); | |
connectAttr -f ($HipDistDT + "Shape" + ".distance") ($MD15 + ".input1X"); | |
createNode condition -n $Cnd3; | |
setAttr ($Cnd3 + ".operation") 2; | |
connectAttr -f ($MD15 + ".outputX") ($Cnd3 + ".colorIfTrueR"); | |
connectAttr -f ($MD15 + ".outputX") ($Cnd3 + ".firstTerm"); | |
setAttr ($Cnd3 + ".secondTerm") $HipDist; | |
setAttr ($Cnd3 + ".colorIfFalseR") $HipDist; | |
shadingNode -asUtility blendTwoAttr -n $B2A1; | |
//connectAttr -f ($PMA4 + ".output1D") ($B2A1 + ".input[0]"); | |
connectAttr -f ($Cnd3 + ".outColorR") ($B2A1 + ".input[1]"); | |
connectAttr -f ($legCtrl + "." + $PinName) ($B2A1 + ".attributesBlender"); | |
connectAttr -f ($B2A1 + ".output") ($JT2 + ".translateX"); | |
// pin setup for lowwer leg | |
shadingNode -asUtility multiplyDivide -n $MD16; | |
setAttr ($MD16 + ".operation") 1; | |
connectAttr -f ($MD7 + ".outputX") ($MD16 + ".input2X"); | |
connectAttr -f ($KneeDistDT + "Shape" + ".distance") ($MD16 + ".input1X"); | |
createNode condition -n $Cnd4; | |
setAttr ($Cnd4 + ".operation") 2; | |
connectAttr -f ($MD16 + ".outputX") ($Cnd4 + ".colorIfTrueR"); | |
connectAttr -f ($MD16 + ".outputX") ($Cnd4 + ".firstTerm"); | |
setAttr ($Cnd4 + ".secondTerm") $KneeDist; | |
setAttr ($Cnd4 + ".colorIfFalseR") $KneeDist; | |
shadingNode -asUtility blendTwoAttr -n $B2A2; | |
//connectAttr -f ($PMA5 + ".output1D") ($B2A2 + ".input[0]"); | |
connectAttr -f ($Cnd4 + ".outColorR") ($B2A2 + ".input[1]"); | |
connectAttr -f ($legCtrl + "." + $PinName) ($B2A2 + ".attributesBlender"); | |
connectAttr -f ($B2A2 + ".output") ($JT3 + ".translateX"); | |
// setting up the Slide atribute | |
shadingNode -asUtility multiplyDivide -n $MD17; | |
setAttr ($MD17 + ".operation") 1; | |
setAttr ($MD17 + ".input1X") $ChainLength; | |
connectAttr -f ($MD14 + ".outputX") ($MD17 + ".input2X"); | |
shadingNode -asUtility multiplyDivide -n $MD18; | |
setAttr ($MD18 + ".operation") 1; | |
connectAttr -f ($legCtrl + "." + $SlideName) ($MD18 + ".input2X"); | |
connectAttr -f ($MD17 + ".outputX") ($MD18 + ".input1X"); | |
shadingNode -asUtility multiplyDivide -n $MD19; | |
setAttr ($MD19 + ".operation") 1; | |
setAttr ($MD19 + ".input1X") $ChainLength; | |
connectAttr -f ($MD13 + ".outputX") ($MD19 + ".input2X"); | |
shadingNode -asUtility multiplyDivide -n $MD20; | |
setAttr ($MD20 + ".operation") 1; | |
connectAttr -f ($MD19 + ".outputX") ($MD20 + ".input1X"); | |
connectAttr -f ($legCtrl + "." + $SlideName) ($MD20 + ".input2X"); | |
createNode condition -n $Cnd5; | |
setAttr ($Cnd5 + ".operation") 4; | |
setAttr ($Cnd5 + ".secondTerm") 0; | |
connectAttr -f ($MD18 + ".outputX") ($Cnd5 + ".colorIfFalseR"); | |
connectAttr -f ($MD20 + ".outputX") ($Cnd5 + ".colorIfTrueR"); | |
connectAttr -f ($legCtrl + "." + $SlideName) ($Cnd5 + ".firstTerm"); | |
shadingNode -asUtility plusMinusAverage -n $PMA6; | |
setAttr ($PMA6 + ".operation") 1; | |
connectAttr -f ($PMA4 + ".output1D") ($PMA6 + ".input1D[0]"); | |
connectAttr -f ($Cnd5 + ".outColorR") ($PMA6 + ".input1D[1]"); | |
shadingNode -asUtility plusMinusAverage -n $PMA7; | |
setAttr ($PMA7 + ".operation") 2; | |
connectAttr -f ($PMA5 + ".output1D") ($PMA7 + ".input1D[0]"); | |
connectAttr -f ($Cnd5 + ".outColorR") ($PMA7 + ".input1D[1]"); | |
connectAttr -f ($PMA6 + ".output1D") ($B2A1 + ".input[0]"); | |
connectAttr -f ($PMA7 + ".output1D") ($B2A2 + ".input[0]"); | |
////////////////////////////////////////////////////////////////////////// | |
// Cleanup | |
shadingNode -asUtility multiplyDivide -n $MD21; | |
setAttr ($MD21 + ".operation") 1; | |
connectAttr -f ($StretchDistDT + "Shape"+ "." + "distance") ($MD21 + ".input1X"); | |
connectAttr -f ($MD7 + ".outputX") ($MD21 + ".input2X"); | |
createNode condition -n $Cnd6; | |
setAttr ($Cnd6 + ".operation") 2; | |
setAttr ($Cnd6 + ".secondTerm") $ChainLength; | |
setAttr ($Cnd6 + ".colorIfFalseR") $ChainLength; | |
connectAttr -f ($MD21 + ".outputX") ($Cnd6 + ".firstTerm"); | |
connectAttr -f ($MD21 + ".outputX") ($Cnd6 + ".colorIfTrueR"); | |
// connecting cond 6 to other mult nodes | |
connectAttr -f ($Cnd6 + ".outColorR") ($MD17 + ".input1X"); | |
connectAttr -f ($Cnd6 + ".outColorR") ($MD19 + ".input1X"); | |
// making so that slide works with pinning | |
shadingNode -asUtility plusMinusAverage -n $PMA8; | |
setAttr ($PMA8 + ".operation") 1; | |
setAttr ($PMA8 + ".input1D[0]") $KneeDist; | |
connectAttr -f ($Cnd5 + ".outColorR") ($PMA8 + ".input1D[1]"); | |
connectAttr -f ($PMA8 + ".output1D") ($Cnd4 + ".secondTerm"); | |
connectAttr -f ($PMA8 + ".output1D") ($Cnd4 + ".colorIfFalseR"); | |
shadingNode -asUtility plusMinusAverage -n $PMA9; | |
setAttr ($PMA9 + ".operation") 2; | |
setAttr ($PMA9 + ".input1D[0]") $HipDist; | |
connectAttr -f ($Cnd5 + ".outColorR") ($PMA9 + ".input1D[1]"); | |
connectAttr -f ($PMA9 + ".output1D") ($Cnd3 + ".secondTerm"); | |
connectAttr -f ($PMA9 + ".output1D") ($Cnd3 + ".colorIfFalseR"); | |
// Setting IK RP solver tolerance | |
setAttr ikRPsolver.tolerance 1e-007; | |
int $Leg_IKFK_CB = `checkBox -q -v Leg_IKFK_Check`; | |
if ($Leg_IKFK_CB == 1){ | |
// Creating the IKFK Grear | |
/// Creat GEAR control | |
curve -d 1 -p -1.327953 0 -9.954337 -p 1.341144 0 -9.938909 -p 1.780851 0 -7.269811 -p 3.678533 0 -6.513824 -p 5.961923 0 -8.079797 -p 7.890462 0 -6.197544 -p 6.30906 0 -4.022152 -p 7.203902 0 -2.078185 -p 9.880714 0 -1.599907 -p 9.993845 0 1.032165 -p 7.353172 0 1.453142 -p 6.553317 0 3.642221 -p 8.128883 0 5.924288 -p 6.369816 0 7.795225 -p 4.211166 0 6.221865 -p 1.945528 0 7.247696 -p 1.442053 0 9.953875 -p -1.094204 0 9.985343 -p -1.496984 0 7.367271 -p -3.901078 0 6.416962 -p -6.135249 0 7.958855 -p -7.92888 0 6.184105 -p -6.349226 0 4.006574 -p -7.305829 0 1.671708 -p -9.961661 0 1.1997 -p -9.936487 0 -1.38061 -p -7.280655 0 -1.802271 -p -6.361813 0 -3.967214 -p -7.878532 0 -6.188799 -p -6.028261 0 -8.032777 -p -3.819263 0 -6.44683 -p -1.811656 0 -7.25239 -p -1.327953 0 -9.954336 -k 0 -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 -k 8 -k 9 -k 10 -k 11 -k 12 -k 13 -k 14 -k 15 -k 16 -k 17 -k 18 -k 19 -k 20 -k 21 -k 22 -k 23 -k 24 -k 25 -k 26 -k 27 -k 28 -k 29 -k 30 -k 31 -k 32 -n ($LR + "leg_GEAR_CTRL"); | |
//rename "curveShape1" ($LR + "leg_GEAR_CTRL_shape"); | |
addAttr -ln "IK_FK" -at double -min 0 -max 1 -dv 0 ($LR + "leg_GEAR_CTRL"); | |
setAttr -e-keyable true ($LR + "leg_GEAR_CTRL.IK_FK"); | |
setAttr ($LR + "leg_GEAR_CTRL" + ".overrideEnabled") 1; | |
setAttr ($LR + "leg_GEAR_CTRL" + ".overrideColor") 17; | |
// F | |
curve -d 1 -p -0.8 0 -1.6 -p -0.8 0 -2.4 -p -3.6 0 -2.4 -p -3.6 0 2.4 -p -2.8 0 2.4 -p -2.8 0 0.4 -p -1 0 0.4 -p -1 0 -0.4 -p -2.8 0 -0.4 -p -2.8 0 -1.6 -p -0.8 0 -1.6 -k 0 -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 -k 8 -k 9 -k 10 -n ($LR + "F_leg_CTRL_Curve"); | |
setAttr ($LR + "F_leg_CTRL_Curve" + ".overrideEnabled") 1; | |
setAttr ($LR + "F_leg_CTRL_Curve" + ".overrideColor") 17; | |
setAttr ($LR + "F_leg_CTRL_Curve" + ".visibility") 0; | |
// I | |
curve -d 1 -p -2.4 0 -2.4 -p -1.6 0 -2.4 -p -1.6 0 2.4 -p -2.4 0 2.4 -p -2.4 0 -2.4 -k 0 -k 1 -k 2 -k 3 -k 4 -n ($LR + "I_leg_CTRL_Curve"); | |
setAttr ($LR + "I_leg_CTRL_Curve" + ".overrideEnabled") 1; | |
setAttr ($LR + "I_leg_CTRL_Curve" + ".overrideColor") 17; | |
// K | |
curve -d 1 -p 0.6 0 -2.4 -p 1.4 0 -2.4 -p 1.4 0 -0.2 -p 3.2 0 -2.4 -p 4.2 0 -2.4 -p 2.2 0 0 -p 4.2 0 2.4 -p 3.2 0 2.4 -p 1.4 0 0.2 -p 1.4 0 2.4 -p 0.6 0 2.4 -p 0.6 0 -2.4 -k 0 -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 -k 8 -k 9 -k 10 -k 11 -n ($LR + "K_leg_CTRL_Curve"); | |
setAttr ($LR + "K_leg_CTRL_Curve" + ".overrideEnabled") 1; | |
setAttr ($LR + "K_leg_CTRL_Curve" + ".overrideColor") 17; | |
parent ($LR + "F_leg_CTRL_Curve") ($LR + "I_leg_CTRL_Curve") ($LR + "K_leg_CTRL_Curve") ($LR + "leg_GEAR_CTRL"); | |
setDrivenKeyframe -currentDriver ($LR + "leg_GEAR_CTRL" + ".IK_FK") ($LR + "F_leg_CTRL_Curve" + ".visibility"); | |
setDrivenKeyframe -currentDriver ($LR + "leg_GEAR_CTRL" + ".IK_FK") ($LR + "I_leg_CTRL_Curve" + ".visibility"); | |
setAttr ($LR + "leg_GEAR_CTRL" + ".IK_FK") 1; | |
setAttr ($LR + "F_leg_CTRL_Curve" + ".visibility") 1; | |
setAttr ($LR + "I_leg_CTRL_Curve" + ".visibility") 0; | |
setDrivenKeyframe -currentDriver ($LR + "leg_GEAR_CTRL" + ".IK_FK") ($LR + "F_leg_CTRL_Curve" + ".visibility"); | |
setDrivenKeyframe -currentDriver ($LR + "leg_GEAR_CTRL" + ".IK_FK") ($LR + "I_leg_CTRL_Curve" + ".visibility"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "K_leg_CTRL_Curve" + ".tx"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "K_leg_CTRL_Curve" + ".ty"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "K_leg_CTRL_Curve" + ".tz"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "K_leg_CTRL_Curve" + ".rx"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "K_leg_CTRL_Curve" + ".ry"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "K_leg_CTRL_Curve" + ".rz"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "K_leg_CTRL_Curve" + ".sx"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "K_leg_CTRL_Curve" + ".sy"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "K_leg_CTRL_Curve" + ".sz"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "K_leg_CTRL_Curve" + ".v"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "I_leg_CTRL_Curve" + ".tx"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "I_leg_CTRL_Curve" + ".ty"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "I_leg_CTRL_Curve" + ".tz"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "I_leg_CTRL_Curve" + ".rx"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "I_leg_CTRL_Curve" + ".ry"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "I_leg_CTRL_Curve" + ".rz"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "I_leg_CTRL_Curve" + ".sx"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "I_leg_CTRL_Curve" + ".sy"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "I_leg_CTRL_Curve" + ".sz"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "I_leg_CTRL_Curve" + ".v"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "F_leg_CTRL_Curve" + ".tx"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "F_leg_CTRL_Curve" + ".ty"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "F_leg_CTRL_Curve" + ".tz"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "F_leg_CTRL_Curve" + ".rx"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "F_leg_CTRL_Curve" + ".ry"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "F_leg_CTRL_Curve" + ".rz"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "F_leg_CTRL_Curve" + ".sx"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "F_leg_CTRL_Curve" + ".sy"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "F_leg_CTRL_Curve" + ".sz"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "F_leg_CTRL_Curve" + ".v"); | |
xform -r -t 30 0 30 -s 0.5 0.5 0.5 ($LR + "leg_GEAR_CTRL"); | |
// creating Bound leg | |
select -cl ; | |
joint -p $Loc1[0] $Loc1[1] $Loc1[2] ; | |
joint -p $Loc2[0] $Loc2[1] $Loc2[2] ; | |
joint -e -zso -oj xyz -sao yup joint1; | |
joint -p $Loc3[0] $Loc3[1] $Loc3[2] ; | |
joint -e -zso -oj xyz -sao yup joint2; | |
rename "joint1" $Bn1; | |
rename "joint2" $Bn2; | |
rename "joint3" $Bn3; | |
// creating FK leg | |
select -cl ; | |
joint -p $Loc1[0] $Loc1[1] $Loc1[2] ; | |
joint -p $Loc2[0] $Loc2[1] $Loc2[2] ; | |
joint -e -zso -oj xyz -sao yup joint1; | |
joint -p $Loc3[0] $Loc3[1] $Loc3[2] ; | |
joint -e -zso -oj xyz -sao yup joint2; | |
rename "joint1" $FK1; | |
rename "joint2" $FK2; | |
rename "joint3" $FK3; | |
// creating FK leg CTRLs | |
circle -c 0 0 0 -nr 0 1 0 -sw 360 -r 4 -d 3 -ut 0 -tol 0.01 -s 8 -ch 1 -n ($FK1 + "CTRL"); | |
xform -ro 0 0 -90 ($FK1 + "CTRL"); | |
makeIdentity -apply true -t 1 -r 1 -s 1 -n 0 -pn 1 ($FK1 + "CTRL"); | |
select -r ($FK1 + "CTRL" + "Shape"); | |
select -add $FK1; | |
parent -r -s; | |
delete ($FK1 + "CTRL"); | |
circle -c 0 0 0 -nr 0 1 0 -sw 360 -r 4 -d 3 -ut 0 -tol 0.01 -s 8 -ch 1 -n ($FK2 + "CTRL"); | |
xform -ro 0 0 -90 ($FK2 + "CTRL"); | |
makeIdentity -apply true -t 1 -r 1 -s 1 -n 0 -pn 1 ($FK2 + "CTRL"); | |
select -r ($FK2 + "CTRL" + "Shape"); | |
select -add $FK2; | |
parent -r -s; | |
delete ($FK2 + "CTRL"); | |
circle -c 0 0 0 -nr 0 1 0 -sw 360 -r 4 -d 3 -ut 0 -tol 0.01 -s 8 -ch 1 -n ($FK3 + "CTRL"); | |
xform -ro 0 0 -90 ($FK3 + "CTRL"); | |
makeIdentity -apply true -t 1 -r 1 -s 1 -n 0 -pn 1 ($FK3 + "CTRL"); | |
select -r ($FK3 + "CTRL" + "Shape"); | |
select -add $FK3; | |
parent -r -s; | |
delete ($FK3 + "CTRL"); | |
// Parenting the Bound to IK and FK leg; | |
select -r $JT1 $FK1 $Bn1; | |
parentConstraint -weight 1 -n ($Bn1 + "ParConst"); | |
select -r $JT2 $FK2 $Bn2; | |
parentConstraint -weight 1 -n ($Bn2 + "ParConst"); | |
select -r $JT3 $FK3 $Bn3; | |
parentConstraint -weight 1 -n ($Bn3 + "ParConst"); | |
// SDK IK FK mode | |
setAttr ($Bn1 + "ParConst" + "." + $JT1 + "W0") 0; | |
setAttr ($Bn2 + "ParConst" + "." + $JT2 + "W0") 0; | |
setAttr ($Bn3 + "ParConst" + "." + $JT3 + "W0") 0; | |
setDrivenKeyframe -currentDriver ($LR + "leg_GEAR_CTRL" + ".IK_FK") ($Bn1 + "ParConst" + "." + $JT1 + "W0"); | |
setDrivenKeyframe -currentDriver ($LR + "leg_GEAR_CTRL" + ".IK_FK") ($Bn1 + "ParConst" + "." + $FK1 + "W1"); | |
setDrivenKeyframe -currentDriver ($LR + "leg_GEAR_CTRL" + ".IK_FK") ($Bn2 + "ParConst" + "." + $JT2 + "W0"); | |
setDrivenKeyframe -currentDriver ($LR + "leg_GEAR_CTRL" + ".IK_FK") ($Bn2 + "ParConst" + "." + $FK2 + "W1"); | |
setDrivenKeyframe -currentDriver ($LR + "leg_GEAR_CTRL" + ".IK_FK") ($Bn3 + "ParConst" + "." + $JT3 + "W0"); | |
setDrivenKeyframe -currentDriver ($LR + "leg_GEAR_CTRL" + ".IK_FK") ($Bn3 + "ParConst" + "." + $FK3 + "W1"); | |
setAttr ($LR + "leg_GEAR_CTRL" + ".IK_FK") 0; | |
setAttr ($Bn1 + "ParConst" + "." + $JT1 + "W0") 1; | |
setAttr ($Bn1 + "ParConst" + "." + $FK1 + "W1") 0; | |
setAttr ($Bn2 + "ParConst" + "." + $JT2 + "W0") 1; | |
setAttr ($Bn2 + "ParConst" + "." + $FK2 + "W1") 0; | |
setAttr ($Bn3 + "ParConst" + "." + $JT3 + "W0") 1; | |
setAttr ($Bn3 + "ParConst" + "." + $FK3 + "W1") 0; | |
setDrivenKeyframe -currentDriver ($LR + "leg_GEAR_CTRL" + ".IK_FK") ($Bn1 + "ParConst" + "." + $JT1 + "W0"); | |
setDrivenKeyframe -currentDriver ($LR + "leg_GEAR_CTRL" + ".IK_FK") ($Bn1 + "ParConst" + "." + $FK1 + "W1"); | |
setDrivenKeyframe -currentDriver ($LR + "leg_GEAR_CTRL" + ".IK_FK") ($Bn2 + "ParConst" + "." + $JT2 + "W0"); | |
setDrivenKeyframe -currentDriver ($LR + "leg_GEAR_CTRL" + ".IK_FK") ($Bn2 + "ParConst" + "." + $FK2 + "W1"); | |
setDrivenKeyframe -currentDriver ($LR + "leg_GEAR_CTRL" + ".IK_FK") ($Bn3 + "ParConst" + "." + $JT3 + "W0"); | |
setDrivenKeyframe -currentDriver ($LR + "leg_GEAR_CTRL" + ".IK_FK") ($Bn3 + "ParConst" + "." + $FK3 + "W1"); | |
select -cl; | |
//Cleanup of IK FK arm setup | |
parent $Bn1 $L_RootName ; | |
parent $FK1 $L_RootName ; | |
parent ($LR + "leg_GEAR_CTRL") $L_RootName ; | |
} | |
int $Leg_Foot_CB = `checkBox -q -v Leg_Foot_Check`; | |
if ($Leg_Foot_CB == 1){ | |
print "Foot Coming SOON \n"; | |
} | |
}else{ | |
warning "Must Create LOCS first"; | |
} | |
} | |
} | |
proc MirrorLegSetup(){ | |
string $L_RootName = "L_leg_Root"; | |
if( `objExists $L_RootName` ){ | |
string $LR = "R_"; | |
string $LocNameHip = "L_leg_IK_Hip_LOC"; | |
string $LocNameKnee = "L_leg_IK_Knee_LOC"; | |
string $LocNameAnkle = "L_leg_IK_Ankle_LOC"; | |
string $CTRLdistLocName = "L_leg_CTRLdist_LOC"; | |
string $SoftBlendLocName = "L_leg_softBlend_LOC"; | |
// Joint Sting names | |
string $RP_JT1 = "R_PROX_leg_IK_Hip_01"; | |
string $RP_JT2 = "R_PROX_leg_IK_Knee_01"; | |
string $RP_JT3 = "R_PROX_leg_IK_Ankle_01"; | |
// Attrib Naming Strings | |
string $SlideName = ($LR + "leg_slideP"); | |
string $StretchName = ($LR + "leg_stretchP"); | |
string $SoftName = ($LR + "leg_softP"); | |
string $PinName = ($LR + "leg_pinP"); | |
// Misc String Names | |
string $R_legCtrl = "R_leg_IK_CTRL"; | |
string $R_RootName = "R_leg_Root"; | |
// Distance tool Name strings (-DT distance tool) | |
string $ControlDistDT = ($LR + "leg_controlDist"); | |
string $SoftDistDT = ($LR + "leg_softDist"); | |
string $HipDistDT = ($LR + "leg_HipDist"); | |
string $KneeDistDT = ($LR + "leg_KneeDist"); | |
string $StretchDistDT = ($LR + "leg_stretchDist"); | |
// Node Name Strings | |
//Cnd Nodes | |
string $Cnd1 = ($LR + "leg_Cond1"); | |
string $Cnd2 = ($LR + "leg_Cond2"); | |
// Pin CND Nodes | |
string $Cnd3 = ($LR + "leg_Cond3"); | |
string $Cnd4 = ($LR + "leg_Cond4"); | |
// Slide CND Node | |
string $Cnd5 = ($LR + "leg_Cond5"); | |
string $Cnd6 = ($LR + "leg_Cond6"); | |
//PMA nodes | |
string $PMA1 = ($LR + "leg_PMA1"); | |
string $PMA2 = ($LR + "leg_PMA2"); | |
string $PMA3 = ($LR + "leg_PMA3"); | |
// Pma nodes for Stretch soft IK | |
string $PMA4 = ($LR + "leg_PMA4"); | |
string $PMA5 = ($LR + "leg_PMA5"); | |
// Pma nodes for Slide | |
string $PMA6 = ($LR + "leg_PMA6"); | |
string $PMA7 = ($LR + "leg_PMA7"); | |
string $PMA8 = ($LR + "leg_PMA8"); | |
string $PMA9 = ($LR + "leg_PMA9"); | |
//Multiply Divide Nodes | |
string $MD1 = ($LR + "leg_MD1"); | |
string $MD2 = ($LR + "leg_MD2"); | |
string $MD3 = ($LR + "leg_MD3"); | |
string $MD4 = ($LR + "leg_MD4"); | |
string $MD5 = ($LR + "leg_MD5"); | |
string $MD6 = ($LR + "leg_MD6"); | |
//Multiply Divide Nodes for Stretch Soft IK | |
string $MD7 = ($LR + "leg_MD7"); | |
string $MD8 = ($LR + "leg_MD8"); | |
string $MD9 = ($LR + "leg_MD9"); | |
string $MD10 = ($LR + "leg_MD10"); | |
string $MD11 = ($LR + "leg_MD11"); | |
string $MD12 = ($LR + "leg_MD12"); | |
// Special MD nodes for stretch | |
string $MD13 = ($LR + "leg_MD_HipByChainLen"); | |
string $MD14 = ($LR + "leg_MD_KneeByChainLen"); | |
// Pin MD nodes | |
string $MD15 = ($LR + "leg_MD15"); | |
string $MD16 = ($LR + "leg_MD16"); | |
// Slide MD nodes | |
string $MD17 = ($LR + "leg_MD17"); | |
string $MD18 = ($LR + "leg_MD18"); | |
string $MD19 = ($LR + "leg_MD19"); | |
string $MD20 = ($LR + "leg_MD20"); | |
string $MD21 = ($LR + "leg_MD21"); | |
string $MD22 = ($LR + "leg_MD22"); | |
// Pin Blend ATTR nodes | |
string $B2A1 = ($LR + "leg_BL2Atr01"); | |
string $B2A2 = ($LR + "leg_BL2Atr02"); | |
// new mirrored Locs | |
string $R_LocNameHip = "R_leg_IK_Hip_LOC"; | |
string $R_LocNameKnee = "R_leg_IK_Knee_LOC"; | |
string $R_LocNameAnkle = "R_leg_IK_Ankle_LOC"; | |
string $R_CTRLdistLocName = "R_leg_CTRLdist_LOC"; | |
string $R_SoftBlendLocName = "R_leg_softBlend_LOC"; | |
// new Joint Sting names | |
string $R_JT1 = "R_leg_IK_Hip_01"; | |
string $R_JT2 = "R_leg_IK_Knee_01"; | |
string $R_JT3 = "R_leg_IK_Ankle_01"; | |
// New strings to apend | |
// Bound leg names | |
string $Bn1 = ($LR + "leg_Bound_Hip_01"); | |
string $Bn2 = ($LR + "leg_Bound_Knee_01"); | |
string $Bn3 = ($LR + "leg_Bound_Ankle_01"); | |
// FK leg names | |
string $FK1 = ($LR + "leg_FK_Hip_01"); | |
string $FK2 = ($LR + "leg_FK_Knee_01"); | |
string $FK3 = ($LR + "leg_FK_Ankle_01"); | |
float $R_Loc1[] = `xform -worldSpace -q -translation $LocNameHip`; | |
float $R_Loc2[] = `xform -worldSpace -q -translation $LocNameKnee`; | |
float $R_Loc3[] = `xform -worldSpace -q -translation $LocNameAnkle`; | |
float $Loc1Invrs = ($R_Loc1[0] * -1); | |
float $Loc2Invrs = ($R_Loc2[0] * -1); | |
float $Loc3Invrs = ($R_Loc3[0] * -1); | |
spaceLocator -n $R_LocNameHip -p 0 0 0; | |
xform -t $Loc1Invrs $R_Loc1[1] $R_Loc1[2]; | |
spaceLocator -n $R_LocNameKnee -p 0 0 0; | |
xform -t $Loc2Invrs $R_Loc2[1] $R_Loc2[2]; | |
spaceLocator -n $R_LocNameAnkle -p 0 0 0; | |
xform -t $Loc3Invrs $R_Loc3[1] $R_Loc3[2]; | |
select -r $R_LocNameHip; | |
select -add $R_LocNameKnee; | |
select -add $R_LocNameAnkle; | |
string $R_BoneLocs[]=`ls -sl`; | |
int $R_amount=`size($R_BoneLocs)`; | |
for ($R_n=0; $R_n<$R_amount; $R_n++) { | |
setAttr ($R_BoneLocs[$R_n] + ".localScaleX") 5; | |
setAttr ($R_BoneLocs[$R_n] + ".localScaleY") 5; | |
setAttr ($R_BoneLocs[$R_n] + ".localScaleZ") 5; | |
//setAttr ($BoneLocs[$n] + ".overrideEnabled") 1; | |
//setAttr ($BoneLocs[$n] + ".overrideColor") 17; | |
} | |
// creation of joins on locators | |
select -cl ; | |
float $Loc1[] = `xform -worldSpace -q -translation $LocNameHip`; | |
float $Loc2[] = `xform -worldSpace -q -translation $LocNameKnee`; | |
float $Loc3[] = `xform -worldSpace -q -translation $LocNameAnkle`; | |
joint -p $Loc1[0] $Loc1[1] $Loc1[2] ; | |
joint -p $Loc2[0] $Loc2[1] $Loc2[2] ; | |
joint -e -zso -oj xyz -sao yup joint1; | |
joint -p $Loc3[0] $Loc3[1] $Loc3[2] ; | |
joint -e -zso -oj xyz -sao yup joint2; | |
rename "joint1" $RP_JT1; | |
rename "joint2" $RP_JT2; | |
rename "joint3" $RP_JT3; | |
select -r $RP_JT1; | |
mirrorJoint -mirrorYZ -mirrorBehavior -sr "R_PROX_" "R_"; | |
/*=======================================IMA=NEED=THIS=LATER====================================================*/ | |
select -r $RP_JT1; | |
mirrorJoint -mirrorYZ -mirrorBehavior -sr "R_PROX_leg_IK" "R_leg_Bound"; | |
select -r $RP_JT1; | |
mirrorJoint -mirrorYZ -mirrorBehavior -sr "R_PROX_leg_IK" "R_leg_FK"; | |
/*===============================================================================================================*/ | |
delete R_PROX_leg_IK_Hip_01; | |
////////////////////////////////////////////////////////////////////// | |
// Creating the leg Control | |
circle -c 0 0 0 -nr 0 1 0 -sw 360 -r 4 -d 3 -ut 0 -tol 0.01 -s 8 -ch 0 -n $R_legCtrl; | |
// adding atributes to the leg CTRL | |
addAttr -ln "Ik_Controls" -at double -dv 0 -k true; | |
setAttr -lock true ($R_legCtrl + ".Ik_Controls"); | |
addAttr -ln $SlideName -nn "Slide" -at double -max 1 -min -1 -dv 0 -k true; | |
addAttr -ln $StretchName -nn "Stretch" -at double -max 1 -min 0 -dv 0 -k true; | |
addAttr -ln $SoftName -nn "Soft" -at double -max 1 -min 0 -dv 0 -k true; | |
addAttr -ln $PinName -nn "Pin" -at double -max 1 -min 0 -dv 0 -k true; | |
xform -ro 0 0 -90 $R_legCtrl; | |
setAttr ($R_legCtrl + ".overrideEnabled") 1; | |
setAttr ($R_legCtrl + ".overrideColor") 18; | |
// creating Ankle control dist Loc | |
spaceLocator -n $R_CTRLdistLocName -p 0 0 0; | |
parent ($LR + "leg_CTRLdist_LOC") $R_legCtrl; | |
spaceLocator -n $R_SoftBlendLocName -p 0 0 0; | |
parent ($LR + "leg_softBlend_LOC") $R_legCtrl; | |
// moving CTRL to Ankle | |
select -r $R_LocNameAnkle; | |
select -add $R_legCtrl; | |
pointConstraint -offset 0 0 0 -n CTRLtoAnkleConst; | |
select -r CTRLtoAnkleConst; | |
doDelete; | |
makeIdentity -apply true -t 1 -r 1 -s 1 -n 0 -pn 1 $R_legCtrl; | |
////////////////////////////////////////////////////////////////////// | |
// create Root node | |
group -em -n $R_RootName; | |
connectAttr -f ($R_RootName + ".scaleX") ($R_RootName + ".scaleY"); | |
connectAttr -f ($R_RootName + ".scaleX") ($R_RootName + ".scaleZ"); | |
setAttr -lock true -keyable false -channelBox false ($R_RootName + ".sy"); | |
setAttr -lock true -keyable false -channelBox false ($R_RootName + ".sz"); | |
////////////////////////////////////////////////////////////////////// | |
// Parenting all the things | |
parent $R_JT1 $R_LocNameHip; | |
parent $R_LocNameAnkle $R_LocNameHip; | |
parent $R_LocNameHip $R_RootName; | |
parent $R_LocNameKnee $R_RootName; | |
parent $R_SoftBlendLocName $R_RootName; | |
parent $R_legCtrl $R_RootName; | |
////////////////////////////////////////////////////////////////////// | |
ikHandle -n ($LR + "leg_IK") -sj $R_JT1 -ee $R_JT3; | |
poleVectorConstraint $R_LocNameKnee ($LR + "leg_IK"); | |
parent ($LR + "leg_IK") $R_SoftBlendLocName; | |
// aim constrain the Hip loc to the Hand CTRL | |
aimConstraint -mo -weight 1 -aimVector 0 -1 0 -upVector 0 1 0 -worldUpType "object" -worldUpObject $R_RootName $R_legCtrl $R_LocNameHip; | |
//aimConstraint -offset 0 0 0 -weight 1 -aimVector -1 0 0 -upVector 0 1 0 -worldUpType "objectrotation" -worldUpVector 0 1 0 -worldUpObject $legCtrl $LocNameHip; | |
// creation of distance tools | |
distanceDimension -sp 0 0 -100 -ep 50 0 -100 ; | |
distanceDimension -sp 0 0 -90 -ep 50 0 -90 ; | |
distanceDimension -sp 0 0 -80 -ep 50 0 -80 ; | |
distanceDimension -sp 0 0 -70 -ep 50 0 -70 ; | |
distanceDimension -sp 0 0 -60 -ep 50 0 -60 ; | |
rename "distanceDimension1" $ControlDistDT; | |
rename "distanceDimension2" $SoftDistDT; | |
rename "distanceDimension3" $HipDistDT; | |
rename "distanceDimension4" $KneeDistDT; | |
rename "distanceDimension5" $StretchDistDT; | |
connectAttr -f ($R_LocNameHip + ".worldPosition[0]")($ControlDistDT + "Shape.startPoint"); | |
connectAttr -f ($R_CTRLdistLocName + ".worldPosition[0]")($ControlDistDT + "Shape.endPoint"); | |
connectAttr -f ($R_LocNameAnkle + ".worldPosition[0]")($SoftDistDT + "Shape.startPoint"); | |
connectAttr -f ($R_SoftBlendLocName + ".worldPosition[0]")($SoftDistDT + "Shape.endPoint"); | |
connectAttr -f ($R_LocNameHip + ".worldPosition[0]")($HipDistDT + "Shape.startPoint"); | |
connectAttr -f ($R_LocNameKnee + ".worldPosition[0]")($HipDistDT + "Shape.endPoint"); | |
connectAttr -f ($R_LocNameKnee + ".worldPosition[0]")($KneeDistDT + "Shape.startPoint"); | |
connectAttr -f ($R_SoftBlendLocName + ".worldPosition[0]")($KneeDistDT + "Shape.endPoint"); | |
connectAttr -f ($R_LocNameHip + ".worldPosition[0]")($StretchDistDT + "Shape.startPoint"); | |
connectAttr -f ($R_SoftBlendLocName + ".worldPosition[0]")($StretchDistDT + "Shape.endPoint"); | |
// This will cause problems if any of these are already in the scene. | |
select -r locator1 locator2 locator3 locator4 locator5 locator6 locator7 locator8 locator9 locator10 ; | |
doDelete; | |
select -r $ControlDistDT $SoftDistDT $HipDistDT $KneeDistDT $StretchDistDT ; | |
group -n ($LR + "leg_DistTools_GRP"); | |
parent ($LR + "leg_DistTools_GRP") $R_RootName; | |
setAttr ($LR + "leg_DistTools_GRP" + ".visibility") 0; | |
////////////////////////////////////////////////////////////////////// | |
// finding the chain length | |
float $HipDist = `getAttr ($HipDistDT + "Shape.distance")`; | |
float $KneeDist = `getAttr ($KneeDistDT + "Shape.distance")`; | |
float $ChainLength = ($HipDist + $KneeDist); | |
// Creating all the nodes | |
/* | |
Normalising the Root Scale And working that into the node network. | |
*/ | |
// Create the Fith Multiply Divide Node | |
shadingNode -asUtility multiplyDivide -n $MD5; | |
setAttr ($MD5 + ".operation") 2; | |
setAttr ($MD5 + ".input1X") 1; | |
connectAttr -f ($R_RootName + ".scaleX") ($MD5 + ".input2X"); | |
// Create the Sixth Multiply Divide Node | |
shadingNode -asUtility multiplyDivide -n $MD6; | |
setAttr ($MD6 + ".operation") 1; | |
connectAttr -f ($MD5 + ".outputX") ($MD6 + ".input2X"); | |
connectAttr -f ($ControlDistDT + "Shape.distance") ($MD6 + ".input1X"); | |
////////////////////////////////////////////////////////////////////// | |
// create the First condition node | |
createNode condition -n $Cnd1; | |
setAttr ($Cnd1 + ".operation") 2; | |
connectAttr -f ($MD6 + ".outputX")($Cnd1 + ".firstTerm"); | |
// create the First plusMinusAverage node | |
shadingNode -asUtility plusMinusAverage -n $PMA1; | |
setAttr ($PMA1 + ".operation") 2; | |
setAttr ($PMA1 + ".input1D[0]") $ChainLength; | |
connectAttr -f ($R_legCtrl + "." + $SoftName) ($PMA1 + ".input1D[1]"); | |
connectAttr -f ($PMA1 + ".output1D") ($Cnd1 + ".secondTerm"); | |
connectAttr -f ($MD6 + ".outputX")($Cnd1 + ".colorIfFalseR"); | |
// create the Second condition node | |
createNode condition -n $Cnd2; | |
setAttr ($Cnd2 + ".operation") 2; | |
connectAttr -f ($R_legCtrl + "." + $SoftName) ($Cnd2 + ".firstTerm"); | |
setAttr ($Cnd2 + ".colorIfFalseR") $ChainLength; | |
// create the Second plusMinusAverage node | |
shadingNode -asUtility plusMinusAverage -n $PMA2; | |
setAttr ($PMA2 + ".operation") 2; | |
connectAttr -f ($MD6 + ".outputX")($PMA2 + ".input1D[0]"); | |
connectAttr -f ($PMA1 + ".output1D") ($PMA2 + ".input1D[1]"); | |
// Create the Fist Multiply Divide Node | |
shadingNode -asUtility multiplyDivide -n $MD1; | |
setAttr ($MD1 + ".operation") 2; | |
connectAttr -f ($R_legCtrl + "." + $SoftName) ($MD1 + ".input2X"); | |
connectAttr -f ($PMA2 + ".output1D") ($MD1 + ".input1X"); | |
// Create the Second Multiply Divide Node | |
shadingNode -asUtility multiplyDivide -n $MD2; | |
setAttr ($MD2 + ".operation") 1; | |
setAttr ($MD2 + ".input1X") -1; | |
connectAttr -f ($MD1 + ".outputX") ($MD2 + ".input2X"); | |
// Create the Third Multiply Divide Node | |
shadingNode -asUtility multiplyDivide -n $MD3; | |
setAttr ($MD3 + ".operation") 3; | |
setAttr ($MD3 + ".input1X") 2.718282; | |
connectAttr -f ($MD2 + ".outputX")($MD3 + ".input2X"); | |
// Create the Forth Multiply Divide Node | |
shadingNode -asUtility multiplyDivide -n $MD4; | |
setAttr ($MD4 + ".operation") 1; | |
connectAttr -f ($R_legCtrl + "." + $SoftName) ($MD4 + ".input1X"); | |
connectAttr -f ($MD3 + ".outputX") ($MD4 + ".input2X"); | |
// create the third plusMinusAverage node | |
shadingNode -asUtility plusMinusAverage -n $PMA3; | |
setAttr ($PMA3 + ".operation") 2; | |
setAttr ($PMA3 + ".input1D[0]")$ChainLength; | |
connectAttr -f ($MD4 + ".outputX") ($PMA3 + ".input1D[1]"); | |
connectAttr -f ($PMA3 + ".output1D") ($Cnd2 + ".colorIfTrueR"); | |
// Finishing the nested condition nodes | |
connectAttr -f ($Cnd2 + ".outColorR") ($Cnd1 + ".colorIfTrueR"); | |
//connectAttr -f ($Cnd1 + ".outColorR") ($R_LocNameAnkle + ".translateX"); | |
// point constraining the SoftBlend Loc to Both AnkleLOC and leg CTRL | |
select -cl ; | |
select -r $R_LocNameAnkle; | |
select -add $R_legCtrl; | |
select -add $R_SoftBlendLocName; | |
pointConstraint -tl -n ($R_SoftBlendLocName + "PointConst01"); | |
select -cl ; | |
// creating set driven keys on the Soft blend loc and Stretch vlaues | |
setAttr ($R_legCtrl + "." + $StretchName) 1; | |
setAttr ($R_SoftBlendLocName + "PointConst01"+ "." + $R_LocNameAnkle + "W0") 0; | |
setAttr ($R_SoftBlendLocName + "PointConst01"+ "." + $R_legCtrl + "W1") 1; | |
setDrivenKeyframe -currentDriver ($R_legCtrl + "." + $StretchName) ($R_SoftBlendLocName + "PointConst01" + "." + $R_LocNameAnkle + "W0"); | |
setDrivenKeyframe -currentDriver ($R_legCtrl + "." + $StretchName) ($R_SoftBlendLocName + "PointConst01" + "." + $R_legCtrl + "W1"); | |
//////////////////////////////////////////// | |
setAttr ($R_legCtrl + "." + $StretchName) 0; | |
setAttr ($R_SoftBlendLocName + "PointConst01"+ "." + $R_LocNameAnkle + "W0") 1; | |
setAttr ($R_SoftBlendLocName + "PointConst01"+ "." + $R_legCtrl + "W1") 0; | |
setDrivenKeyframe -currentDriver ($R_legCtrl + "." + $StretchName) ($R_SoftBlendLocName + "PointConst01" + "." + $R_LocNameAnkle + "W0"); | |
setDrivenKeyframe -currentDriver ($R_legCtrl + "." + $StretchName) ($R_SoftBlendLocName + "PointConst01" + "." + $R_legCtrl + "W1"); | |
// Creating the Stretch soft IK setup | |
shadingNode -asUtility multiplyDivide -n $MD7; | |
setAttr ($MD1 + ".operation") 1; | |
setAttr ($MD7 + ".input1X") 1; | |
connectAttr -f ($R_RootName + ".scaleX") ($MD7 + ".input2X"); | |
shadingNode -asUtility multiplyDivide -n $MD8; | |
setAttr ($MD8 + ".operation") 1; | |
connectAttr -f ($MD7 + ".outputX") ($MD8 + ".input1X"); | |
connectAttr -f ($SoftDistDT + "Shape" + ".distance") ($MD8 + ".input2X"); | |
// Special Node 1 | |
shadingNode -asUtility multiplyDivide -n $MD13; | |
setAttr ($MD13 + ".operation") 2; | |
setAttr ($MD13 + ".input1X") $HipDist; | |
setAttr ($MD13 + ".input2X") $ChainLength; | |
// Special Node 2 | |
shadingNode -asUtility multiplyDivide -n $MD14; | |
setAttr ($MD14 + ".operation") 2; | |
setAttr ($MD14 + ".input1X") $KneeDist; | |
setAttr ($MD14 + ".input2X") $ChainLength; | |
shadingNode -asUtility multiplyDivide -n $MD9; | |
setAttr ($MD9 + ".operation") 1; | |
connectAttr -f ($MD8 + ".outputX") ($MD9 + ".input1X"); | |
connectAttr -f ($MD13 + ".outputX") ($MD9 + ".input2X"); | |
shadingNode -asUtility multiplyDivide -n $MD10; | |
setAttr ($MD10 + ".operation") 1; | |
connectAttr -f ($MD8 + ".outputX") ($MD10 + ".input1X"); | |
connectAttr -f ($MD14 + ".outputX") ($MD10 + ".input2X"); | |
//////////////////////////////////////////////////////////// | |
shadingNode -asUtility multiplyDivide -n $MD11; | |
setAttr ($MD11 + ".operation") 1; | |
connectAttr -f ($MD9 + ".outputX") ($MD11 + ".input1X"); | |
connectAttr -f ($R_legCtrl + "." + $StretchName) ($MD11 + ".input2X"); | |
shadingNode -asUtility multiplyDivide -n $MD12; | |
setAttr ($MD12 + ".operation") 1; | |
connectAttr -f ($MD10 + ".outputX") ($MD12 + ".input1X"); | |
connectAttr -f ($R_legCtrl + "." + $StretchName) ($MD12 + ".input2X"); | |
shadingNode -asUtility plusMinusAverage -n $PMA4; | |
setAttr ($PMA4 + ".operation") 1; | |
connectAttr -f ($MD11 + ".outputX") ($PMA4 + ".input1D[0]"); | |
setAttr ($PMA4 + ".input1D[1]")$HipDist; | |
// $B2A1 is later connected to $R_JT2 | |
//connectAttr -f ($PMA4 + ".output1D") ($R_JT2 + ".translateX"); | |
shadingNode -asUtility plusMinusAverage -n $PMA5; | |
setAttr ($PMA5 + ".operation") 1; | |
connectAttr -f ($MD12 + ".outputX") ($PMA5 + ".input1D[0]"); | |
setAttr ($PMA5 + ".input1D[1]")$KneeDist; | |
// Connected to $B2A2 Later | |
//connectAttr -f ($PMA5 + ".output1D") ($R_JT3 + ".translateX"); | |
// setting up the Pin atribute | |
//Pin setup for upper leg | |
shadingNode -asUtility multiplyDivide -n $MD15; | |
setAttr ($MD15 + ".operation") 1; | |
connectAttr -f ($MD7 + ".outputX") ($MD15 + ".input2X"); | |
connectAttr -f ($HipDistDT + "Shape" + ".distance") ($MD15 + ".input1X"); | |
createNode condition -n $Cnd3; | |
setAttr ($Cnd3 + ".operation") 2; | |
connectAttr -f ($MD15 + ".outputX") ($Cnd3 + ".colorIfTrueR"); | |
connectAttr -f ($MD15 + ".outputX") ($Cnd3 + ".firstTerm"); | |
setAttr ($Cnd3 + ".secondTerm") $HipDist; | |
setAttr ($Cnd3 + ".colorIfFalseR") $HipDist; | |
shadingNode -asUtility blendTwoAttr -n $B2A1; | |
//connectAttr -f ($PMA4 + ".output1D") ($B2A1 + ".input[0]"); | |
connectAttr -f ($Cnd3 + ".outColorR") ($B2A1 + ".input[1]"); | |
connectAttr -f ($R_legCtrl + "." + $PinName) ($B2A1 + ".attributesBlender"); | |
connectAttr -f ($B2A1 + ".output") ($R_JT2 + ".translateX"); | |
// pin setup for lowwer leg | |
shadingNode -asUtility multiplyDivide -n $MD16; | |
setAttr ($MD16 + ".operation") 1; | |
connectAttr -f ($MD7 + ".outputX") ($MD16 + ".input2X"); | |
connectAttr -f ($KneeDistDT + "Shape" + ".distance") ($MD16 + ".input1X"); | |
createNode condition -n $Cnd4; | |
setAttr ($Cnd4 + ".operation") 2; | |
connectAttr -f ($MD16 + ".outputX") ($Cnd4 + ".colorIfTrueR"); | |
connectAttr -f ($MD16 + ".outputX") ($Cnd4 + ".firstTerm"); | |
setAttr ($Cnd4 + ".secondTerm") $KneeDist; | |
setAttr ($Cnd4 + ".colorIfFalseR") $KneeDist; | |
shadingNode -asUtility blendTwoAttr -n $B2A2; | |
//connectAttr -f ($PMA5 + ".output1D") ($B2A2 + ".input[0]"); | |
connectAttr -f ($Cnd4 + ".outColorR") ($B2A2 + ".input[1]"); | |
connectAttr -f ($R_legCtrl + "." + $PinName) ($B2A2 + ".attributesBlender"); | |
connectAttr -f ($B2A2 + ".output") ($R_JT3 + ".translateX"); | |
// setting up the Slide atribute | |
shadingNode -asUtility multiplyDivide -n $MD17; | |
setAttr ($MD17 + ".operation") 1; | |
setAttr ($MD17 + ".input1X") $ChainLength; | |
connectAttr -f ($MD14 + ".outputX") ($MD17 + ".input2X"); | |
shadingNode -asUtility multiplyDivide -n $MD18; | |
setAttr ($MD18 + ".operation") 1; | |
connectAttr -f ($R_legCtrl + "." + $SlideName) ($MD18 + ".input2X"); | |
connectAttr -f ($MD17 + ".outputX") ($MD18 + ".input1X"); | |
shadingNode -asUtility multiplyDivide -n $MD19; | |
setAttr ($MD19 + ".operation") 1; | |
setAttr ($MD19 + ".input1X") $ChainLength; | |
connectAttr -f ($MD13 + ".outputX") ($MD19 + ".input2X"); | |
shadingNode -asUtility multiplyDivide -n $MD20; | |
setAttr ($MD20 + ".operation") 1; | |
connectAttr -f ($MD19 + ".outputX") ($MD20 + ".input1X"); | |
connectAttr -f ($R_legCtrl + "." + $SlideName) ($MD20 + ".input2X"); | |
createNode condition -n $Cnd5; | |
setAttr ($Cnd5 + ".operation") 4; | |
setAttr ($Cnd5 + ".secondTerm") 0; | |
connectAttr -f ($MD18 + ".outputX") ($Cnd5 + ".colorIfFalseR"); | |
connectAttr -f ($MD20 + ".outputX") ($Cnd5 + ".colorIfTrueR"); | |
connectAttr -f ($R_legCtrl + "." + $SlideName) ($Cnd5 + ".firstTerm"); | |
shadingNode -asUtility plusMinusAverage -n $PMA6; | |
setAttr ($PMA6 + ".operation") 1; | |
connectAttr -f ($PMA4 + ".output1D") ($PMA6 + ".input1D[0]"); | |
connectAttr -f ($Cnd5 + ".outColorR") ($PMA6 + ".input1D[1]"); | |
shadingNode -asUtility plusMinusAverage -n $PMA7; | |
setAttr ($PMA7 + ".operation") 2; | |
connectAttr -f ($PMA5 + ".output1D") ($PMA7 + ".input1D[0]"); | |
connectAttr -f ($Cnd5 + ".outColorR") ($PMA7 + ".input1D[1]"); | |
connectAttr -f ($PMA6 + ".output1D") ($B2A1 + ".input[0]"); | |
connectAttr -f ($PMA7 + ".output1D") ($B2A2 + ".input[0]"); | |
////////////////////////////////////////////////////////////////////////// | |
// Cleanup | |
shadingNode -asUtility multiplyDivide -n $MD21; | |
setAttr ($MD21 + ".operation") 1; | |
connectAttr -f ($StretchDistDT + "Shape"+ "." + "distance") ($MD21 + ".input1X"); | |
connectAttr -f ($MD7 + ".outputX") ($MD21 + ".input2X"); | |
createNode condition -n $Cnd6; | |
setAttr ($Cnd6 + ".operation") 2; | |
setAttr ($Cnd6 + ".secondTerm") $ChainLength; | |
setAttr ($Cnd6 + ".colorIfFalseR") $ChainLength; | |
connectAttr -f ($MD21 + ".outputX") ($Cnd6 + ".firstTerm"); | |
connectAttr -f ($MD21 + ".outputX") ($Cnd6 + ".colorIfTrueR"); | |
// connecting cond 6 to other mult nodes | |
connectAttr -f ($Cnd6 + ".outColorR") ($MD17 + ".input1X"); | |
connectAttr -f ($Cnd6 + ".outColorR") ($MD19 + ".input1X"); | |
// making so that slide works with pinning | |
shadingNode -asUtility plusMinusAverage -n $PMA8; | |
setAttr ($PMA8 + ".operation") 1; | |
setAttr ($PMA8 + ".input1D[0]") $KneeDist; | |
connectAttr -f ($Cnd5 + ".outColorR") ($PMA8 + ".input1D[1]"); | |
connectAttr -f ($PMA8 + ".output1D") ($Cnd4 + ".secondTerm"); | |
connectAttr -f ($PMA8 + ".output1D") ($Cnd4 + ".colorIfFalseR"); | |
shadingNode -asUtility plusMinusAverage -n $PMA9; | |
setAttr ($PMA9 + ".operation") 2; | |
setAttr ($PMA9 + ".input1D[0]") $HipDist; | |
connectAttr -f ($Cnd5 + ".outColorR") ($PMA9 + ".input1D[1]"); | |
connectAttr -f ($PMA9 + ".output1D") ($Cnd3 + ".secondTerm"); | |
connectAttr -f ($PMA9 + ".output1D") ($Cnd3 + ".colorIfFalseR"); | |
// Adding a last MD node so that mirroring works | |
shadingNode -asUtility multiplyDivide -n R_leg_MD_MirrorResult; | |
setAttr "R_leg_MD_MirrorResult.input1X" -1; | |
connectAttr -f ($Cnd1 + ".outColorR") ("R_leg_MD_MirrorResult" + ".input2X"); | |
connectAttr -f ("R_leg_MD_MirrorResult" + ".outputX") ($R_LocNameAnkle + ".translateY"); | |
//Checking if user wants to create an FK chain | |
int $Leg_IKFK_CB = `checkBox -q -v Leg_IKFK_Check`; | |
if ($Leg_IKFK_CB == 1){ | |
// creation of Bound Chain on Position of Locs | |
// Creating the IKFK Grear | |
/// Creat GEAR control | |
curve -d 1 -p -1.327953 0 -9.954337 -p 1.341144 0 -9.938909 -p 1.780851 0 -7.269811 -p 3.678533 0 -6.513824 -p 5.961923 0 -8.079797 -p 7.890462 0 -6.197544 -p 6.30906 0 -4.022152 -p 7.203902 0 -2.078185 -p 9.880714 0 -1.599907 -p 9.993845 0 1.032165 -p 7.353172 0 1.453142 -p 6.553317 0 3.642221 -p 8.128883 0 5.924288 -p 6.369816 0 7.795225 -p 4.211166 0 6.221865 -p 1.945528 0 7.247696 -p 1.442053 0 9.953875 -p -1.094204 0 9.985343 -p -1.496984 0 7.367271 -p -3.901078 0 6.416962 -p -6.135249 0 7.958855 -p -7.92888 0 6.184105 -p -6.349226 0 4.006574 -p -7.305829 0 1.671708 -p -9.961661 0 1.1997 -p -9.936487 0 -1.38061 -p -7.280655 0 -1.802271 -p -6.361813 0 -3.967214 -p -7.878532 0 -6.188799 -p -6.028261 0 -8.032777 -p -3.819263 0 -6.44683 -p -1.811656 0 -7.25239 -p -1.327953 0 -9.954336 -k 0 -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 -k 8 -k 9 -k 10 -k 11 -k 12 -k 13 -k 14 -k 15 -k 16 -k 17 -k 18 -k 19 -k 20 -k 21 -k 22 -k 23 -k 24 -k 25 -k 26 -k 27 -k 28 -k 29 -k 30 -k 31 -k 32 -n ($LR + "leg_GEAR_CTRL"); | |
//rename "curveShape1" ($LR + "leg_GEAR_CTRL_shape"); | |
addAttr -ln "IK_FK" -at double -min 0 -max 1 -dv 0 ($LR + "leg_GEAR_CTRL"); | |
setAttr -e-keyable true ($LR + "leg_GEAR_CTRL.IK_FK"); | |
setAttr ($LR + "leg_GEAR_CTRL" + ".overrideEnabled") 1; | |
setAttr ($LR + "leg_GEAR_CTRL" + ".overrideColor") 17; | |
// F | |
curve -d 1 -p -0.8 0 -1.6 -p -0.8 0 -2.4 -p -3.6 0 -2.4 -p -3.6 0 2.4 -p -2.8 0 2.4 -p -2.8 0 0.4 -p -1 0 0.4 -p -1 0 -0.4 -p -2.8 0 -0.4 -p -2.8 0 -1.6 -p -0.8 0 -1.6 -k 0 -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 -k 8 -k 9 -k 10 -n ($LR + "F_leg_CTRL_Curve"); | |
setAttr ($LR + "F_leg_CTRL_Curve" + ".overrideEnabled") 1; | |
setAttr ($LR + "F_leg_CTRL_Curve" + ".overrideColor") 17; | |
setAttr ($LR + "F_leg_CTRL_Curve" + ".visibility") 0; | |
// I | |
curve -d 1 -p -2.4 0 -2.4 -p -1.6 0 -2.4 -p -1.6 0 2.4 -p -2.4 0 2.4 -p -2.4 0 -2.4 -k 0 -k 1 -k 2 -k 3 -k 4 -n ($LR + "I_leg_CTRL_Curve"); | |
setAttr ($LR + "I_leg_CTRL_Curve" + ".overrideEnabled") 1; | |
setAttr ($LR + "I_leg_CTRL_Curve" + ".overrideColor") 17; | |
// K | |
curve -d 1 -p 0.6 0 -2.4 -p 1.4 0 -2.4 -p 1.4 0 -0.2 -p 3.2 0 -2.4 -p 4.2 0 -2.4 -p 2.2 0 0 -p 4.2 0 2.4 -p 3.2 0 2.4 -p 1.4 0 0.2 -p 1.4 0 2.4 -p 0.6 0 2.4 -p 0.6 0 -2.4 -k 0 -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 -k 8 -k 9 -k 10 -k 11 -n ($LR + "K_leg_CTRL_Curve"); | |
setAttr ($LR + "K_leg_CTRL_Curve" + ".overrideEnabled") 1; | |
setAttr ($LR + "K_leg_CTRL_Curve" + ".overrideColor") 17; | |
parent ($LR + "F_leg_CTRL_Curve") ($LR + "I_leg_CTRL_Curve") ($LR + "K_leg_CTRL_Curve") ($LR + "leg_GEAR_CTRL"); | |
setDrivenKeyframe -currentDriver ($LR + "leg_GEAR_CTRL" + ".IK_FK") ($LR + "F_leg_CTRL_Curve" + ".visibility"); | |
setDrivenKeyframe -currentDriver ($LR + "leg_GEAR_CTRL" + ".IK_FK") ($LR + "I_leg_CTRL_Curve" + ".visibility"); | |
setAttr ($LR + "leg_GEAR_CTRL" + ".IK_FK") 1; | |
setAttr ($LR + "F_leg_CTRL_Curve" + ".visibility") 1; | |
setAttr ($LR + "I_leg_CTRL_Curve" + ".visibility") 0; | |
setDrivenKeyframe -currentDriver ($LR + "leg_GEAR_CTRL" + ".IK_FK") ($LR + "F_leg_CTRL_Curve" + ".visibility"); | |
setDrivenKeyframe -currentDriver ($LR + "leg_GEAR_CTRL" + ".IK_FK") ($LR + "I_leg_CTRL_Curve" + ".visibility"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "K_leg_CTRL_Curve" + ".tx"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "K_leg_CTRL_Curve" + ".ty"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "K_leg_CTRL_Curve" + ".tz"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "K_leg_CTRL_Curve" + ".rx"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "K_leg_CTRL_Curve" + ".ry"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "K_leg_CTRL_Curve" + ".rz"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "K_leg_CTRL_Curve" + ".sx"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "K_leg_CTRL_Curve" + ".sy"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "K_leg_CTRL_Curve" + ".sz"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "K_leg_CTRL_Curve" + ".v"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "I_leg_CTRL_Curve" + ".tx"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "I_leg_CTRL_Curve" + ".ty"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "I_leg_CTRL_Curve" + ".tz"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "I_leg_CTRL_Curve" + ".rx"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "I_leg_CTRL_Curve" + ".ry"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "I_leg_CTRL_Curve" + ".rz"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "I_leg_CTRL_Curve" + ".sx"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "I_leg_CTRL_Curve" + ".sy"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "I_leg_CTRL_Curve" + ".sz"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "I_leg_CTRL_Curve" + ".v"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "F_leg_CTRL_Curve" + ".tx"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "F_leg_CTRL_Curve" + ".ty"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "F_leg_CTRL_Curve" + ".tz"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "F_leg_CTRL_Curve" + ".rx"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "F_leg_CTRL_Curve" + ".ry"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "F_leg_CTRL_Curve" + ".rz"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "F_leg_CTRL_Curve" + ".sx"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "F_leg_CTRL_Curve" + ".sy"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "F_leg_CTRL_Curve" + ".sz"); | |
setAttr -lock true -keyable false -channelBox false ($LR + "F_leg_CTRL_Curve" + ".v"); | |
xform -r -t -30 0 30 -s 0.5 0.5 0.5 ($LR + "leg_GEAR_CTRL"); | |
// creating FK leg CTRLs | |
circle -c 0 0 0 -nr 0 1 0 -sw 360 -r 4 -d 3 -ut 0 -tol 0.01 -s 8 -ch 1 -n ($FK1 + "CTRL"); | |
xform -ro 0 0 -90 ($FK1 + "CTRL"); | |
makeIdentity -apply true -t 1 -r 1 -s 1 -n 0 -pn 1 ($FK1 + "CTRL"); | |
select -r ($FK1 + "CTRL" + "Shape"); | |
select -add $FK1; | |
parent -r -s; | |
delete ($FK1 + "CTRL"); | |
circle -c 0 0 0 -nr 0 1 0 -sw 360 -r 4 -d 3 -ut 0 -tol 0.01 -s 8 -ch 1 -n ($FK2 + "CTRL"); | |
xform -ro 0 0 -90 ($FK2 + "CTRL"); | |
makeIdentity -apply true -t 1 -r 1 -s 1 -n 0 -pn 1 ($FK2 + "CTRL"); | |
select -r ($FK2 + "CTRL" + "Shape"); | |
select -add $FK2; | |
parent -r -s; | |
delete ($FK2 + "CTRL"); | |
circle -c 0 0 0 -nr 0 1 0 -sw 360 -r 4 -d 3 -ut 0 -tol 0.01 -s 8 -ch 1 -n ($FK3 + "CTRL"); | |
xform -ro 0 0 -90 ($FK3 + "CTRL"); | |
makeIdentity -apply true -t 1 -r 1 -s 1 -n 0 -pn 1 ($FK3 + "CTRL"); | |
select -r ($FK3 + "CTRL" + "Shape"); | |
select -add $FK3; | |
parent -r -s; | |
delete ($FK3 + "CTRL"); | |
// Parenting the Bound to IK and FK leg; | |
select -r $R_JT1 $FK1 $Bn1; | |
parentConstraint -weight 1 -n ($Bn1 + "ParConst"); | |
select -r $R_JT2 $FK2 $Bn2; | |
parentConstraint -weight 1 -n ($Bn2 + "ParConst"); | |
select -r $R_JT3 $FK3 $Bn3; | |
parentConstraint -weight 1 -n ($Bn3 + "ParConst"); | |
// SDK IK FK mode | |
setAttr ($Bn1 + "ParConst" + "." + $R_JT1 + "W0") 0; | |
setAttr ($Bn2 + "ParConst" + "." + $R_JT2 + "W0") 0; | |
setAttr ($Bn3 + "ParConst" + "." + $R_JT3 + "W0") 0; | |
setDrivenKeyframe -currentDriver ($LR + "leg_GEAR_CTRL" + ".IK_FK") ($Bn1 + "ParConst" + "." + $R_JT1 + "W0"); | |
setDrivenKeyframe -currentDriver ($LR + "leg_GEAR_CTRL" + ".IK_FK") ($Bn1 + "ParConst" + "." + $FK1 + "W1"); | |
setDrivenKeyframe -currentDriver ($LR + "leg_GEAR_CTRL" + ".IK_FK") ($Bn2 + "ParConst" + "." + $R_JT2 + "W0"); | |
setDrivenKeyframe -currentDriver ($LR + "leg_GEAR_CTRL" + ".IK_FK") ($Bn2 + "ParConst" + "." + $FK2 + "W1"); | |
setDrivenKeyframe -currentDriver ($LR + "leg_GEAR_CTRL" + ".IK_FK") ($Bn3 + "ParConst" + "." + $R_JT3 + "W0"); | |
setDrivenKeyframe -currentDriver ($LR + "leg_GEAR_CTRL" + ".IK_FK") ($Bn3 + "ParConst" + "." + $FK3 + "W1"); | |
setAttr ($LR + "leg_GEAR_CTRL" + ".IK_FK") 0; | |
setAttr ($Bn1 + "ParConst" + "." + $R_JT1 + "W0") 1; | |
setAttr ($Bn1 + "ParConst" + "." + $FK1 + "W1") 0; | |
setAttr ($Bn2 + "ParConst" + "." + $R_JT2 + "W0") 1; | |
setAttr ($Bn2 + "ParConst" + "." + $FK2 + "W1") 0; | |
setAttr ($Bn3 + "ParConst" + "." + $R_JT3 + "W0") 1; | |
setAttr ($Bn3 + "ParConst" + "." + $FK3 + "W1") 0; | |
setDrivenKeyframe -currentDriver ($LR + "leg_GEAR_CTRL" + ".IK_FK") ($Bn1 + "ParConst" + "." + $R_JT1 + "W0"); | |
setDrivenKeyframe -currentDriver ($LR + "leg_GEAR_CTRL" + ".IK_FK") ($Bn1 + "ParConst" + "." + $FK1 + "W1"); | |
setDrivenKeyframe -currentDriver ($LR + "leg_GEAR_CTRL" + ".IK_FK") ($Bn2 + "ParConst" + "." + $R_JT2 + "W0"); | |
setDrivenKeyframe -currentDriver ($LR + "leg_GEAR_CTRL" + ".IK_FK") ($Bn2 + "ParConst" + "." + $FK2 + "W1"); | |
setDrivenKeyframe -currentDriver ($LR + "leg_GEAR_CTRL" + ".IK_FK") ($Bn3 + "ParConst" + "." + $R_JT3 + "W0"); | |
setDrivenKeyframe -currentDriver ($LR + "leg_GEAR_CTRL" + ".IK_FK") ($Bn3 + "ParConst" + "." + $FK3 + "W1"); | |
select -cl; | |
//Cleanup of IK FK arm setup | |
parent $Bn1 $R_RootName ; | |
parent $FK1 $R_RootName ; | |
parent ($LR + "leg_GEAR_CTRL") $R_RootName ; | |
}else{ | |
delete $Bn1; | |
delete $FK1; | |
} | |
}else{ | |
warning "Must Create Leg Before Mirroring"; | |
} | |
} | |
proc DeleteSetupLeg(){ | |
string $DeleteConfirm = `confirmDialog -title "Delete Leg" -message "Are you sure?" | |
-button "Yes" -button "No" -defaultButton "Yes" | |
-cancelButton "No" -dismissString "No"`; | |
if ($DeleteConfirm == "Yes"){ | |
string $R_RootName = "R_leg_Root"; | |
if( `objExists $R_RootName` ) { | |
select -r $R_RootName; | |
delete; | |
select -cl; | |
} | |
string $L_RootName = "L_leg_Root"; | |
if( `objExists $L_RootName` ) { | |
select -r $L_RootName; | |
delete; | |
select -cl; | |
OptimizeScene; | |
} else { | |
warning("Leg Setup Does not Exist"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment