// =========================================================================== // Copyright 2018 Autodesk, Inc. All rights reserved. // // Use of this software is subject to the terms of the Autodesk license // agreement provided at the time of installation or download, or which // otherwise accompanies this software in either electronic or hard copy form. // =========================================================================== // // // Creation Date: Jan 17, 2005 // // Procedure Name: // doSetFullBodyIKKeysArgList // // Description: // This is the actual function that is called from the "Set Full // Body IK Keys" option box. // // Input Arguments: // $version: The version of this option box. Used to know how to // interpret the $args array. // // $args // Version 1 // [0] $setFullBodyKeys 1/2/3/4 : // if 1, set keys on all effectors and joints, // if 2, set keys on all effectors and joints of body part. // if 3, set keys on joints and effectors until // a pinned ancestor is encountered. // if 4, set keys on the selected effector. // Version 2 // [1] $keyOption 0/1/2 : // if 0, set key on reach value of 0 for all effectors in body part, // tangent is step // if 1, set key on reach value of 1 for selected effector in body part // other effectors get value of 0, tangent is stepNext // if 2, use the ik keying preference value for reach // [2] $item : $item to key in addition to selected items // // Version 3 // [1] $keyOption 1/2/3/4 : // if 2, (FK) set key on reach value of 0 for all effectors in body part, // tangent is step // if 1, (IK) set key on reach value of 1 for selected effector in body part // other effectors get value of 0, tangent is stepNext // if 3, (Simple) Do not key reach // if 4, use the ik keying preference value for reach // // // Return Value: // number of attributes keyframed // global proc int doSetFullBodyIKKeysArgList( string $version, string $args[] ) { int $versionNum = $version; int $total = 0; int $setFullBodyKeys = $args[0]; int $keyOption = 3; string $item = ""; if(`optionVar -exists fbikKeyOption`) { $keyOption = `optionVar -query fbikKeyOption`; } if($versionNum > 1) { $item = $args[2]; } if($versionNum == 2) { if ($args[1] != 2) { //This is a little confusing here: In version 2, the allowable args for args[1] are //0 = fk, 1 = ik, and 2 = use prefs, however, all the rest of the code //expects args of 1 = ik, 2 = fk, and 3 = simple key. So the logic //here reads: if we're not using the prefs, then if it's a ik key //give keyOption the value of 1, otherwise, it's an fk key, and keyOption //should have value 2. if ($args[1] == 1) { $keyOption = 1; } else $keyOption = 2; } } if($versionNum > 2) { //In version 3 and beyond we try to correct for the confusion above. So //Now 1 = ik, 2 = fk, 3 = simple key, and 4 = use prefs. if ($args[1] != 4) { $keyOption = $args[1]; } } loadFullBodyIKFunctions(); string $hikEffectors[]; findHikEffectors($item, $hikEffectors); if( size($hikEffectors) > 0) { $total += setKeysOnAllJointsAndHikEffectors($hikEffectors,$setFullBodyKeys,$keyOption); } else { error( (uiRes("m_doSetFullBodyIKKeysArgList.kNoHIKEffectorErr")) ); } return $total; }