Ep. 16 layerPropMatchNames Free Function Friday
Welcome to Free Function Friday. Today we create a function that retrieves the match names for layer properties. Now when you are scripting and accessing layers, you will come across different properties depending on the layer type. A text layer’s properties will differ from a camera layer’s properties, as well as a light layer’s properties. Some properties will be universal, like Markers, which can be on any layer in your project. Using the match name for a property will allow your code to be more compatible with users around the world who use a different language for After Effects. While the names of properties will vary depending on the language, match names do not. They will always be the same for all users within a single After Effects version. Say CC 2015 for example. There can be the possibility though of changes between versions of After Effects, so version CC 2015 may use a new match name for a property that does not exist in CC 2014.
As a simple example, the app name for layer masks is “Masks”, but there is a universal match name for it behind the scenes and that is “ADBE Mask Parade”. Since other languages of After Effects will change the actual name of “Masks” into the native language equivalent for the user, there had to be a consistent method of accessing and controlling the software. This is where the match names come into play. If you had made a script and you used “ADBE Mask Parade” for the property, it would find the property every time regardless if you were running the Japanese, Italian, Spanish, or English version of After Effects. If you had used “Masks”, then the property would only match if the English version of After Effects was running. So you can see how making multi language compatible scripts can be a bit more involved. You can certainly track down every language variant of the word “Masks” and do a search to then see which one matches, but that would be a very inefficient way to code.
As you get deeper into scripting for After Effects, you’ll find many quirks, so having access to some of the behind the scenes information can come in handy. Property match names being one of them.
If you haven’t done so already there is a Free Function Friday introduction video located here that has some important information pointing to a few resources that will come in handy when scripting for After Effects.
Episode 16 layerPropMatchNames:
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.