// =========================================================================== // 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, 2000 // // Procedure Name: // doNormalizeWeightsArgList // // Description: // For smooth skinned objects, enable or disable weight normalization, // or normalize the weights. // // Input Arguments: // $version: The version of this option box. Used to know how to // interpret the $args array. // // $args // Version 1 // $args[0] : action: 1 = disable normalization, // 2 = enable normalization, (interactive) // 3 = enable post normalization // 4 = normalize weights on selected items // // // Return Value: // None // global proc int doNormalizeWeightsArgList( string $version, string $args[] ) { string $currentSelection[] = `ls -selection`; int $mode = $args[0]; int $foundSkin = 0; for ($sel in $currentSelection) { // find source and destination skin shapes // string $buff[]; tokenize($sel,".",$buff); string $srcCluster = findRelatedSkinCluster($buff[0]); if ("" != $srcCluster) { string $cmd; $foundSkin = 1; if (1 == $mode) { // disable the normalize $cmd = ("setAttr "+$srcCluster+".normalizeWeights 0"); } else if (2 == $mode) { // interactive normalize $cmd = ("setAttr "+$srcCluster+".normalizeWeights 1"); } else if (3 == $mode) { // post normalize $cmd = ("setAttr "+$srcCluster+".normalizeWeights 2"); } else { // use the skin percent normalization $cmd = ("skinPercent -normalize true "+$srcCluster+";"); } evalEcho($cmd); } } select -r $currentSelection; if (! $foundSkin) { error( (uiRes("m_doNormalizeWeightsArgList.kSelectSkin"))); } return 1; }