Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Expression not allowing me to substitute a layer name for a layer pop-up variable

  • Expression not allowing me to substitute a layer name for a layer pop-up variable

    Posted by Paul Roper on September 12, 2016 at 9:17 am

    Hello,
    I have been given a project to work on which contains a comp using the Easy Arrows script (https://aescripts.com/easy-arrows/). One of the expressions references another layer directly. The cromulent line is this:
    mask = thisComp.layer("Path 1 Expression - Do Not Edit 1")("ADBE Transform Group")("ADBE Position").valueAtTime(newTime);
    …but I want to duplicate the arrows, so need to tell each separate arrow to reference a different layer, so I added a layer expression control, and added the follwing to the expression (and set the Layer pop-up to that same “Path 1 Expression – Do Not Edit 1” layer):
    pathLayer=effect("PathLayer")("Layer");
    ...
    mask = thisComp.layer(pathLayer)("ADBE Transform Group")("ADBE Position").valueAtTime(newTime);

    But I get an error.

    Surely these two methods amount to the same thing? I’ve tried adding .value to the end of the pathLayer variable definition line, but it made no difference. Any suggestions as to what’s going on would be greatly appreciated! For speed’s sake, for now I’ll probably just pre-comp each group of arrow layers and edit those, but I don’t like having this unsolved problem!

    (I know the “correct” answer to this problem should be “buy the script from Aescripts!” but I only intend to ever use it to fix this one and only comp).

    Here’s the complete expression, WITH my additions:
    pathLayer=effect("PathLayer")("Layer");
    totalDistance = 779.74613409518;
    beginAddedDistance = 0;
    endAddedDistance = 0;
    maskClosed = 0;

    easyArrowComplete = effect("Easy Arrow Completion")("ADBE Slider Control-0001");

    if (easyArrowComplete < 0) easyArrowComplete = 0;
    else if (easyArrowComplete > 100) easyArrowComplete = 100;
    if (maskClosed == 1)
    easyArrowComplete *= 0.33333333333333;
    newTime = easyArrowComplete/100;

    if (maskClosed == 1)
    newTime += 0.33333333333333;
    totalAddedDistance = beginAddedDistance + endAddedDistance;
    newTime = newTime*(1-totalAddedDistance/totalDistance)+(beginAddedDistance/totalDistance);
    mask = thisComp.layer(pathLayer)("ADBE Transform Group")("ADBE Position").valueAtTime(newTime);

    xPos = mask[0] + thisComp.layer(index)("ADBE Transform Group")("ADBE Position")[0];
    yPos = mask[1] + thisComp.layer(index)("ADBE Transform Group")("ADBE Position")[1];
    [xPos,yPos]

    motion graphics | VFX | web design | etc.
    https://paulroper.com/

    Paul Roper replied 9 years, 8 months ago 2 Members · 2 Replies
  • 2 Replies
  • Xavier Gomez

    September 12, 2016 at 11:20 am

    Try replace thisComp.layer(pathLayer) by simply: pathLayer

    Not sure it will be compatible with the script’s expression, but it should at least fix the error.

    Xavier

  • Paul Roper

    September 12, 2016 at 12:15 pm

    Yep, that totally fixed it! Thanks Xavier!

    motion graphics | VFX | web design | etc.
    https://paulroper.com/

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