// =========================================================================== // 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 doBlendShapeAddSelectionAsCombinationTarget(int $combineMethod, int $targetType, string $transformName) // // Description: // Create a combination target using selected meshes in scene. // Add the last selected mesh as combination target. // Add other selected meshes as driver targets. // // Input Arguments: // combineMethod - Combine method of the new added combination shape. // targetType - Target type if need to add new target // transformName - Transform name if need to add new target // { string $bsd = getBlendShapeForAddTarget(); if($bsd == "") { error((uiRes("m_doBlendShapeAddSelectionAsCombinationTarget.kNoBlendShapeSelected"))); return; //No blend shape selected in Shape Editor } int $newTargets[] = doBlendShapeAddSelectionAsTarget($bsd,1,$targetType,$transformName,0,1); if(size($newTargets) < 2) { error((uiRes("m_doBlendShapeAddSelectionAsCombinationTarget.kNeedMoreNewTargets"))); //Rollback if(size($newTargets) == 1) blendShapeDeleteTargetGroup($bsd, $newTargets[0]); return; //Need more than two new targets; } int $drivenTargetIndex = $newTargets[size($newTargets)-1]; intArrayRemoveAtIndex(size($newTargets)-1, $newTargets); $cmd = "combinationShape -bs " + $bsd + " -cti " + $drivenTargetIndex + " -cm " + $combineMethod; for($driverTargetIndex in $newTargets) { if($drivenTargetIndex == $driverTargetIndex) continue; $cmd += " -dti "; $cmd += $driverTargetIndex; } evalEcho($cmd); }