Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions scripting question: how to test layers for their types

  • scripting question: how to test layers for their types

    Posted by Nicholas White on April 12, 2005 at 4:39 am

    Hello,

    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 something

    However, 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 replied 18 years, 5 months ago 1 Member · 1 Reply
  • 1 Reply
  • Nicholas White

    April 12, 2005 at 4:54 am

    Hey,

    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

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy