Skip to main content
skvifi
Participating Frequently
July 16, 2024

Evaluating property expressions consistently not working from scripting

  • July 16, 2024
  • 6 replies
  • 997 views

[NOTE: I have tried to upload repro .zip, but it system didn't allow me to do so, so I have uploaded it as .pptx (this forum does not allow uploading of .zip / .aep / .jsx / ...). To repro the issue please download repro.pptx attachment and then rename it to repro.zip]

 

Hi, I have an issue to report, related to the expression evaluation from scripting. If you are to open project, to add expression and to read its value inside of the same script, results might be invalid (they are reproducibly invalid for sampleImage at least). If you were to open project inside of the script, then finish the script, then add expression and read its value inside of another script everything would work as expected.

 

I have much more complicated examples, but attached is the minimal repro - I'm using sample image to detect whether image has any transparency (it does not). script1.jsx, which does everything inside a single script, returns that image is transparent, which is wrong. script2.jsx which opens project in script, and then schedules everything else in another script returns image is not transparent, which is correct. You could invoke these scripts from the console and look for the result in the console, something like the attached screenshot.

 

Again, I have much more complicated examples, this is the minimal repro of the problem. You can imagine all the problems that this can cause, mainly code based, as app.schelduleTasks() needs to be used and everything needs to be written in callbacks, and callbacks cause hell.... And in general, that is not correct behavior and you should jump through loops to find this kind of workaround.

 

PS. Even worse, if in script1 I render the comp with the footage and the text, text is correctly rendered out as false, even though its value is true in scripting both before and after the render. So, in the same script:
  1. I prepare everything and get the text layer value - it is true
  2. I render it out - in the render it is false (attached)
  3. After the render I get the text layer value - it is still true
This topic has been closed for replies.

6 replies

skvifi
skvifiAuthor
Participating Frequently
September 6, 2024

Any update?

Theresa Rostek
Community Manager
Community Manager
August 6, 2024

Thanks for the info! We'll take a look and see if we can reproduce. Thanks for bringing it to our attention!

Motion Graphics, Premiere Pro
skvifi
skvifiAuthor
Participating Frequently
August 6, 2024

Hi Theresa!

 

It's reproducing both on AE 24.5.0 (Build 52) and AE beta 24.6.0 (Build 59). As far as I know this bug exists for a long time, I had this issue before, I think I first met this behavior ~3 years ago.

 

Windows (11 Pro) version is 10.0.22621 Build 22621

Theresa Rostek
Community Manager
Community Manager
August 5, 2024

Hi @skvifi,

 

Thanks for the detailed report! Could you let me know what build of After Effects and Windows you are using?

 

Thanks!
Theresa 

Motion Graphics, Premiere Pro
skvifi
skvifiAuthor
Participating Frequently
July 17, 2024

PPPS. Another thing to add is that this expression is evaluated correctly if you sleep for a few seconds. However, I have expressions where sleeping does not help at all, they are always invalid until evaluated in another script (those are more complicating so I didn't want to include them in this minimal repro).

skvifi
skvifiAuthor
Participating Frequently
July 17, 2024

PPS. Forgot to mention, tried to invoke 'Convert Expression to Keyframes', it sets invalid values at keyframes as well. For reference, this is the change at the end of script1.jsx that shows it off:

 

comp.openInViewer();
textLayer.sourceText.selected = true;
app.executeCommand(2639);
writeConsole("is transparent: " + textLayer.sourceText.keyValue(1).text);