Mailing List AE-List@media-motion.tv ? Message #52579
From:
Drew Gilmore <dotsandlines@gmail.com>
Subject:
Re: [AE] scripting for pseudo-effects
Date:
Sun, 19 Jan 2014 18:30:06 -0600
To:
After Effects Mail List <AE-List@media-motion.tv>
Ahh, ok. I may have to let the logic of that sink in, but I think I get it. This is what happens when I only script every year or so. Thanks very much for the help!
The reason is that the first object becomes invalid once you run addProperty again. You can add the properties back to back like in version 2, but you would need to assign them to variables afterwards like in version 3, to be able to access any attributes for them.
VERSION 1
var vppath = curLayer.Effects.addProperty("VP-Path");
vppath.property("Azimuth").expression = ("50");
var vp = curLayer.Effects.addProperty("Virtual Projector");
vp.property("Azimuth").expression = ("50");
This works because you are changing a value to a valid effect property immediately after creating each effect.
VERSION 2
var vppath = curLayer.Effects.addProperty("VP-Path");
var vp = curLayer.Effects.addProperty("Virtual Projector");
vp.property("Azimuth").expression = ("50");
vppath.property("Azimuth").expression = ("50");
vppath becomes invalid the second you add another property (vp), at which point you cannot change something that's invalid. You can check if a variable is valid by running: