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

Disable my effect if already added to layer

Participant ,
Apr 27, 2023 Apr 27, 2023

Copy link to clipboard

Copied

I'm developing a plugin in AfterEffects sdk and I want that a user can add only one effect per layer. Not actually one effect per layer, but just one effect that I am working on. I mean if the user has other effects added, there is no issue but if my effect is added once in a layer, it should be disabled the next time from the effect menu. 
One way I can think of is to get all effects in layer, check if any of them is my effect, disable it in the effect menu. However I don't know how to disable my own effect. 
Or is there some other direct solution or outflag that I can set so that the effect can be added just once per layer?
Also I don't know how can we uniquely identify an effect. If that is possible, I might not have to disable the effect. For example, we can uniquely identify layers with their AEGP_LayerIDVal, I don't find a way to uniquely identify an effect (if the type of effect is same).



TOPICS
How to , SDK

Views

456

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

correct answers 1 Correct answer

Community Expert , Apr 27, 2023 Apr 27, 2023

perhaps you can remove your effect from the list using AEGP_DisableCommand, HOWEVER:

the user might duplicate or copy/paste you effect.

you can identify your effect by running through the installed effects during global setup, and storing your effect's AEGP_InstalledEffectKey by using AEGP_GetNumInstalledEffects, AEGP_GetNextInstalledEffect and AEGP_GetEffectMatchName.
then during UPDATE_PARAMS_UI (which is guaranteed to be called at some point after applying it to a layer is you have set the cor

...

Votes

Translate

Translate
LEGEND ,
Apr 27, 2023 Apr 27, 2023

Copy link to clipboard

Copied

You cannot disable effects in the menus and palettes. AE auto-determines this stuff contextually  on selection states of layers and such and you have no access to these parts of the API. The effects instances and their property streams are enumerated internally, but I don't think you have access to any of that, either. That being the case perhaps you should implement some extra property that you set to a specific value you can check or rename the effect when applied. that wouldn't prevent users from renaming it otherwise, though.

 

Mylenium

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 ,
Apr 27, 2023 Apr 27, 2023

Copy link to clipboard

Copied

perhaps you can remove your effect from the list using AEGP_DisableCommand, HOWEVER:

the user might duplicate or copy/paste you effect.

you can identify your effect by running through the installed effects during global setup, and storing your effect's AEGP_InstalledEffectKey by using AEGP_GetNumInstalledEffects, AEGP_GetNextInstalledEffect and AEGP_GetEffectMatchName.
then during UPDATE_PARAMS_UI (which is guaranteed to be called at some point after applying it to a layer is you have set the corresponding global setup flag), you can scan the effet's layer and check each effect's install key using AEGP_GetInstalledKeyFromLayerEffect.
now you know if 2 or more instances exist on the same layer. you can choose to alert the user, delete or turn off the redundant, or just skip the redundant's render process copying the input to the output.  

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
Participant ,
Apr 27, 2023 Apr 27, 2023

Copy link to clipboard

Copied

Well thanks a lot. However what I was doing was creating a unique effectId and storing in sequence data, which gave me some issues later.

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
Participant ,
Apr 27, 2023 Apr 27, 2023

Copy link to clipboard

Copied

LATEST

And then this sequencedata was not the same in PF_Cmd_Render.

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