ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

reference to layer lost in expression after name change from script

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Floris Drupsteen
reference to layer lost in expression after name change from script
on Oct 24, 2019 at 10:12:53 pm

Hi all,
I'm using a script to rename many layers.
Some of them are targeted by scripts/expressions in other layers in the same comp.

When I change layer names by hand, After Effects will automatically adjust the references to that layer in all expressions.

Can I use the method that After effects uses.. and somehow call it from my script to execute?

And if not.. How can I access all expressions in a layer so I can change the name myself in those expressions?

Really hope someone knows.

thanks

Floris


Return to posts index

Dan Ebberts
Re: reference to layer lost in expression after name change from script
on Oct 24, 2019 at 10:31:08 pm

You could try something like this:

var myLayer = app.project.activeItem.layer(1);
var oldName = myLayer.name;
var newName = "New Name";
myLayer.name = newName;
app.project.autoFixExpressions(oldName, newName);


I'm not autoFixExpressions() works in all cases, but that's what it's intended usage is.

Dan



Return to posts index

Floris Drupsteen
Re: reference to layer lost in expression after name change from script
on Oct 24, 2019 at 10:51:04 pm

Amazing. How do you know all this?

Those are just other words for saying, yes it works!
Thank you very much.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 CreativeCOW.net All Rights Reserved
[TOP]