// =========================================================================== // 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. // =========================================================================== // // Proceduce Name: // doAppendNclothCache // // Description: // Append to cache as specified by options // // Input Arguments: // Time mode, start time, end time, simulation rate, sample multiplier // // Return Value: // None // global proc doAppendNclothCache(int $timeMode, float $startTime, float $endTime, float $simRate, int $sampleMult ) { string $obj; string $cmd = "cacheFile -refresh -appendFrame "; string $objects[] = getNclothObjectsToCache(1); for( $obj in $objects ) { $cmd += (" -cnd " + $obj); } switch( $timeMode ) { case 1: $startTime = `currentTime -q`; $endTime = $startTime; break; case 2: $startTime = `currentTime -q`; $endTime = `playbackOptions -q -max`; break; case 3: $startTime = `playbackOptions -q -min`; $endTime = `playbackOptions -q -max`; break; case 4: $endTime = `playbackOptions -q -max`; // No break - fall through to case 4 to set the startTime to the // current cache end time // case 5: $startTime = getCacheEndTime( getGeometriesToCache() ); // If we're doing case 5 only, $endTime has already been // initialized to optionVar appendNclothCacheEndTime; if we're // dropping down from case 4, we've aleady overriden $endTime // appropriately. Either way, we have nothing further to do. // break; case 6: default: // $startTime and $endTime have already been initialized to // optionVar appendNclothCacheStartTime & appendNclothCacheEndTime, // so we have nothing futher to do. // break; } $cmd += (" -startTime " + $startTime ); $cmd += (" -endTime " + $endTime ); $cmd += (" -simulationRate " + $simRate ); $cmd += (" -sampleMultiplier " + $sampleMult ); $cmd += (" -noBackup" ); evalEcho($cmd); }