// =========================================================================== // 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: // Create 2D Fluid Container // global proc string create2DFluid( int $resX, int $resY, float $dimX, float $dimY, float $dimZ ) { string $fluidShape = `createFluid true`; setAttr ($fluidShape + ".resolutionW") $resX; setAttr ($fluidShape + ".resolutionH") $resY; setAttr ($fluidShape + ".dimensionsW") $dimX; setAttr ($fluidShape + ".dimensionsH") $dimY; setAttr ($fluidShape + ".dimensionsD") $dimZ; // Set square voxels on if resolution is proportional to dimensions int $res = $resX; float $maxDim = $dimX; if( $dimY > $maxDim ){ $res = $resY; $maxDim = $dimY; } setAttr ($fluidShape + ".baseResolution") $res; if( $resX == (int)((float)$res * $dimX/$maxDim) && $resY == (int)((float)$res * $dimY/$maxDim) ){ setAttr( $fluidShape + ".squareVoxels" ) true; } string $par[] = `listRelatives -parent $fluidShape`; if( size($par[0]) ) { select -r $par[0]; } return $fluidShape; }