Copy link to clipboard
Copied
Hi All,
I'm developing a After Effects plugin using the After Effects SDK. In my plugin, I handle changes to a parameter value by setting the out_data->out_flags variable to include PF_OutFlag_REFRESH_UI and PF_OutFlag_FORCE_RERENDER in the PF_Cmd_USER_CHANGED_PARAM handler. This works correctly when the parameter value is changed within the user interface.
I recently integrated a WebSocket using easywsclient to receive messages from an external application, and I'm handling the messages in a separate thread using tinythread from easywsclient. When I receive a message that requires a parameter value to be updated, I update the parameter value programmatically and call PF_UpdateParamUI() to update the user interface for the affected parameter. However, setting out_data->out_flags in the separate thread doesn't force a render, even when I come back to the main thread.
I'd appreciate any advice on how to force a render when the parameter value is updated in a separate thread. Thank you!
Copy link to clipboard
Copied
what IS that separate thread? generally speaking, changes to the project can only be made from the UI thread (i.e. the main AE thread), so it's unclear to me what other thread you might be speaking of.
all of AE's API is *not* thread safe, except for a few calls that are intended to be called during render time such as the itertion suite. the one exception to the rule is AEGP_CauseIdleRoutinesToBeCalled() (which is safe to call from any thread at any time, but not aquire).
if i understand the situation correctly, i would suggest implementing an idle hook, that AE calls routinely a few times every second (up to 50 times per second sometimes). during that call you can check the websocket for messages, and affect your effect. you can change some invisible param using AEGP_SetStreamValue(), which would force a re-render.