PDA

View Full Version : call creation expression in runtime expression?


TechnicallyArtistic
05-11-2007, 02:28 AM
In a particle expression can you call a float you defined in the creation expression in a runtime expression? Or is there some way to port that number out? I need to grab the frame number each particle is created on and then use that number in a equation in a run time expression. If there's another way to do that and say something like float $currentFrame = frame; I'd be happy to hear that too. (note I need an array or something like that which is per a particle which is why I haven't just plugged it into an attribute. I could try plugging it into a user defined scalar pp attribute, but iduno how to make that work.

Anyway, here's what I've got going so far that I needa figure out how to make work. I do need the if statement I think.
The idea behind this script is I'm trying to put a step inbetween ageNormalized out to the array mapper in a curve flow. I want to have more control over the speed of the flow. So the plan is take the current age normalized of the particle when it starts. Since age normalized is just taking the total range of the lifespan and converting that of a range between one and 0, the hope I have here is I can make a slider for my own lifespan. We start with a number for the initial age normalized (might start with a cached particle position) and then take that age and add on 1/my own lifespan * 30 frames a second, so I get the step amount it takes every frame. There I can continually add that on every frame to the initial age normalized I have. That way I can change my speed and it just adjusts the amount it steps every frame.
Otherwise, if I use the default method that's already set up for me, I change the lifespan, it changes the whole ratio for age normalized, and particles can move backwards, which I don't want. Hope that makes some sense to somebody.

Creation Expression:
float $birthFrame = frame;

float $currentAge[] = `getAttr Flow_particleShape.ageNormalized`;


Runtime Expression:
float $timeStep = 1 / (locator1.slider * 30);

float $reroutedAge[];

if (frame == $birthFrame )
$reroutedAge[] = $currentAge[];

$reroutedAge[] += $currentAge[] + $timeStep;


arrayMapper2.arrayMapper2.vCoordPP = $reroutedAge[];


Ok, I just tried making it using userScalarPP attributes I made, and I don't seem to be able to get arrays out of it. Or into it.

CGTalk Moderation
05-11-2007, 02:28 AM
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.