// =========================================================================== // 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 3D Fluid Container // global proc string create3DFluid( int $resW, int $resH, int $resD, float $dimW, float $dimH, float $dimD ) { string $fluidShape = `createFluid false`; setAttr ($fluidShape + ".resolutionW") $resW; setAttr ($fluidShape + ".resolutionH") $resH; setAttr ($fluidShape + ".resolutionD") $resD; setAttr ($fluidShape + ".dimensionsW") $dimW; setAttr ($fluidShape + ".dimensionsH") $dimH; setAttr ($fluidShape + ".dimensionsD") $dimD; // If the input resolution is proportional we can enable square voxels without changing the effective resolution int $res = $resW; float $maxDim = $dimW; if( $dimH > $maxDim ){ $res = $resH; $maxDim = $dimH; } if( $dimD > $maxDim ){ $res = $resD; $maxDim = $dimD; } setAttr( $fluidShape + ".baseResolution") $res; if( $resW == (int)((float)$res * $dimW/$maxDim) && $resH == (int)((float)$res * $dimH/$maxDim) && $resD == (int)((float)$res * $dimD/$maxDim) ){ setAttr( $fluidShape + ".squareVoxels" ) true; } string $par[] = `listRelatives -parent $fluidShape`; if( size($par[0]) ) { select -r $par[0]; } return $fluidShape; }