Setting a stream value on the correct thread.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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: PF_ABORT and PF_Cmd_USER_CHANGED_PARAM
Hope this helps!
François
Copy link to clipboard
Copied
Thanks Francois. I had a play with your plugin, it's quite impressive. Can I ask why it generates keyframes for the first one second in the timeline?
Copy link to clipboard
Copied
The plugin doesn't render any images, so I had to find an alternative to watermark for the demo version...
So it only bakes one second. But full version bakes the full work area.
Cheers,
François
Copy link to clipboard
Copied
Ah I see. That's a creative idea, though I imagine it gets pretty heavy if the work area is a long duration? Baking every time the user makes a change could be a workaround for me.
Copy link to clipboard
Copied
Baking can be long, but may be not as much as you expect (I was surprised too!)
The best solution I found is to actually keyframe only current time when the user's doing something (so it's lightning fast), then bake 'in the background' at idle time, one portion of the workarea after the other.
This way, if the user modifies something while baking is still occuring, I can cancel keyframing and update.
But in your case, if you only modify a float slider, I guess it'll be super fast anyway and you won't have to deal with delayed baking...
One more thing: if you delete the keyframes (not sure you need to...) if you follow the normal way, it'll be super long (no idea why, by the way) but if you use the workaround described in the thread above, it's almost instant.
Cheers,
François

