Copy link to clipboard
Copied
Hi there,
I believe I have found a bug in Premiere. In our plugin, we store a part of sequence data on the heap and have a pointer to it in sequence data. We implement FLATTEN commands to save this to disk, which works great in AE.
However, in Premiere, the FLATTEN command is never sent, unless during the session the user has clicked on the UI (CUI or a button). If not, then when the project is saved and closed, instead of giving us a flatten command, Premiere saves the unflat sequence data to disk as if it didn't need flattening. Then, when we re-open the project and it calls SEQUENCE_RESETUP, the stuff that was on the heap is now junk data, and reading from it sometimes gives a bad access error (which crashes Premiere).
This really seems like a bug to me, but maybe I'm doing something wrong. I set
PF_OutFlag_SEQUENCE_DATA_NEEDS_FLATTENING,
PF_OutFlag2_PPRO_DO_NOT_CLONE_SEQUENCE_DATA_FOR_RENDER, and
PF_OutFlag2_SUPPORTS_GET_FLATTENED_SEQUENCE_DATA
in GlobalSetup.
To reiterate- we do get a flatten command (GetFlattenedSequenceData) if we have clicked on the plugin's UI during the session. Then it flattens fine and works great. The only problem is when we don't click on the plugin's UI during the session - in that case, any data we had stored on the heap is lost/not saved to the project file.
Also, removing PF_OutFlag2_SUPPORTS_GET_FLATTENED_SEQUENCE_DATA alone or removing it and PF_OutFlag2_PPRO_DO_NOT_CLONE_SEQUENCE_DATA_FOR_RENDER (which we need anyway since we have a really slow Resetup) didn’t make a difference.
Also, it's not just this plugin- I could recreate this with the 2023 SDK's HistoGrid example - again, in Premiere, we only get a FLATTEN command if the user has clicked on the UI since the last save, while in AE we get a FLATTEN command every time we save the project.
Any help would be greatly appreciated.
Thanks!
Jonah
Copy link to clipboard
Copied
I asked the adobe dev team. either they'll chime in back here, or i'll let you know what they said.
Copy link to clipboard
Copied
>...the FLATTEN command is never sent, unless during the session the user has clicked on the UI (CUI or a button).
What do you do to your sequence data, while responding to UI clicks?
Copy link to clipboard
Copied
We do nothing to sequence data when responding to UI clicks. We do modify sequence data in SEQUENCE_RESETUP and EVENT->DRAW, but neither of those things trigger Premiere to treat sequence data as if it needs flattening on save.
So to me it seems Premiere is not monitoring whether we modified sequence data during the session, it's simply looking at "did the user click on the UI this session?" and if not, treat the sequence data as if it doesn't need flattening. Again, this is reproducible with the AE SDK example HistoGrid (which uses pointers in seqData/flattening and unflattening), it's not just our plugin.
Copy link to clipboard
Copied
I'm looking at HistoGrid; it doesn't do a lot of flattening.
static PF_Err
SequenceFlatten(
PF_InData *in_data,
PF_OutData *out_data,
PF_ParamDef *params[],
PF_LayerDef *output)
{
PF_Err err = A_Err_NONE;
if (in_data->sequence_data)
{
out_data->sequence_data = in_data->sequence_data;
}
return err;
}
I also see that, for all draw or click events, HistoGrid unflattens its sequence data:
static PF_Err
HandleEvent(
PF_InData *in_data,
PF_OutData *out_data,
PF_ParamDef *params[],
PF_LayerDef *output,
PF_EventExtra *extra)
{
PF_Err err = PF_Err_NONE;
AEGP_SuiteHandler suites(in_data->pica_basicP);
if (in_data->sequence_data == NULL &&
(extra->e_type == PF_Event_DO_CLICK ||
extra->e_type == PF_Event_DRAW)) {
err = SequenceResetup(in_data, out_data, params);
//...
}
Does your plugin 'inflate' its sequence data, in response to (both draw and click) event calls?
Copy link to clipboard
Copied
Yes, you're right that HistoGrid doesn't actually flatten/inflate anything. Our plugin does - it stores a big (~500kB) array on the heap with a pointer to it in seqData, and flattens/unflattens it in response to the appropriate commands. This works exactly as it should in AE.
To reproduce with HistoGrid, if you set PF_OutFlag_SEQUENCE_DATA_NEEDS_FLATTENING andPF_OutFlag2_SUPPORTS_GET_FLATTENED_SEQUENCE_DATA, you'll notice that Premiere doesn't send Flatten commands when saving an (existing) project containing it until you click on the UI. I couldn't find an example in the AE SDK that actually flattens seqData and also works in Premiere, so this seems like the easiest way to reproduce it. I'll put the steps here to make sure we're doing the same thing:
If you do the same thing in AE, you get a FLATTEN command (which causes a crash because it's not really implemented, but that's irrelevant here) every time you save the project, no matter if you clicked on the CUI or not.
Also, with regards to HistoGrid calling SequenceResetup in HandlEvent(), I'm not sure what the purpose of that is, since the host directly sends RESETUP commands. Our plugin doesn't have that. But since it's only when sequence_data==NULL, I'm assuming it never gets hit anyway (or at most once). Maybe it's for the edge case where case you get a DRAW command before a RESETUP command and you need sequence_data to be Resetup before drawing.