ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

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

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Dirk de Jong
checking if a camera is 1 node or 2 node by expression ?
on Feb 11, 2018 at 6:02:11 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.


Return to posts index

Dirk de Jong
Re: checking if a camera is 1 node or 2 node by expression ?
on Feb 11, 2018 at 8:59:31 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...


Return to posts index

Dan Ebberts
Re: checking if a camera is 1 node or 2 node by expression ?
on Feb 11, 2018 at 10:11:00 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



Return to posts index


Dirk de Jong
Re: checking if a camera is 1 node or 2 node by expression ?
on Feb 11, 2018 at 10:20:35 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


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]