// =========================================================================== // 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. // =========================================================================== global proc int[] doBlendShapeAddSelectionAsTarget( string $bs, int $top, int $targetType, string $transformName, int $editOn, int $resetWeight ) // // Description: // Add a target with/without selection // // Input Arguments: // $bs - Blend shape name; // $top - If check topology; // $targetType - 1 for automatic; // 2 for object space; // 3 for tangent space; // 4 for transform space; // $transformName - Joint name (used for transform space target); // $editOn - If the added target is Edit on // // Return Value: // Newly added target index. // { // Filter out valid target meshes from selection string $sel[] = `ls -dag -g -sl`; string $selectedMeshes[]; for ($i = 0; $i < size($sel); ++ $i) { if (blendShapeCanAddAsTarget($sel[$i])) $selectedMeshes = stringArrayCatenate($selectedMeshes, {$sel[$i]}); } if(size($selectedMeshes) == 0) { error((uiRes("m_doBlendShapeAddSelectionAsTarget.kNoTargetMeshSelected"))); return {}; // No target mesh selected } int $newTargetIds[] = doBlendShapeAddTarget( $bs, $top, $targetType, $transformName, $editOn, $resetWeight, $selectedMeshes ); return $newTargetIds; }