call creation expression in runtime expression?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  05 May 2007
call creation expression in runtime expression?

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.
  05 May 2007
Thread automatically closed

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.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 05:46 PM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.