// =========================================================================== // 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. // =========================================================================== // // // Procedure Name: // doDisconnectJoint // // Description: // Disconnects a joint from a skeleton hierarchy (the selected joint becomes // parented to the world), regardless of whether // the skeleton is currently bound to a skin or not. // // Return Value: // none // global proc doDisconnectJoint() { string $sl[] = `ls -sl -type joint`; if (size($sl) == 0) { error( (uiRes("m_doDisconnectJoint.kSelectAJointToDisconnect"))); } int $count = 0; for ($obj in $sl) { string $newJointName = `disconnectJoint -deleteHandleMode $obj`; string $bindPoses[] = `dagPose -q -name -bp $obj`; if(size($bindPoses)>0) { for($bindPose in $bindPoses) { dagPose -worldParent $obj $bindPose; select -r $newJointName; dagPose -bp -addToPose -name $bindPose; } } } select -cl; for ($obj in $sl) { select -add $obj; } }