Skip to main content
Inspiring
July 20, 2017
Question

Setting a stream value on the correct thread.

  • July 20, 2017
  • 1 reply
  • 1061 views

Hi. I have read that > version 13.5 AEGP_SetStreamValue should only be set on a UI thread as opposed to a render thread, otherwise it will give an error.

From the documentation, these selectors are on the UI thread:

PF_Cmd_SEQUENCE_SETUP, PF_Cmd_USER_CHANGED_PARAM, PF_Cmd_DO_DIALOG, and PF_EVENT_DRAW.

My problem is I want to set a stream value automatically every frame, and I don't believe any of the UI selectors are valid for this purpose (for example a param has to be changed for USER_CHANGED_PARAM to trigger. I need it to happen every frame regardless of user input.) Is there any way I can set a stream value every frame? Thanks.

This topic has been closed for replies.

1 reply

françois leroy
Inspiring
July 24, 2017

Hi James,

I had one plugin working this way, and I had to re-write it all... with a lot of workarounds to avoid this issue.

Also, keep in mind that setting a stream's value invalidates the previously rendered frames...

What kind of stream do you need to set? And for what purpose?

Cheers,

François

Inspiring
July 24, 2017

Hi Francois

I want to create an easing plugin that outputs the eased values on a float slider. That can then be tied to the layer's transform controls (such as position). What was your plugin that worked this way and did you find any reasonable solution?

françois leroy
Inspiring
July 24, 2017

I see...

My plugin is BAO Mask Avenger 2 - aescripts + aeplugins - aescripts.com

The first version was modifying the mask at render time (a maskShape is a stream too).

But since CC 2015, I had to do it another way.

So the plugin is not 'dynamic' anymore, meaning it doesn't modify the stream at render time. But of course it is still updated when something changes.

Instead, it 'bakes' the mask in the work area. With the help of Shachar, I could make it 'kind of dynamic':

when the maskshape needs to be updated, all the keyframes are deleted and baked again. The deleting/baking occurs during ParamChange call of course (baking current time only, for speed reasons), but also at Idle time (it allows updating the mask even if it is modified by an expression that doesn't trigger paramchange... and bakes the remaining keyframes after ParamChange)

If you want details, you can check these threads:

Re: Deleting all keyframes

Re: PF_ABORT and PF_Cmd_USER_CHANGED_PARAM

Hope this helps!

François