March 18th 2016 08:00:46am
Welcome to this episode of the Free Function Friday series. Today’s function will help you apply a plugin effect to a collection of layers within a project. All you will need to supply the function is an array collection of layer objects, and the name of the plugin you want to apply.
Since we are dealing with plugin effects, another helpful resource for this function will be plugin match names. A match name is a custom name that the plugin developer creates that will remain the same behind the scenes regardless of what language After Effects is running in. This is good for helping maintain compatibility for your scripts across different markets. To get you started, here are a few links to some lists of match names.
My old matchname list:
After Effects Plugin Match Names
Jeff Almasol has a CC stock plugin list:
Jeff Almasol: Redefinery
One of the earlier episodes of Free Function Friday can also be used to obtain a list. Today’s video explains how to modify this code:
Free Function Friday getThirdPartyFX
Source Code:
var a = app.project.item(1).selectedLayers; //Assumes first project item is a composition and has layers selected
applyPluginEffect(a, "ADBE Easy Levels2");
/* TESTING ABOVE */
function applyPluginEffect(layObj, fx){
if(layObj instanceof AVLayer || layObj instanceof ShapeLayer || layObj instanceof TextLayer){
layObj.Effects.addProperty(fx);
}else if(layObj instanceof Array){
var layObjLen = layObj.length;
for(var i=0; i < layObjLen; i++){
layObj[i].Effects.addProperty(fx);
}
}else{
return null;
}
}