Skip to main content
Inspiring
December 28, 2021
Answered

How to read out time slider position from c++ plugin. Take 2

  • December 28, 2021
  • 1 reply
  • 1760 views

Dear AE fellows,

most of us know that method

in_data ->current_time

 nicely reads out the position of a time slider.

Now the issue. My plugin has  its own win32 window (on top of AE main window) as part of its UI.

A lot of  the functionality of the plugin takes place inside this win32 window.

This win32 window needs the position of the time slider at each moment of the plugin usage. The question is: how can I pass this value to it.

The point is, if I don't change the parameters of my plugin (and I don't), no messages in the EffectMain (like PF_Cmd_RENDER, PF_Cmd_USER_CHANGED_PARAM and so on) are triggered. 

So in_data->current_time never gets updated(!)

Is it at all possible?

 

 

 

 

 

This topic has been closed for replies.
Correct answer shachar carmi

Thanks, for an advice Sachar!

Actually, what I'm trying to implement is the synchronous play of animation in my win32 window and in AE (or Ppro) window. That is needed for the designer preview function.

I sometimes think of  creating a .txt file with the time and update it every 10th of a second and then my win32 window will read the data from the file every 10th of a second and that's it.

Do you think it could be a viable solution? (Here we need to keep in mind that such a synchonization will be switched on by the user just from time to time)


i'd probably go with some shared memory with a mutex instead of a file.

but anyways, idle hook on the plug-in side and a timer on the window side would be the way to go. (imho)

1 reply

Community Expert
December 29, 2021

AEGP_GetItemCurrentTime

Inspiring
December 29, 2021

Thank you, Shachar,

I wrote a simple function:

A_long time_ae(PF_InData * in_data)
{
	AEGP_SuiteHandler suites(in_data->pica_basicP);
	A_Time time;
	AEGP_ItemH myitem;
	suites.ItemSuite8()->AEGP_GetActiveItem(&myitem);
	suites.ItemSuite8()->AEGP_GetItemCurrentTime(myitem, &time);
	return time.value;
}

 However it produces access violation error when hitting  suites.ItemSuite8()->AEGP_GetActiveItem(&myitem); line. Do you know what could be the reason for that?

Community Expert
January 3, 2022

Dear Shachar,

I inserted your code.

It works. At first I was very happy. However, a  strange thing is happening. Whenever I move the slider, the slider time parameter updates only when I release mouse button . 

The same thing happens when I hit play button. The time slider parameter updates only when I hit pause. 

In desperation I actually streamed the result of your IdleHookFunction into a txt file and checked if the value changes when I hit play.

PF_Err IdleHookFunction(AEGP_GlobalRefcon plugin_refconP, AEGP_IdleRefcon refconP, A_long* max_sleepPL) {

	*max_sleepPL = 100;//the max time you'd like before the next idle call, in ms.
	MyIdleHookData* idleData = (MyIdleHookData*)refconP;
	AEGP_SuiteHandler suites(idleData->pica_basicP);

	A_Time time;
	AEGP_ItemH myitem;
	suites.ItemSuite8()->AEGP_GetActiveItem(&myitem);
	suites.ItemSuite8()->AEGP_GetItemCurrentTime(myitem, &time);
	A_long time0 = time.value;
        printToFile(time0);

	return PF_Err_NONE;
}

 

It doesn't (despite the file itself being updated many times a second). Only after I release the time slider from the mouse does the vslue updates. Do I do something wrong?

 

The way I feed data into my win32 window:

I store the result of IdleHookFunction as a global variable which then is fed into win32 callback function. 

 

 

 

 

 


i checked on my end as well, and i see the same behavior. i also tried using javascript's "app.project.activeItem.time" but it also updates only on  mouse up.

i currently can't think of  way to get the comp's time that might update during a drag over a cached area.