/////////////////////////////////////////////////////////////////////////////////////////////// //Particle box //author: Walter Behrnes //Date Created: some time ago... //version: 1 // instructions // copy script to shelf, hit button. // your output should be a box of particles /////////////////////////////////////////////////////////////////////////////////////////////// // variables///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// global string $type, $newname; //Create Particle Window///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if ( (`window -ex ParticleMan`) == true ) deleteUI ParticleMan; string $window = `window -widthHeight 500 600 -title "ParticleMan" ParticleMan`; columnLayout -adj true -rowSpacing 5; //Particle Name and Count Control//////////////////////////////////////////////////////////////////////////////////////////////////////////////// frameLayout -label "Particle Name and Count"; gridLayout -numberOfColumns 2 -cellWidthHeight 200 30; text -label "Particle Name"; $newname = `textField`; floatSliderGrp -label "Particle Count" -field true -pre 0 -s 1 -minValue 1.0 -maxValue 500.0 -fieldMinValue 1.0 -fieldMaxValue 50000.0 -value 100 controler; setParent ..; setParent ..; //radiobuttons which create the particle type////////////////////////////////////////////////////////////////////////////////////////////////////// frameLayout -label "Type" -w 150; columnLayout; string $group1 = `radioButtonGrp -numberOfRadioButtons 3 -label "" -labelArray3 "Points" "Spheres" "sprites" -on1 "ParticleType(3)" -on2 "ParticleType(4)" -on3 "SParticleType(5)"`; radioButtonGrp -numberOfRadioButtons 3 -shareCollection $group1 -label "" -labelArray3 "Blobby(SW)" "Clouds(SW)" "Tubes(SW)" -on1 "ParticleType(7)" -on2 "ParticleType(8)" -on3 "ParticleType(9)"; setParent ..; setParent ..; //Particle Placement///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// frameLayout -label " Random Placement" -width 300; gridLayout -numberOfColumns 2 -cellWidthHeight 200 30; text -label " Max X Position" -align "left"; floatSliderGrp -field true -minValue -1000.0 -maxValue 1000.0 -fieldMinValue -1000.0 -fieldMaxValue 1000.0 -value 100 MaxX; text -label " Min X Position" -align "left"; floatSliderGrp -field true -minValue -1000.0 -maxValue 1000.0 -fieldMinValue -1000.0 -fieldMaxValue 1000.0 -value -100 MinX; text -label " Max Y Position" -align "left"; floatSliderGrp -field true -minValue -1000.0 -maxValue 1000.0 -fieldMinValue -1000.0 -fieldMaxValue 1000.0 -value 100 MaxY; text -label " Min Y Position" -align "left"; floatSliderGrp -field true -minValue -1000.0 -maxValue 1000.0 -fieldMinValue -1000.0 -fieldMaxValue 1000.0 -value -100 MinY; text -label " Max Z Position" -align "left"; floatSliderGrp -field true -minValue -1000.0 -maxValue 1000.0 -fieldMinValue -1000.0 -fieldMaxValue 1000.0 -value 100 MaxZ; text -label " Min Z Position" -align "left"; floatSliderGrp -field true -minValue -1000.0 -maxValue 1000.0 -fieldMinValue -1000.0 -fieldMaxValue 1000.0 -value -100 MinZ; setParent ..; setParent ..; frameLayout -label "Create Particles"; columnLayout; button -label "create" -align "center" -c "PartMake;"; setParent ..; setParent ..; showWindow $window; //proc for particle type assignment/////////////////////////////////////////////////////////////////////////////////////////////////////// proc ParticleType(int $mypart) { global string $type; switch($mypart) { case 3: $type = "3"; print $type; break; case 4: $type = "4"; print $type; break; case 5: $type = "5"; print $type; break; case 7: $type = "7"; print $type; break; case 8: $type = "8"; print $type; break; case 9: $type = "9"; print $type; break; default: break; } } //Global Proc to Create the Particles////////////////////////////////////////////////////////////////////////////////////////////////////// global proc PartMake(){ int $looptimes; string $controler; global string $type, $newname; string $nameshape,$partchange,$name; float $MnX = (`floatSliderGrp -q -v MinX`); float $MxX = (`floatSliderGrp -q -v MaxX`); float $MnY = (`floatSliderGrp -q -v MinY`); float $MxY = (`floatSliderGrp -q -v MaxY`); float $MnZ = (`floatSliderGrp -q -v MinZ`); float $MxZ = (`floatSliderGrp -q -v MaxZ`); $looptimes = (`floatSliderGrp -q -v controler`); int $loop = 1; string $name = (`textField -q -tx $newname`); string $Make = " "; string $What = ("particle"); while ($loop < $looptimes){ int $X = rand ($MnX, $MxX); int $Y = rand ($MnY, $MxY); int $Z = rand ($MnZ, $MxZ); string $Pee = ("-p " + $X + " " + $Y + " " + $Z); $Make = ($Make + " " + $Pee); $loop = $loop + 1; }; $What = ($What + " -n " + $name + " " + $Make); eval $What; $nameshape = ($name + "Shape.particleRenderType"); $partchange = ("setAttr " + $nameshape + " " + $type); eval $partchange; };