// =========================================================================== // 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: 20 Feb 2002 // // Description: // Delete HairSystem Cache // // proc deleteHairCache( string $cacheNode, int $deleteCacheFile ) // // Description: // When we clear the cache: // * delete the diskCache node // * delete any hidden disk files associated with this node // * delete the real disk file only if $deleteCacheFile == true // { string $rules[] = `workspace -q -fr`; string $dataDir = ""; int $i = 0; for( ; $i < size($rules)-1; $i+=2 ) { if( $rules[$i] == "diskCache" ) { $dataDir = $rules[$i+1]; break; } } string $realPath = (`workspace -q -rd` + $dataDir); string $realFile = `getAttr ( $cacheNode + ".cacheName" )`; string $hiddenPath = `diskCache -q -tmp`; string $hiddenFile = `getAttr ( $cacheNode + ".hiddenCacheName" )`; if( $hiddenFile != $realFile ) { eval ("sysFile -del \"" + $hiddenPath + "/" + $hiddenFile + "\"" ); } if( $deleteCacheFile ) { eval ("sysFile -del \"" + $realPath + "/" + $realFile + "\"" ); } delete $cacheNode; } proc string clearHairPBCache( string $hair, int $deleteCacheFile ) { string $dskC; if(`connectionInfo -id ($hair + ".diskCache")` > 0 ) { string $src = `connectionInfo -sfd ($hair + ".diskCache")`; string $buffer[]; tokenize($src, ".", $buffer); $dskC = $buffer[0]; deleteHairCache( $dskC, $deleteCacheFile ); } return $dskC; } proc clearActiveHairPBCaches( int $deleteFile ) { string $hairSystemShapes[] = `getSelectedHairSystems`; for( $hair in $hairSystemShapes ) { clearHairPBCache( $hair, $deleteFile ); } } global proc doDeleteHairPB() // // Description: // // { // Make sure that we have a hair selected // or warn the user and fail // string $hairSystemShapes[] = getSelectedHairSystems(); if( size($hairSystemShapes) == 0 ) { error((uiRes("m_doDeleteHairPB.kNoHairSystemSelected"))); return; } clearActiveHairPBCaches false; }