Copy link to clipboard
Copied
Hello,
I am creating an object instance during PF_Cmd_SEQUENCE_SETUP and I want to use reference counting to keep it around during PF_Cmd_SEQUENCE_FLATTEN, PF_Cmd_SEQUENCE_RESETUP and
PF_Cmd_SEQUENCE_SETDOWN.
What I do:
I am not sure how to do ref counting. For example, if I create a new project with a media, associate the plugin to a layer and then close the project, I got these numbers of call (in AE 2024 24.6.1 build 2):
- Setup: 1
- Flatten: 1
- Resetup: 4
- Setdown: 4
This works for sequence_data which is created in Setup, destroyed in Flatten (which creates a flat sequence_data which is kept around), sequence_data (unflat) is then recreated in Resetup. So Setdown is OK to destroy the 4 sequence_data creatd in Resetup.
In my case, I do not want to release my object instance in Flatten. So perhaps, I should release it when ref count goes down to one in Setdown or use PF_Cmd_GET_FLATTENED_SEQUENCE_DATA ?
Copy link to clipboard
Copied
well... it's complicated...
when saving the project while quitting, you might get a flatten call without getting a setdown call after it. in that case, you can of course free all derelict handles on global_setdown, so no biggie.
it's a there's no robust instance identificaiton method, but that's what we have.
Copy link to clipboard
Copied
So I tested using PF_Cmd_GET_FLATTENED_SEQUENCE_DATA and I get:
In this config, I object instance could survive the flatten and could be released when ref count is 0
Copy link to clipboard
Copied
i think the PF_Cmd_GET_FLATTENED_SEQUENCE_DATA applies only to render threads and not the UI thread. play with it some more with previews and project open/close undo/redo/copy/paste/duplicate ect.
for example, duplicate behaves differently than copy/paste.
Copy link to clipboard
Copied
You are right, PF_Cmd_SEQUENCE_FLATTEN is called in some cases.