Forums › Adobe After Effects Expressions › scripting question: how to test layers for their types
-
scripting question: how to test layers for their types
-
Nicholas White
April 12, 2005 at 4:39 amHello,
I’m writing a script to go through a ton of layers, I want to add expressions to different types of layers. The first part of the script goes to layer ‘i’ and tests to see if it is light layer. I want to write something like this:
var activeLayer = selectedComp.layer(i);
if(activeLayer instanceof LightItem;
do somethingHowever, I get the error “LightItem is undefined”
What are the different types of layers that can be found in a composition, and how can they be tested to see if they are one layer type or another?
Take care,
Nick
-
Nicholas White
April 12, 2005 at 4:54 amHey,
Sort of found a workaround in the scripting manual (please, somebody write a good manual in the next version!) to see if a layer is a camera or light…
Check to see if you can add an effect to it (lights and cameras cannot have effects) by sending this test:
if(activeLayer (“Effects”) == null)
{
do something
}Surely, there must be another way?
Take care,
Nick
Log in to reply.