// =========================================================================== // 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: 13 April 1997 // // Procedure Name: // setNewBoneFlexorJoint // // Description: // Assign the selected joint as the driver for the selected bone // flexor. // // Input Arguments: // None. // // Return Value: // None. // global proc setNewBoneFlexorJoint() // // Description: // // { int $ii; int $foundJoint = 0; int $foundLattice = 0; string $latticeName; string $jointName; string $rels[3]; string $sel[5] = `ls -sl`; int $count = size($sel); for ($ii = 0; $ii < $count; $ii++) { if (nodeType($sel[$ii]) == "joint") { $foundJoint++; $jointName = $sel[$ii]; } else if (nodeType($sel[$ii]) == "transform") { $rels = `listRelatives $sel[$ii]`; for ($jj = 0; $jj < size($rels); $jj++) { if (nodeType($rels[$jj]) == "lattice") { int $isIntermediate = `getAttr ($rels[$jj]+".io")`; if (! $isIntermediate) { $foundLattice++; $latticeName = $rels[$jj]; } } } } } if ($foundJoint != 1 || $foundLattice != 1) { error( (uiRes("m_setNewBoneFlexorJoint.kOneJointAndOneBoneLattice"))); return; } string $boneFlex = ""; string $conns[2] = `listConnections ($latticeName+".li")`; $count = size($conns); for ($ii = 0; $ii < $count; $ii++) { if (nodeType($conns[$ii]) == "boneLattice") { $boneFlex = $conns[$ii]; break; } } if ($boneFlex == "") { error( (uiRes("m_setNewBoneFlexorJoint.kSelectedLattice"))); } boneLattice -e -j $jointName $boneFlex; }