Jump to content
Sign in to follow this  

Set attribute based on current Frame and hold value

Recommended Posts

Simple problem, cannot find the solution.

I need to set an attribute based on the current frame, something like this:

if(@Cd.r >= 0.9){

   f@t = @Frame;


...and I need @t to hold that value, and not change along with the current frames.

Why I need this:  I'm trying to control the offset of animated redshift instances by starting the animation once @Cd.r passes a certain threshold.  Once the animation starts, the counter for that specific instanced object needs to start at 0, and increase along with the time slider, like so:

@f = @Frame - @t;

string frameNumber = sprintf("%g%", @f);

s@instancefile = concat("$HIP/filepath.", framenumber, ".rs");


Any idea on how to do this?

Edited by benttoenail

Share this post

Link to post
Share on other sites

What I have done before is to pre-generate the start and end frame, then only generate a valid s@instancefile, when I am within that frame range. Use a null based geo file to reference in all other cases.

if((@Frame>@start) && (@Frame<@end)){
    int current_frame = @Frame-@start;                                
    s@instancefile = sprintf("myfile_%02d.rs",current_frame);
} else {
    s@instancefile = "my_blank.rs";


Edited by Atom

Share this post

Link to post
Share on other sites

Hey did you manage to get a system working for this? I am trying out the two suggestions above. 

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this