Jump to content

Getting The Current Time/frame And Fps


Recommended Posts

Cheers Daniel! What about fps? I don't see it in this class definition.

oh right, FPS. I know in pops there's:

POP_ContextData*	data = (POP_ContextData*) context.myData;
data->myTimeInc

Not sure about general fps though

Link to comment
Share on other sites

You can get at the global channel manager.

CH_Manager *mgr = OPgetDirector()->getChannelManager()
mgr->getEvaluateTime(); // current evaluation time 
mgr->getSamplesPerSec(); // get FPS
mgr->getGlobalStart(); // get global animation start time
mgr->getGlobalEnd(); // get global animation end time

Link to comment
Share on other sites

Prior to cooking it, call sop->forceRecook(); Or in the SOP's cookMySop() method, call ourFlags().setAlwaysCook(true);

Where I can call forceRecook()? As I understand I have 3 choices: constructor, destructor and cook method?

I've tried ourFlags.setAlwaysCook(true); sop still cooks only in the first frame. Simon's OP_Node::flags().timeDep = 1; works great.

But anyway I still would like to know all solutions so if you have a time edward could you explain in details?

Cheers guys.

Edited by hoknamahn
Link to comment
Share on other sites

The forceRecook() is for dirtying a SOP for cooking whenever the next time its data is obtained. This is more often used for example in a callback function to a button parameter press in order to force the SOP to recook. Note that the SOP in that case won't actually recook until someone asks for its data (eg. the viewer). So if it's not displayed, then the SOP won't actually cook yet (unless of course you call its cook() method explicitly).

Sorry, I was mistaken that the always cook flag would work when changing time. The ourFlags().setTimeDep(true) method works better. This will let the viewer know that the node is time dependent and will ask for the node (if displayed) to cook every frame. This flag should always be set somewhere in the cookMySop() method because it gets cleared prior to cookMySop() is called. After cookMySop() is done, this flag is automatically set if any of the evaluated parameters are time dependent. So this flag is cleared prior to cookMySop() because the parameters may have been changed to no longer be time dependent.

Link to comment
Share on other sites

  • 8 years later...

Sorry for resurrecting an ancient thread, but I have a follow up question to the above.

I'm trying to write a GEO_IOTranslator and I need to get the current frame.  There doesn't seem to be a context available to call getFrame() with.
I've tried CHgetEvalTime() as well, but this always seems to return 0.

Link to comment
Share on other sites

I don't think you can because the GEO_IOTranslator is only given the already cooked geometry. The only workaround I can think of is adding a detail attribute to your geometry with the value of $FF.

Link to comment
Share on other sites

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...