// =========================================================================== // 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. // =========================================================================== global proc fluidToPoly() { string $sel[] = `ls -sl -dag -type fluidShape`; if( size( $sel ) < 1 ){ warning( (uiRes("m_fluidToPoly.kNoFluidsSelectedPoly")) ); return; } string $fluid; string $meshes[]; int $numMeshes = 0; for ( $fluid in $sel ){ // if the user deliberately picks just one intermediate object // they probably did it on purpose, otherwise keep looking for a non-intermediate one if( (size( $sel ) > 1) && getAttr ($fluid + ".io")) continue; string $mNode = `createMeshNode`; connectAttr ($fluid + ".outMesh") ($mNode + ".inMesh"); setAttr -type "string" ($mNode+".motionVectorColorSet") "velocityPV"; setAttr ($fluid + ".intermediateObject") true; string $par[] = `listRelatives -parent $mNode`; if( size($par) > 0 ){ select -r $par[0]; $mNode = $par[0]; sets -e -forceElement initialShadingGroup; } $meshes[$numMeshes] = $mNode; $numMeshes++; } if( $numMeshes > 0 ){ select -r $meshes; } }