Dear AE fellows,
I have some problem with passing sequence_data between functions serving different calls.
I start with supervisor example plugin. I added additional integer field into my sequence data structure:
with default value 0:
SequenceSetup (PF_InData *in_data, PF_OutData *out_data, int init_num = 0)
And then I set it in my UpdateParameterUI function:
my_sequence_dataP seqP = reinterpret_cast<my_sequence_dataP>(DH(out_data->sequence_data)); seqP->test_int = 57;
After AE effects leaves UpdateParameterUI it calls SequenceResetup.
However, when I check the contents of in_data-sequence_data entering SequenceResetup
PF_Handle flatSequenceDataH = in_data->sequence_data; flatSequenceData* flatSequenceDataP = static_cast<flatSequenceData*>(DH(flatSequenceDataH));
I see that flatSequenceDataP->test_int is not updated and is equal to its default value (i.e. 0).
How could that be? What do I miss here?
probably the resetup call is happening on the render thread. to update the sequence data of the render thread from changes made in the ui thread you need to set the FORCE_RERENDER out flag. this is valid only during certain commands, and i think UpdateParameterUI is indeed one of them.
the point is, this flag out_data->out_flags |= PF_OutFlag_FORCE_RERENDER;
is already present in UpdateParameterUI function.(!)
P.S. I did notice that when I modify my seq_data inside my PF_Cmd_USER_CHANGED_PARAM function, the seq_data does get updated.
from the docs:
"FORCE_RERENDER works when set during PF_Cmd_USER_CHANGED_PARAM. It also works in CLICK and DRAG events, but only if PF_Cmd_GET_FLATTENED_SEQUENCE_DATA is implemented. This is required to prevent flattening and loss of UI state in the middle of mouse operations. Without GET_FLATTENED, the new FORCE_RERENDER behavior will NOT be turned on."
no UpdateParameterUI for you!!
Thank you, Shachar!
I found a way to circumvent this complication.