Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Building Expressions Workflow: multiple layers referencing single code?

  • Building Expressions Workflow: multiple layers referencing single code?

    Posted by Brian Nishii on April 1, 2019 at 7:44 pm

    Hello all you smart people!

    Here’s a workflow question:

    I’m building a comp with a 100 layers that contains expressions on various parameters that uses layer index to drive stuff. So far so good and more to build. Great.

    I love that you can use a text layer to debug your expression as you build them. Great.

    When I build new code for any given parameter for each of those 100 layers, every time I make an adjustment, I have to delete all my layers, change the code for that parameter, and re-duplicate 99 times. Not the end of the world, I know, but it’s kinda getting old…

    Now I’m curious if there’s a way to place expression code for a specific parameter somewhere that can act as a container that multiple layers can read from? That way, when I futz with the expression for that one parameter, all the layers could update automatically?

    Call me lazy, but wouldn’t it be nice?

    Oh wait – I may just have answered my question. Using Layer Control somehow…

    Andrei Popa replied 7 years, 1 month ago 4 Members · 4 Replies
  • 4 Replies
  • Vera Steinbeck

    April 1, 2019 at 9:45 pm

    hey brian
    if you can’t work with layer control, i tend to copy&paste every time as well..
    if you ctrl-select all your propertys on your layer with expressions and then right click to them you can choose “copy only expressions” (may be named differently since my AE is in german).
    then you ctrl-select every layer you want the expressions on and paste them..

    you just have to write the expressions as open as possible, that you don’t have to go inside each layer and correct numbers each time..

  • Oleg Pirogov

    April 1, 2019 at 11:04 pm

    You may also look into eval() function, which allows you to interpret a string (say, sourceText of a text layer) as a code, so you can keep your code in a text layer an use it for each of 100 layers.

  • Brian Nishii

    April 2, 2019 at 4:18 am

    Well, I’ll be darned!!

    eval() seems to work, if you reference a text layer’s actual text field, and not the Source Text, per this post answer by Dan the Great here. Kinda wonky you have to deal with formatting to actually see the code, but I guess you can cut and paste from a text document as you work.

    Of course, as Vera pointed out, copying just the expression of the parameter and pasting works easily enough without having to trash and re-duplicate all 100 layers.

    Thank you all!

  • Andrei Popa

    April 3, 2019 at 10:20 am

    Eval thing goes even beyond. You can even use evalfile() to get an expression from a text layer. I don’t use very complicated expressions, but for those who do, a nice text editor like Atom, Sublime etc. in which to write your expressions could be of use. Here’s a link to an youtube tutorial about this thing https://www.youtube.com/watch?v=NXkKGd-6T5s

    My point is, you can paste the eval expression to all the layers and then use the external file to modify it for all at once.

    Andrei
    My Envato portfolio.

    Some contents or functionalities here are not available due to your cookie preferences!

    This happens because the functionality/content marked as “Google Youtube” uses cookies that you choosed to keep disabled. In order to view this content or use this functionality, please enable cookies: click here to open your cookie preferences.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy