// =========================================================================== // 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: // Extend Fluid // // global proc doExtendFluid( int $version, string $args[] ) { if(( $version < 1 ) || ( size( $args ) < 6 )) { error(uiRes("m_doAppendHairCache.kIncorrectVersion")); return; } int $minX = $args[0]; int $maxX = $args[1]; int $minY = $args[2]; int $maxY = $args[3]; int $minZ = $args[4]; int $maxZ = $args[5]; // Make sure that we have a fluid selected // or warn the user and fail string $selectionList[] = `ls -sl`; int $numSelected = size($selectionList); if ($numSelected == 0) { error(uiRes("m_doDeleteFluidsPB.kNoFluidsSelected")); return; } $fluidShape = getFluidShape($selectionList[0]); if (size($fluidShape) == 0) { error((uiRes("m_doExtendFluid.kSelectFluidFirst"))); return; } string $cmd; $cmd = "extendFluid "; $cmd = $cmd + "-sw " + $minX + " "; $cmd = $cmd + "-ew " + $maxX + " "; $cmd = $cmd + "-sh " + $minY + " "; $cmd = $cmd + "-eh " + $maxY + " "; $cmd = $cmd + "-sd " + $minZ + " "; $cmd = $cmd + "-ed " + $maxZ + "; "; float $fRes[] = `getAttr ($fluidShape + ".resolution")`; int $is2d = `getAttr ($fluidShape + ".is2d")`; int $newResX = $fRes[0] + $minX + $maxX; int $newResY = $fRes[1] + $minY + $maxY; int $newResZ = 1; if(!$is2d) $newResZ = $fRes[2] + $minZ + $maxZ; if( verifyFluidResolution( $fluidShape, $newResX, $newResY, $newResZ ) ) { $cmd = rebuildFluidInitialStateCmd( $cmd, "extendFluidRebuildIC" ); } else { $cmd = ""; } eval $cmd; }