• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

sequence_data life cycle

Explorer ,
Sep 17, 2024 Sep 17, 2024

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:

  • Setup: creates the object instance and associates an UUID to it and sequence_data stores object instance pointer + UUID.
  • Flatten: creates a flat representation of sequence_data (used for serialization). In my case, I put the UUID of my object in the flat data.
  • Resetup: get back a pointer to the object from UUID or create one if not found (when loading from a file)
  • Setdown: release the object if ref count goes down to 0.

 

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 ?

TOPICS
SDK

Views

75

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 17, 2024 Sep 17, 2024

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 17, 2024 Sep 17, 2024

Copy link to clipboard

Copied

So I tested using PF_Cmd_GET_FLATTENED_SEQUENCE_DATA and I get:

  • Setup: 1
  • GetFlattened: 1
  • Resetup: 5
  • Setdown: 6

 

In this config, I object instance could survive the flatten and could be released when ref count is 0

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 17, 2024 Sep 17, 2024

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 17, 2024 Sep 17, 2024

Copy link to clipboard

Copied

LATEST

You are right, PF_Cmd_SEQUENCE_FLATTEN is called in some cases.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines