// =========================================================================== // 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: 2005 // // Description: // This method sets the enable state on the caches associated with // the selected objects. // global proc int setCacheEnable(int $val, int $silent, string $shapes[]) { int $count = 0; if (size($shapes) == 0) { string $geoms[] = `getGeometriesToCache`; string $ncloths[] = `getNclothObjectsToCache 0`; $shapes = AWAppendStringsToStringArray($geoms,$ncloths); } string $doneCaches[]; if (size($shapes) == 0) { if (! $silent) { error((uiRes("m_setCacheEnable.kNothingSelected"))); } } for ($shape in $shapes) { string $caches[] = `findExistingCaches $shape`; for ($cacheFile in $caches) { if (0 == AWNumberOfOccurrencesInStringArray($cacheFile, $doneCaches)) { $doneCaches[size($doneCaches)] = $cacheFile; setAttr ($cacheFile+".enable") $val; $count++; } } } string $enabledFormat = (uiRes("m_setCacheEnable.kEnabledCaches")); string $disabledFormat = (uiRes("m_setCacheEnable.kDisabledCaches")); string $format; if ($val) { $format = $enabledFormat; } else { $format = $disabledFormat; } string $resultInfo = `format -stringArg $count $format`; if (! $silent) { print $resultInfo; } return $count; }