Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions listing a neighbouring comps layers on a text layer

  • listing a neighbouring comps layers on a text layer

    Posted by Peter O’connell on August 26, 2008 at 12:36 am

    Hello expression enthusiasts. I am working on a text layer expression that gathers info about neighbouring layers. What I want to do is have the text layer list every layer of the comp that it is above (so that I don’t have to open the comp to have a peak what’s in it). The expression work fine as long as the text layer is directly above a comp, but if it is above any other kind of layer I get an error. So I am having trouble building the “If the layer is a comp then… else “The layer below this one is not a comp!”” business
    Here is the code I have so far which works above a comp only.

    //start
    var compBelowName = comp((thisComp.layer(index+1)).name).name
    var compBelow = comp((thisComp.layer(index+1)).name)

    s = “”;
    i = 1;
    while (true){
    try{
    s += comp(compBelowName).layer(i).name;
    }catch (err){
    break;
    }
    i++;
    s += “\\r”;
    }

    s
    //end

    Pete

    roguekeyframe.com

    Peter O’connell replied 17 years, 8 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    August 26, 2008 at 2:04 am

    You were pretty close:

    try{
    compBelow = comp((thisComp.layer(index+1)).name);
    s = “”;
    for (i = 1; i <= compBelow.numLayers; i++){ s += compBelow.layer(i).name + "\\r"; } s }catch (err){ "The layer below this one is not a comp!" } Dan

  • Peter O’connell

    August 26, 2008 at 2:57 am

    Thanks Dan
    Pete

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