-
Test for method existance?
I have an expression that refers to thisComp.activeCamera.
The problem is that I don’t always necessarily HAVE a camera in this scene. (Humor me and assume I’m still in the process of rigging/duplicating this comp, and have a good reason to be deleting the active camera for awhile before putting a new one in.)
Problem- when there is no active camera in the comp- the expression promptly errors out and deactivates itself. I’ve tried my standard javascript approach: if (thisComp.activeCamera) but rather than evaluating as undefined/null/false, the expression throws an error the moment it even TESTS thisComp.activeCamera for existence… because it does not exist.
Is there a method for testing for something’s existence? In ANOTHER example- I’d like to be able to put in an expression that says “Do this only if the comp has a layer called ‘Fred’.” But calling thisComp.layer(“fred”) errors out and kills the script (unless there actually is a layer named Fred, natch.)
Ideas?