// =========================================================================== // 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. // =========================================================================== // THIS SCRIPT IS TO CONVERT an NCLOTH InputAttract value so that the effect matches Maya2014 and earlier releases. // This is due to a bug that was fixed, where inputAttract had not been correctly normalized for nucleus substeps. // This is automatically invoked when old files are loaded, however one may still wish to invoke this by hand if one has // a custom cloth attribute preset that uses input attract. global proc convertPost2014ClothInputAttract( string $nObj ) { string $type = nodeType( $nObj ); if( $type != "nCloth" ){ return; } float $ia = getAttr($nObj + ".inputMeshAttract"); if( $ia == 0.0 ){ return; } // find the nucleus node for the cloth: string $con[] = `listConnections -type nucleus ($nObj+".startState")`; if( size( $con ) == 0 ){ return; } string $nucleus = $con[0]; float $sub = getAttr( $nucleus+".subSteps"); float $pf = 5.0; float $fac = 1.0/2.0; if( getAttr( $nObj+".inputAttractMethod" ) != 0 ){ $pf = 3.0; $fac = 1.5/2.0; } float $pf2 = 3.0; float $iaNew = $fac * pow((pow($ia,$pf) * $sub * $sub), 1.0/$pf2); setAttr ($nObj + ".inputMeshAttract") $iaNew; }