Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects AE Expressions: Refercing a code block

  • AE Expressions: Refercing a code block

    Posted by Sven Flesch on January 3, 2012 at 6:52 pm

    I have a block of code that needs to run in multiple layers. So far I’m copy and pasting. That’s bad enough. However, when I change the code I need to go through all the layers and make the change or re-paste it. A better solution would be to reference the entire block of code from a single location or an extra layer that just contains the code. Is that possible in AE?

    Roland R. kahlenberg replied 14 years, 7 months ago 3 Members · 2 Replies
  • 2 Replies
  • Dan Fredley

    January 4, 2012 at 1:32 am

    You can store basic expressions in layer names and use eval() in the actual layer. For example name a layer with this:

    x=Math.PI; y=2; z=thisLayer.width

    Then create a text layer and put this as the expression in the “source text”:


    myLayer = thisComp.layer("x=Math.PI; y=2; z=thisLayer.width");
    eval(myLayer.name);
    x*y+z

    Unfortunately, I don’t think it goes beyond numbers and simple expressions. You can only use “thisLayer” as well–no referencing other layers. Plus layer names don’t update as well as you’d like when you change the expression.

    Another option is to use scripts:
    Zorro the Layer Tagger combined with Expression Toolbox from aescripts.com

    Dan Fredley

  • Roland R. kahlenberg

    January 4, 2012 at 1:37 am

    Re-pasting isn’t as difficult if you first select the source property and choose Edit>Copy Expression Only. Then simply select the target layers and CTRL+V, to paste the Expression.

    You can group layers in the Timeline, using the similar colors for each layer’s Layer Color Tab. Then right-click on the color tab of one of the layers and select, Select Label Group.

    HTH
    RoRK

    Intensive AE & Mocha Training in Singapore and Malaysia
    Adobe ACE/ACI (version 7) & Imagineer Systems Inc Approved Mocha Trainer

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