Activity › Forums › Adobe After Effects Expressions › Display the name of the next visible layer below
-
Display the name of the next visible layer below
Robert Anderson replied 7 years, 8 months ago 4 Members · 12 Replies
-
Mike Foran
May 10, 2017 at 5:25 pmI presume the “hasVideo” and “active” return a 1 if True, and Opacity anything over 0 would be visible, so if all three of those attributes are 0 then it sets the string to the name of the layer. Otherwise it remains blank, as set in the opening line, and checks the next layer.
-
Robert Anderson
October 3, 2018 at 12:22 amyou really only need the below code to get what you want quickly and simply
Index is the layer number
Add one for next layer number
refer to that layer with “thisComp.layer()”
and the .name prefix will return the nameEverything else just makes the code scaleable so that you can redeploy if in other projects.
But if its just the next layer you want, one time thing, just use the simple code.To reply to the above your maths is right, and logic is right.
But the result is the other way around from what you have. If all are 0 then there is nothing visible and it will continue through the loop to find the first visible instance.i=thisLayer.index+1;
n=thisComp.layer(i).name;
Reply to this Discussion! Login or Sign Up