// =========================================================================== // 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: Sept, 1999 // // Procedure Name: // doMirrorSkinWeightsArgList // // Description: // Mirror skin weights // // Input Arguments: // $version: The version of this option box. Used to know how to // interpret the $args array. // "1" : $name // // $args // Version 2 // [0] $cmdArgs : The set of flags to pass through to the command // Version 1 // [0] $mirrorMode : Which axis to mirror XY, YZ, XZ // [1] $posToNeg: 1 = posToNeg, 0 = negToPos // // Return Value: // None // global proc int doMirrorSkinWeightsArgList( string $version, string $args[] ) { string $currentSelection[] = `ls -selection`; if (size($currentSelection) < 1) { error( (uiRes("m_doMirrorSkinWeightsArgList.kSelectionError")) ); return 0; } // Handle the different versions of arguments we accept and convert them into // an set of flat command flags // string $cmdArgs; if( $version == "2") { $cmdArgs = $args[0]; } else { if (size($args) != 2) { error( (uiRes("m_doMirrorSkinWeightsArgList.kInvalidArgCount")) ); return 0; } string $mode = $args[0]; int $posToNeg = $args[1]; $cmdArgs += (" -mirrorMode "+$mode); if (! $posToNeg) { $cmdArgs += " -mirrorInverse"; } } int $componentMode = 0; string $srcCluster, $dstCluster; // find source and destination skin shapes // if (size($currentSelection) <= 2) { $srcCluster = findRelatedSkinCluster($currentSelection[0]); if (size($currentSelection) == 1) { $dstCluster = $srcCluster; } else { $dstCluster = findRelatedSkinCluster($currentSelection[1]); } if (size($srcCluster) == 0) { string $isControlPoint[] = `ls -type controlPoint $currentSelection[0]`; string $isTransform[] = `ls -type transform $currentSelection[0]`; if (size($isControlPoint) || size($isTransform)) { string $format = (uiRes("m_doMirrorSkinWeightsArgList.kNotInASkinCluster")); string $err = `format -stringArg $currentSelection[0] $format`; error($err); return 0; } else { // try component mode // $componentMode = 1; } } } // construct the command // string $cmd; if ($componentMode) { $cmd = ("copySkinWeights"); } else { $cmd = ("copySkinWeights -ss "+$srcCluster+" -ds "+$dstCluster); } $cmd += $cmdArgs; evalEcho($cmd); return 1; }