// =========================================================================== // 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: Mar, 2007 // // Procedure Name: // doConnectJointArgList // // Description: // connect one joint hierarchy to another // // Input Arguments: // $version: The version of this option box. Used to know how to // interpret the $args array. // "1" : first verison of connect joint // // $args // Version 1 // [0] $mode : -cm or -pm, -pm causes the 1 hierarchy to be parented to another // // Return Value: // $string: The command string // global proc doConnectJointArgList( string $version, string $args[] ) { string $currentSelection[] = `ls -selection`; string $mode = $args[0]; string $cmd = "connectJoint "; $cmd += $mode; evalEcho($cmd); if(size($currentSelection) < 2) { error( (uiRes("m_doConnectJointArgList.kSelectJointsForConnect"))); return; } string $jointToConnectFrom = $currentSelection[0]; string $jointToConnectTo = $currentSelection[1]; string $allChildren[] = `listRelatives -path -children -type joint $jointToConnectFrom`; string $bindPoses[] = `dagPose -q -name -bp $jointToConnectTo`; if(size($bindPoses)>0) { for($bindPose in $bindPoses) { select -r $jointToConnectFrom; dagPose -bp -addToPose -name $bindPose; for($child in $allChildren) { select -r $child; dagPose -bp -addToPose -name $bindPose; } } } }