// =========================================================================== // 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: 2002 // // Description: Create a pond, or fluid with a water surface simulation // if it does not exist already, and then create wake and foam emitters for selected objects. // proc string createWakeEmitter(string $wakeFluid, float $wakeIntensity, float $foamIntensity) { // Create a fluid emitter for the passed in wakeFluid and set the density and temperature // emission rates string $emitter[] = `fluidEmitter -n "PondWakeEmitter#" -pos 0 0 0 -type volume -vsh sphere -der $wakeIntensity -her $foamIntensity -fer 1 -fdr 2 -r 100.0 -cye none -cyi 1 -mxd 1 -mnd 0 `; setAttr ($emitter[0] + ".fluidDropoff") 0.5; setAttr ($emitter[0] + ".fluidJitter") 0; connectDynamic -em $emitter[0] $wakeFluid; if( $foamIntensity > 0.0 ){ setAttr ($wakeFluid + ".temperatureMethod") 2; } string $emitNotes = ("The following emitter attributes control wake behavior:\n" +"Density/Voxel/Sec controls the wake intensity.\n" +"Heat/Voxel/Sec controls foam creation if the Temperature Method " +"on the pond is set to Dynamic Grid."); addAttr -sn nts -ln notes -dt "string" $emitter[0]; setAttr -type "string" ($emitter[0] + ".notes") $emitNotes; return($emitter[0]); } global proc createWake( float $wakeIntensity, float $foamIntensity) { string $wakeFluid = getCurrentPond(); if( $wakeFluid == "" ){ return; } // get objects to create wakes for string $sel[] = `ls -sl`; // restrict to transforms?? int $numSel = size($sel); int $foundActualBoat = false; if( $numSel > 0 ){ for( $i = 0; $i < $numSel; $i++ ){ string $boatObj = $sel[$i]; if( isValidBoatObject( $boatObj ) ){ string $emitter = createWakeEmitter($wakeFluid, $wakeIntensity, $foamIntensity); // parent the emitter under the boat parent -r $emitter $boatObj; $foundActualBoat = true; } } } if(!$foundActualBoat) { // create wake without an object if nothing is selected createWakeEmitter($wakeFluid, $wakeIntensity, $foamIntensity); } }