// =========================================================================== // 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, 1999 // // Description: // This script adds the selected shape as a target for the // specified blendShape node. // global proc blendShapeAddBaseTarget(string $bsNode) // // Description: // Add selected item as a target to the blendShape node. // { string $sel[]=`ls -sl -tr`; if (size($sel) != 1) error((uiRes("m_blendShapeAddBaseTarget.kSelectOneBase"))); if ("blendShape" != nodeType($bsNode)) { error((uiRes("m_blendShapeAddBaseTarget.kArgumentBlend"))); } string $resel[]=`duplicate $sel[0]`; if (size($resel)) { // Find a multiIndex for the new target // int $wc = `blendShape -q -wc $bsNode`; int $mi = bsMultiIndexForTarget($bsNode,$wc-1); if (-1 == $mi) { $mi = $wc; } else { $mi = $mi+1; } if (catch(`blendShape -e -t $sel[0] $mi $resel[0] 1 $bsNode`)) { delete($resel[0]); } // we also have to check the weightCount to see if it succeeded // since under some conditions the blendShape -e command does not // throw during errors. // int $newwc = `blendShape -q -wc $bsNode`; if ($newwc == $wc) { delete($resel[0]); } } }