-
if-else ‘check’ (sorta like if-exists?)
I’m new to expressions, and am trying to have a “check” where if a certain layer exists, then the expression proceeds one way, if not, it does another thing.
I don’t think there is a specific “ifexists” command, so I’m just checking the contents of a layer of text- right now I have a text layer called CHECK and its text is 1 (if I want it true), and if true, it uses the SCALE layer’s text for an expression.
Ideally I’d like to just check if SCALE layer exists at all, and if so, use it… if not use other. I’m hoping for a better way to do this. Thanks for looking.
if (thisComp.layer("CHECK").text.sourceText.toString()=="1" ){
expr = thisComp.layer("SCALE").text.sourceText.toString()
}else{
expr = comp("MASTER CHIEF").layer("SCALE").text.sourceText.toString()
}eval(expr)