// =========================================================================== // 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 initNParticleForStyle(string $nParticle) { string $style = "Point"; if( `optionVar -exists NParticleStyle` ){ $style = `optionVar -query NParticleStyle`; } // first the common settings setAttr ($nParticle +".collisionFlag") 1; setAttr ($nParticle +".selfCollide") false; int $doFluid = false; if( $style == "Points" ){ setAttr ($nParticle +".particleRenderType") 3; }else{ setAttr ($nParticle +".colorInput") 1; setAttr ($nParticle +".opacityScaleInput") 1; if ($style == "Cloud"){ setAttr ($nParticle +".particleRenderType") 8; setAttr ($nParticle +".ignoreSolverGravity") 1; setAttr ($nParticle +".radiusScaleInput") 1; setAttr ($nParticle +".color[1].color_Color") -type double3 0 .5 1; setAttr ($nParticle + ".color[1].color_Position") 1; setAttr ($nParticle + ".color[1].color_Interp") 1; }else if ($style == "ThickCloud"){ setAttr ($nParticle +".particleRenderType") 8; setAttr ($nParticle +".ignoreSolverGravity") 1; setAttr ($nParticle +".radiusScaleInput") 1; setAttr ($nParticle +".opacity") 0.98; $doFluid = true; }else if ($style == "Balls"){ setAttr ($nParticle +".particleRenderType") 7; setAttr ($nParticle +".radiusScaleInput") 1; setAttr ($nParticle +".color[0].color_Color") -type double3 1 0 0; setAttr ($nParticle +".color[1].color_Color") -type double3 0 .5 1; setAttr ($nParticle + ".color[1].color_Position") 1; setAttr ($nParticle + ".color[1].color_Interp") 1; setAttr ($nParticle + ".colorInput") 6; setAttr ($nParticle +".selfCollide") 1.0; setAttr ($nParticle +".bounce") 0.9; setAttr ($nParticle +".friction") 0.02; setAttr ($nParticle +".threshold") 0.0; setAttr ($nParticle +".opacity") 1.0; }else if ($style == "Water"){ setAttr ($nParticle +".color[0].color_Color") -type double3 0.5 0.7 1.0; setAttr ($nParticle +".particleRenderType") 7; setAttr ($nParticle +".threshold") 0.6; setAttr ($nParticle +".opacity") 0.3; setAttr ($nParticle +".enableSPH") 1; setAttr ($nParticle +".incompressibility") 1.0; setAttr ($nParticle +".friction") 0.0; setAttr ($nParticle +".bounce") 0.0; setAttr ($nParticle +".drag") 0.0; } } initNParticleShader( $nParticle , $style); } global proc setupNParticleConnections( string $nParticle ) { if( !objExists($nParticle) ){ warning( (uiRes("m_setupNParticleConnections.kNoNParticle"))); return; } string $sl[] = `ls -sl`; string $nucleus = getActiveNucleusNode( false, true ); addActiveToNSystem( $nParticle, $nucleus ); connectAttr ($nucleus + ".startFrame") ($nParticle +".startFrame"); initNParticleForStyle( $nParticle ); select $sl; }