PDA

View Full Version : pauseCountPP??


lestdog
03-16-2009, 11:45 PM
I was running over some old MEL scripts that I found. While experimenting I found an PP attribute that is called pauseCountPP

Evidently this was an attribute in maya at one time but I can't find it now.. Was it changed to something else?

Here's the script.. which belongs to kolektiv Particles - Visual Effects Series MAYA

// dropP CREATION

// define initial goal position
goalU = parentU;
goalV = parentV;

// make sure goalPP is set to 1 to lock particle to goal position
goalPP = 1;

// define initial target position in V
targetVPP = rand( parentV * (1 - amplitude), parentV * (1 + amplitude) );

// define old target position as initial goalV position
oldTargetVPP = parentV;

// initialize pauseCountPP
pauseCountPP = 0;

// initialize lifespanPP
lifespanPP = 100;
**************************
// trailP CREATION

// drive radius by radiusMultPP, which is driven by a ramp
radiusPP = radius * radiusMultPP;

**************************
// SEED EXPRESSION

// if scene is rewound, set random seed
if (frame == dp.startFrame)
seed(10);
****************************************
// dropP RUNTIME

// simple gravity, replaced below with dripSpeed calculation
//goalU -= 0.1;

// store the last goalU and goalV values
float $oldU = goalU;
float $oldV = goalV;

// store the minMaxU/V values of the surface
float $minU = canGEOShape.minValueU;
float $maxU = canGEOShape.maxValueU;
float $minV = canGEOShape.minValueV;
float $maxV = canGEOShape.maxValueV;

// decrement pauseCountPP if it is greater than 0
if (pauseCountPP > 0) {

pauseCountPP--;

// otherwise, attempt to generate a new pauseCountPP
} else {

////
// generate pauseCountPP

// determine random number between 0 and pauseFrequency
int $rand = ceil( rand (0,pauseFrequency) );

// only reset count if random number hits pauseFrequency
if ($rand == pauseFrequency) {

// determine random integer between pauseMinTime and pauseMaxTime
// and set pauseCountPP
pauseCountPP = rand (pauseMinTime,pauseMaxTime);

}
}

// particle only moves when pauseCountPP = 0
if (pauseCountPP <= 0) {

////
// setting goalU

// move the particles down the can in U
// by a percentage of the min/maxU value
goalU -= (dripSpeed / 100) * ($maxU - $minU);

////
// setting goalV

// the particle has reached its target position
// and a new goal position needs to be set
if (goalV == targetVPP) {

// save old target position
oldTargetVPP = targetVPP;

// determine new target position
targetVPP = rand( goalV * (1 - amplitude), goalV * (1 + amplitude) );

// reset targetWeightVPP
targetWeightVPP = 0;

// if the particle hasn't reached its goal, calculate goalV
} else {

// move particle in between old and new target position
goalV = oldTargetVPP + ( smoothstep(0,1,targetWeightVPP) * (targetVPP - oldTargetVPP) );

// increment frequency
targetWeightVPP += frequency;

} //if goalV = targetVPP

// kill off the particle once it has reached the bottom of the can
if (goalU <= $minU)
lifespanPP = 0;

} // if pauseCountPP <= 0

////
// trail emission

// determine number of trail particles to emit,
// based on distance covered between last and current position
int $trailCount = abs( ((goalU - $oldU) + (goalV - $oldV)) * density);

// initialize emitCmd
string $emitCmd = "emit -object trailP ";

// loop from 0 to trailCount
for ($i = 0; $i < $trailCount; ++$i) {

// calculate offset for trail particle
float $iF = $i;
float $weight = $iF / $trailCount;
float $uValue = $oldU + $weight * (goalU - $oldU);
float $vValue = $oldV + $weight * (goalV - $oldV);

// determine drop's position
vector $pos = position;

// concatenate emitCmd data
$emitCmd += "-position " + $pos.x + " " + $pos.y + " " + $pos.z + " ";
$emitCmd += "-attribute goalU -floatValue " + $uValue + " ";
$emitCmd += "-attribute goalV -floatValue " + $vValue + " ";
$emitCmd += "-attribute lifespanPP -fv " + (lifespan * $weight * (rand( 0.8,1.2 ))) + " ";

} // for ($i = 0; $i < $trailCount; ++$i)

////
// emit

// finally, evaluate emitCmd
if ($trailCount > 0)
eval( $emitCmd );
// trailP CREATION

// drive radius by radiusMultPP, which is driven by a ramp
radiusPP = radius * radiusMultPP;

Cheesestraws
03-16-2009, 11:53 PM
pauseCountPP is a custom per-particle attribute. If you watch the dvd it will explain it all.

lestdog
03-17-2009, 08:55 PM
Got it! Thanks!

CGTalk Moderation
03-17-2009, 08:55 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.