Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Name of FIRST VISIBLE LAYER beneath text layer?

  • Name of FIRST VISIBLE LAYER beneath text layer?

    Posted by Ben G unguren on August 26, 2014 at 2:49 pm

    I’ve been trying to generate some code that names the first visible layer beneath a text layer. I thought I had it:


    for(i=1;i<=thisComp.numLayers;i++){
    if(thisComp.layer(i).inPoint <= time && thisComp.layer(i).outPoint >= time){
    text.sourceText=thisComp.layer(i).name;
    }
    }

    But this returns the BOTTOMMOST layer instead. I feel like I either need a way to stop the counting once it hits the first visible layer, or perhaps there’s a more elegant solution, maybe using “layer.active” but I haven’t been able to find it. Any ideas?

    Ben Unguren
    Motion Graphics & Editing
    http://www.mostlydocumentary.com

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

    This happens because the functionality/content marked as “Vimeo framework” 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.

    Ben G unguren replied 11 years, 8 months ago 3 Members · 4 Replies
  • 4 Replies
  • Ben G unguren

    August 26, 2014 at 4:40 pm

    Clarification: By “bottommost” layer, I mean the bottommost VISIBLE layer. So it’s working, but after it finds the first visible layer, it checks all the layers beneath it. I want it to stop checking at that point!

    Ben Unguren
    Motion Graphics & Editing
    http://www.mostlydocumentary.com

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

    This happens because the functionality/content marked as “Vimeo framework” 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.

  • Kevin Camp

    August 26, 2014 at 5:33 pm

    you are on the right path.

    I think this does what you need

    for(i=1+index;i<=thisComp.numLayers;i++){
    if(thisComp.layer(i).inPoint <= time && thisComp.layer(i).outPoint >= time && thisComp.layer(i).active==true){
    text.sourceText=thisComp.layer(i).name;
    break;
    }
    }

    Kevin Camp
    Art Director
    KCPQ, KZJO & KRCW

  • Dan Ebberts

    August 26, 2014 at 8:36 pm

    I think I’d do it this way, in case there aren’t any active layers below the text layer:


    txt = "";
    for(i=1+index;i<=thisComp.numLayers;i++){
    if(thisComp.layer(i).active){
    txt = thisComp.layer(i).name;
    break;
    }
    }
    txt

    Dan

  • Ben G unguren

    August 27, 2014 at 2:38 pm

    Thanks for the “break”, Kevin & Dan — very very helpful!

    Ben Unguren
    Motion Graphics & Editing
    http://www.mostlydocumentary.com

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

    This happens because the functionality/content marked as “Vimeo framework” 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