Free Function Friday collectCompCameras

FFF Header

Welcome to episode 20 in the Free Function Friday series, collectCompCameras. This week we build a function that will gather the camera layer objects from an array of comp objects that you supply it. This is helpful if needing to adjust any camera layers in your project, or gather data about your camera layers. Since this function accepts an array of comp objects, you can supply it the currently open comp or all of the comps in your project. From that selection the function will read through every layer in those comps and collect only the layers that are camera layers. In our case we will return a new object that contains the layer index number, the layer name, and the layer object itself. This will give us more options after the fact if we need to do any other processes to these camera layers. As always you can certainly customize the returned value to your needs though.

Episode 20 collectCompCameras:


Legal note: The Adobe ExtendScript code talked about in this article and accompanying embedded video(s), and/or graphic images are not guaranteed to be compatible with every version of After Effects. David Torno, ProVideo Coalition, and Diversified will not be held liable for any misuse or incorrect use of the provided ExtendScript code. Use at your own risk.

All of the code I provide in this series, has been created and tested in After Effects CC 2014. Unless otherwise specified in the episode, the code should be compatible with After Effects CS6 through CC 2015. I’ve done my best to avoid depreciated code (code that Adobe removed at some point), and made these functions as compatible as possible. There will however be the occasional piece of code that is brand new as of a certain version of After Effects and therefore will not be backwards compatible from that version. I will mention these if that is the case.

With that said, all the code I provide in this series is open source and free to use in your scripts. I highly encourage you to expand and improve upon the code I provide and start making your own custom functions as well, but please do not repost the code I show in this series as is and claim it as your own. If you use any of the code provided in this series please give credit where credit is due. This series is meant to provide, what I feel is useful code, as well as to hopefully further explain ExtendScript and it’s quirks. While the functions we build throughout this series can perform a task all on their own, they are not meant to be a solo script. How you combine them together and expand upon them is when you will gain the most from these functions.


David Torno

David Torno is a Visual Effects professional based in Los Angeles. Developing and creating VFX since 2000, David has been a part of over ninety different productions. His work includes commercial, feature, music video, and multimedia projects. He is most widely known for his work on projects for such artists as Linkin Park (“Waiting for the End”, “New Divide”, “Burn it Down”), Flight of the Conchords (“Ladies of the World”), and Swedish House Mafia (Absolut Greyhound). During his free time, he creates video tutorials and After Effects scripts. David enjoys contributing to the visual effects community by offering helpful tools, and techniques that creative professionals around the world can benefit from.