Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Get visible layer name at a specified time.

Explorer ,
Apr 23, 2021 Apr 23, 2021

I need to get the layer name at in comp in a specified second amount

So, if I wanted to have at 4 seconds, it would return the layer that is showing at 4 seconds.

Any hints?

TOPICS
Expressions
790
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Apr 23, 2021 Apr 23, 2021

You can query the isActive() attribute in expressions and scripts. That's pretty much all you need. You still need to iterate through all layers, though. Given how AE works, there is no way to ensure it would automatically return only one reference even if the layers are stacked neatly.

 

Mylenium

Translate
LEGEND ,
Apr 23, 2021 Apr 23, 2021

You can query the isActive() attribute in expressions and scripts. That's pretty much all you need. You still need to iterate through all layers, though. Given how AE works, there is no way to ensure it would automatically return only one reference even if the layers are stacked neatly.

 

Mylenium

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 23, 2021 Apr 23, 2021
LATEST

That's a little tricky. I think you could do it with 2 text layers that you would put at the top of your layer stack. The first one would be named "Name" and would get this source text expression:

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

You would turn off the visibility eyeball for "Name". Above that (becoming Layer 1) you'd add another text layer with this source text expression:

t = 4;
thisComp.layer("Name").text.sourceText.valueAtTime(t)

This new text layer would display the value of the first text layer at whatever time you specify for vairable "t" (4 in this example). There may be a simpler way, but this should work.

 

 

 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines