Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Restore code from effect's saved state into editor on project load #23

Open
gmatters opened this issue Dec 17, 2021 · 1 comment
Open

Comments

@gmatters
Copy link
Contributor

I used tl_Math to write a fragment of code to correct a color issue in a specific piece of footage. Amazing! Quitting AE, then restarting and loading my project, everything was rendered correctly. However, my code in the code editor had been replaced by the default preset. This means I have to re-type my code, and remember what coefficients and thresholds I used.

I worked around this by saving a preset, but I don't want to save a bunch of presets for one-off fixes. Also, IIUC the presets are stored at the system level not in the project, so if I send this project to someone else they won't have the code used to generate the shader.

The saved plugin state should include the code used to compile the shader, so that the plugin state is entirely self-contained and doesn't depend on saving presets to keep track of what the code was.

@gmatters gmatters changed the title Store code in effect's saved state Restore code from effect's saved state into editor on project load Apr 4, 2022
@gmatters
Copy link
Contributor Author

gmatters commented Apr 7, 2022

Although my understanding of the code is still rudimentary, I believe what is happening is a race condition between the plugin code and the existence of the CEP.

When the plugin is loaded it does sendToMathCEP but the the panel doesn't exist yet.
When the panel is created, in onLoaded() it loads the default preset which puts the irrelevant code into the editor.

However I discovered a workaround; after opening the panel via the [setup] button, press the [setup] button a second time so that the plugin does sendToMathCEP again. This causes the correct code from the saved state to finally be loaded into the editor, where it can then be edited and applied and saved in the project again.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant