Skip to main content
Known Participant
March 6, 2024

Rename Effect Expression Update Bug

  • March 6, 2024
  • 5 replies
  • 634 views
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
This topic has been closed for replies.

5 replies

Roland Kahlenberg
Brainiac
December 3, 2024

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
Dan Ebberts
Adobe Expert
March 6, 2024

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

JohnColombo17100380
Community Manager
Community Manager
March 6, 2024

Hi @Fizzrock,

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 

Brainiac
March 6, 2024

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

 

Dan Ebberts
Adobe Expert
March 6, 2024

Good catch. Looks like a bug to me.