Copy link to clipboard
Copied
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?
1 Correct answer
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
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.

