// =========================================================================== // 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: // Make sure the fluid's resolution matches its cache // // global proc fluidCheckResolutionAgainstCaches() { if( !`exists getActiveFluidShapes` ) { source "getFluidShape.mel"; } string $activeFluids[] = getActiveFluidShapes(); for( $fluid in $activeFluids ) { float $fRes[] = `getAttr ($fluid + ".resolution")`; int $errorCondition = 0; int $hasCache = `fluidCacheInfo -hasCache -ic $fluid`; if( $hasCache == 1 ) { int $icRes[] = `fluidCacheInfo -ic -re $fluid`; if( $icRes[0] != $fRes[0] || $icRes[1] != $fRes[1] || $icRes[2] != $fRes[2] ) { $errorCondition += 1; } } $hasCache = `fluidCacheInfo -hasCache -pb $fluid`; if( $hasCache == 1 ) { int $pbRes[] = `fluidCacheInfo -pb -re $fluid`; if( $pbRes[0] != $fRes[0] || $pbRes[1] != $fRes[1] || $pbRes[2] != $fRes[2] ) { $errorCondition += 2; } } string $noMatch = ( "The resolution of \'" + $fluid + "\' does not " + "match the resolution of its " ); string $rebuild; string $rebuildPB = "To rebuild the cache, use \'Create Cache\'. "; string $rebuildIC = ( "To rebuild the Initial State, use \'Set as " + "Initial State\'. " ); string $changeRes = ( "To change a fluid's resolution, use \'Edit Fluid " + "Resolution\'." ); if( $errorCondition > 2 ) { $noMatch += "cache or Initial State. "; $rebuild = $rebuildPB + $rebuildIC; } else if( $errorCondition > 1 ) { $noMatch += "cache. "; $rebuild = $rebuildPB; } else if( $errorCondition > 0 ) { $noMatch += "Initial State. "; $rebuild = $rebuildIC; } if( $errorCondition > 0 ) { warning( $noMatch ); warning( $rebuild ); warning( $changeRes ); } } }