Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions checking if a camera is 1 node or 2 node by expression ?

  • checking if a camera is 1 node or 2 node by expression ?

    Posted by Dirk De jong on February 11, 2018 at 6:02 pm

    I’m trying to have an expression include an if/else to be able to account for whether a camera in the comp is 1 node or 2 nodes. I don’t think there is any way to access any kind of “Camera Type” property so I was wondering is there a way to check whether the first parameter under transforms is Point of Interest or Position – or to check whether there are 5 or 6 Transform parameters on the camera (either of which would effectively tell me which camera type it is…) But so far I haven’t figured a way to do that either… any suggestions ? Thanks in advance for any ideas.

    Dirk De jong replied 8 years, 2 months ago 2 Members · 3 Replies
  • 3 Replies
  • Dirk De jong

    February 11, 2018 at 8:59 pm

    [Dirk de Jong] “so I was wondering is there a way to check whether the first parameter under transforms is Point of Interest or Position – or to check whether there are 5 or 6 Transform parameters on the camera (either of which would effectively tell me which camera type it is…)”

    actually on further testing I found that
    thisComp.layer(“camera name”).transform(1).name ;
    gives me the param name but it seems that Point of Interest is always at the index1 spot in camera transforms (it’s just hidden and disabled for 1 node cameras) so this might not be a successful strategy for distinguishing camera type after all… other ideas most welcome…

  • Dan Ebberts

    February 11, 2018 at 10:11 pm

    It looks like accessing the POI will generate an error with a one-node camera, so you should be able to use that with try/catch like this source text expression example:


    try{
    thisComp.layer("Camera 1").transform.pointOfInterest;
    "Two-Node Camera";
    }catch (err){
    "One-Node Camera";
    }

    Dan

  • Dirk De jong

    February 11, 2018 at 10:20 pm

    [Dan Ebberts] “It looks like accessing the POI will generate an error with a one-node camera, so you should be able to use that with try/catch “

    yes I was aware of the potential errors for sure (it doesn’t show up as “null” but it gives missing errors) – great idea – that seems like it will work for me – thanks a lot

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