Copy link to clipboard
Copied
I have LOTS of expresssions in my project, and I'm trying to update them to the new Javascript engine using the built-in "Update legacy expressions script".
However, some syntax errors still persists.
Take the following for example:
if (value<1) res=1;
if (value>maxValue) res=maxValue;
If I add "else before the second if, the error resolves (and I understand why).
However, I have thousands of such cases. Is there anyway to automatically fix them?
Thank you
Copy link to clipboard
Copied
I guess theres no straight way to fix this automatically.
Copy link to clipboard
Copied
Is there anyway to automatically fix them?
Nope. The only reason it ever worked in the old engine is mere stepping order and consecutive steps overriding previous ones. Since the new engine evaluates the function as a whole this no longer works, but it is also unable to make any sense of operation precedence of older code if it lacks the proper keywords. I'm afraid you realyl have to tiptoe through each and every one of your expressions and fix them manually.
Mylenium
Copy link to clipboard
Copied
If you really need to get an old expression to work quickly you can just open up the project settings and choose to use the legacy expression engine. That will make the project work in newer versions.
When you get the time you can go through the projects that don't work and take a look at the expressions and manually update them. That is what I am doing with the about 140 custom presets that I have created and linked by an alias to my Effects and Presets panel.
When the new expression engine came out I had more than 270 presets in this folder that I use all the time. About 80% of the ones that I have checked so far did not need any modifications. All of the edited ones and the ones that work have been moved into the JavaScript Presets folder. It's going to take a while to get them all checked, fix the ones that need fixing, and move them into the new folder. Once you have done a few it becomes easier to see and fix the syntax. The good news for me is that most of mine still work. More than 90% of the motion graphics (explainer videos) that I do are completely driven by expression-based animation presets that I have created over the years to automate the process. Just for fun here's one that I use a lot. Put a layer in a comp, set the hero position including scale and rotation, set in and out points and the layer will fly in from the left, bounce to a stop, then fall off the screen all by itself. Dropbox - flyInBounceDropOut.ffx
Copy link to clipboard
Copied
Thanks Rick
I did notice that feature of switching the legacy expressions on/off, but with thousands of errors in my expressions I don't think I'll ever be able to upgrade this project to use the new Javascript
Sounds like you've got a lot of work waiting for you too!
Nice preset you have there, saved it to use it myself as well
Thank you!
Copy link to clipboard
Copied
By the way, that preset did not need an update.
Copy link to clipboard
Copied
You saved my life! Thank you!!!