How do I listen for effect deactivation / deletion

New Here ,
Aug 29, 2022 Aug 29, 2022

Copy link to clipboard

Copied

Hi all,

I'm new to the SDK and i've been playing around with it;

I'm allocating memory for a displacement map, an array of pixels, and I want to free that memory when my effect is either deactivated or deleted. How do I listen for that deactivation / deletion? Any help is much appreciated.

TOPICS
SDK

Views

50

Likes

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
Engaged ,
Aug 29, 2022 Aug 29, 2022

Copy link to clipboard

Copied

Hi no258

Usually you will allocate and free the memory per frame rendered. If you are caching resources, you can store them in global data and clean them up on global setdown, the deprecated sample GLator demonstrates this. The advantage/disadvantage of this depending on your case is that all instances of your plugin share this pool. Alternatively you can cache resources in sequence data which is unique per instance of your plugin and you can clean it on a sequence setdown call which AE calls at it's will. 

Likes

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 ,
Aug 29, 2022 Aug 29, 2022

Copy link to clipboard

Copied

LATEST

i agree with james. best strategy is to allocate during rendering and freeing when the frame's render is done. if you must cache intermediates, sequence data is the place to put them.

as for listening to deletion/deactivation, i would advise agaist that. there's no deterministic way of telling. for example, an effect might be "cut", in which case you don't know yet if it will be "pasted" or discarded. the user might also undo a delete operation. that's why james' advise of deleting on "sequence setdown" is in my opinion the best practice, as AE does so only when an effect instance is truely purged.

Likes

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

Make your promotional social content with Adobe Express.

Get started quickly with free templates: