Jump to content

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
Link to comment
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
Link to comment
Share on other sites

  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...