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

Hanging Script when Removing Effect (long time issue, known cause)

Explorer ,
Jan 30, 2024 Jan 30, 2024

Copy link to clipboard

Copied

Someone asked me to troubleshoot a custom script I made for them a few years back. From my understanding, it last worked in AE 2020. They moved on to 2023 and now 2024, but each time they run the script, After Effect hangs showing an everlasting load icon. It sounds very much like what has been going on here: https://community.adobe.com/t5/after-effects-discussions/ae-2021-and-2022-freeze-when-using-script/t...

 

After trying out the script line by line, I discovered that it happens when removing a layer effect, for example via: 

comp.selectedLayers[0].effect('Sharpen').remove();

 

The exact code really doesn't matter, whether it's straightforward or via Effects or property. Having .remove() on a layer effect anywhere in the running script or function will make it hang, without exception as far as I could tell. In other situations, like on layers themselves, .remove() doesn't cause the same issue.

 

Interestingly, upon pressing Escape, it does show to have processed all as intended, removing the effect successfully. I haven't been able to tell whether it does so upon and due to the Escape or whether it did so prior.

 

By the looks of it, AE just doesn't know when to stop the process or how to exit the script when there is a .remove() for a layer effect present. Trying to add an exit to the script, for example via a return (false), doesn't solve it.

 

Win 10 and 11, i7 9700k and Ryzen 7 5800x, 16 and 32 GB respectively, iGPU and RTX 3080, so the hardware doesn't seem to matter.

Bug Investigating
TOPICS
Crash , Scripting , Troubleshooting

Views

193

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 Pinned Reply

Adobe Employee , Jan 31, 2024 Jan 31, 2024

Hi @snakehill,

Thank you for isolating and reporting this issue. We can reproduce it as well with the script you provided and we have opened a ticket to investigate potential fixes.

 

Thanks again,

- John, After Effects Engineering Team  

Status Investigating

Votes

Translate

Translate
5 Comments
Community Expert ,
Jan 30, 2024 Jan 30, 2024

Copy link to clipboard

Copied

I'm not seeing anything like that on AE 2024 (on Win 11 though). Using this code, I can remove the Sharpen effect if it's the only effect, or in a group of effects:

var comp = app.project.activeItem;
comp.selectedLayers[0].effect('Sharpen').remove();

Context may matter, so it might help to see more of the script.

 

Votes

Translate

Translate

Report

Report
Explorer ,
Jan 30, 2024 Jan 30, 2024

Copy link to clipboard

Copied

Oof, I was mistaken, it not just being the .remove() but a combination of things. Commenting out all removes opposed to anything else did fix the script in question, hence I thought that must have been it, but correlation does not equal causation.

 

This is one of the combinations that used to work that apparently makes it hang (yet still process correctly upon process Escape), a .remove() in combination with a sampleImage .expression. Commenting out either will make it process:

 

var layer = app.project.activeItem.selectedLayers[0];
layer.Effects.addProperty("Color Control");
layer.Effects.addProperty("ADBE Lumetri");
var color = layer.Effects.property("Color Control")("Color");
color.expression = "thisLayer.sampleImage(transform.position,[0.5,0.5]/2,true,time)";
layer.Effects.property("Lumetri Color").property("White Balance").setValue(color.value);
layer.Effects.property("Color Control").remove();

 

Votes

Translate

Translate

Report

Report
Community Expert ,
Jan 30, 2024 Jan 30, 2024

Copy link to clipboard

Copied

That is interesting. There does appear to be some intereaction (maybe a timing issue) between the sampleImage expression and removing the layer. I could get it working some of the time (but not always) by adding a $.wait(500) before the remove(). Looks like a bug to me.

Votes

Translate

Translate

Report

Report
Explorer ,
Jan 31, 2024 Jan 31, 2024

Copy link to clipboard

Copied

Glad it was reproduced. The strangest thing is that, as far as I'm aware, Esc cancels the script. That would mean it's already done and has removed the layer effect(s), somehow the expression making it think it's still doing something or that it didn't finish, for layer effects only.

 

I had tried $.wait/.sleep, or even removing the expression, but no such luck.

Votes

Translate

Translate

Report

Report
Adobe Employee ,
Jan 31, 2024 Jan 31, 2024

Copy link to clipboard

Copied

LATEST

Hi @snakehill,

Thank you for isolating and reporting this issue. We can reproduce it as well with the script you provided and we have opened a ticket to investigate potential fixes.

 

Thanks again,

- John, After Effects Engineering Team  

Status Investigating

Votes

Translate

Translate

Report

Report