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

Rename Effect Expression Update Bug

Participant ,
Mar 06, 2024 Mar 06, 2024

Copy link to clipboard

Copied

When renaming an Expression Control effect, an expression using the effect as a variable will not update to reflect the name change when the renamed effect is in an if...else statement AND the particular condition that contains the effect is not currently true.
 
For example:
 
1. Create a layer in a comp.
2. Create two Slider effects in the layer ("Slider_1" & "Slider_2").
3. Create a simple expression in Slider_1 that references Slider_2 as a variable, such as:

 

if (0 > 1) {
  n = 333
} else if (1 == 0) {
  n = effect("Slider_2")("Slider");
} else {
  n = 888
}

n

 

If I rename "Slider_2", the expression will not update the slider name.
However, if I change the condition to true instead of false:

 

  } else if (2 > 1) {
  ​  n = effect("Slider_2")("Slider");
  }

 

the slider WILL update the name correctly.
 
Why won't the name update?
Is this a bug?
 
AFX v 24.1.0 - b78
Windows 10
Version 10.0.19045 Build 19045
Bug Won't fix
TOPICS
Expressions

Views

299

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 , Mar 06, 2024 Mar 06, 2024

Hi @thebigwick,

Thank you for reporting this issue. The behavior you've described is due to how After Effects updates expressions after a project item (effect, layer, comp, etc) is renamed—After Effects checks for any expressions that would throw an error after the name change, then updates the references in those erroring expressions. This occurs behind the scenes; any expression errors are not shown in the UI during this process. In the cases you've shown, the control reference is unreachable,

...
Status Won't fix

Votes

Translate

Translate
5 Comments
Community Expert ,
Mar 06, 2024 Mar 06, 2024

Copy link to clipboard

Copied

Good catch. Looks like a bug to me.

Votes

Translate

Translate

Report

Report
Advocate ,
Mar 06, 2024 Mar 06, 2024

Copy link to clipboard

Copied

It's a bit far-fetched.

We don't write expressions like that every day.

 

n = effect("Slider_1")("Slider")
if (NaN === NaN) {
  n = effect("Slider_2")("Slider")
}
n

 

 

 

n = effect("Slider_1")("Slider")
if (!true) {
  n = effect("Slider_2")("Slider")
}
n

 

Votes

Translate

Translate

Report

Report
Adobe Employee ,
Mar 06, 2024 Mar 06, 2024

Copy link to clipboard

Copied

Hi @thebigwick,

Thank you for reporting this issue. The behavior you've described is due to how After Effects updates expressions after a project item (effect, layer, comp, etc) is renamed—After Effects checks for any expressions that would throw an error after the name change, then updates the references in those erroring expressions. This occurs behind the scenes; any expression errors are not shown in the UI during this process. In the cases you've shown, the control reference is unreachable, so the expression does not throw an error when the (unreachable) referenced control is renamed and nothing is updated.

 

The alternative to the current design would be complete parsing of every expression in the project anytime an item that could be referenced by an expression is renamed. This could get extremely slow in even medium-sized projects.

 

The best practice is to declare any expression reference as variables in non-conditional code and use the variable within your conditional statements. Then the references will always be executed and updated when names change.

 

Cheers,

- John, After Effects Engineering Team 

Status Won't fix

Votes

Translate

Translate

Report

Report
Community Expert ,
Mar 06, 2024 Mar 06, 2024

Copy link to clipboard

Copied

Thanks John--good to know. And thanks for the peek under the hood.

Votes

Translate

Translate

Report

Report
Valorous Hero ,
Dec 03, 2024 Dec 03, 2024

Copy link to clipboard

Copied

LATEST

I believe the autoFixExpression scripting method solves this but I found a loophole - I think. Before I dive into the rabbit hole, can you share insights into how/what/when autoFixExpression does its thing? 

Very Advanced After Effects Training | Adaptive & Responsive Toolkits | Intelligent Design Assets (IDAs) | MoGraph Design System DEV

Votes

Translate

Translate

Report

Report