[sdk] get current render frame number


#1

I want to know how to get current render frame(not tick) number on c++ SDK.
Because I want to refresh some value at every frame.

When I hook TimeValue t, I get current tick. But it is not “Frame” number.
Then, I do

round(t / GetTicksPerFrame())

I can get frame number in some case. But when I use motion blur and that duration larger than 1 frame, this result is not working.

So, someone know how to get it?


#2

Does anyone know how to get current frame?

“GetCOREInterface()->GetTime()”

is only work for time slider.
Under render range or network rendering can’t get correct time.


#3

don’t really play with the render stuff but my guess is your probably not using “the max way” for these things… you have probably got to use a callback

so in your class declare something like…

static void PreFrameHandler(void* param, NotifyInfo* info);

then it would look something like this…

void MyClass::PreFrameHandler(void* param, NotifyInfo* info)
{
	MyClass* mcls = static_cast<MyClass*>(param); // get your class instance so you can call its functions
	RenderGlobalContext* rgc= reinterpret_cast<RenderGlobalContext*>(info->callParam); // get the global render context

	// do stuff here with

        mcls->DoStuff( rgc->time);

}

then you register somewhere in the contructor or when you want it active with…

RegisterNotification(PreFrameHandler, this, NOTIFY_PRE_RENDERFRAME);

and then unregister in the destructor or when it’s appropriate with…

UnRegisterNotification(PreFrameHandler, this, NOTIFY_PRE_RENDERFRAME);


#4

Klvnk,

It works!! but that timing was just before start rendering. It was too late for my case.

So, I found “NOTIFY_RENDER_PREEVAL” and this notifyinfo::callParam is pointer to TimeValue.
This is more fit for me.

Anyway, thank you very much!