Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save GoodBoyNinja/d00a95176b83c1fb8df7356d36b9e93c to your computer and use it in GitHub Desktop.
Save GoodBoyNinja/d00a95176b83c1fb8df7356d36b9e93c to your computer and use it in GitHub Desktop.
Returns all existing effects for a layer.
function AllEffectsOnLayer(layer) {
if (layer !== undefined) {
// alert ("shit")
var effectsGroup = layer("ADBE Effect Parade");
//var effectsOnLayer = new Array();
var effectsOnLayer = [];
if (effectsGroup !== null) {
for (var i = 1; i <= effectsGroup.numProperties; i++)
effectsOnLayer[effectsOnLayer.length] = effectsGroup.property(i);
}
if (effectsOnLayer.length > 0) {
return effectsOnLayer;
} else {
alert("No Effects Found");
return []
}
} else return []
}
// example section to show how the function can be implemented. You can remove this and call the function yourself.
// this will alert the name of every effect applied to the selected layers
if (!comp || !(comp instanceof CompItem)) {
alert("No comp is active");
} else {
var selectedLayers = comp.selectedLayers;
if (selectedLayers.length > 0) {
var effectsOnThisLayer = AllEffectsOnLayer(selectedLayers[0]);
for (var i = 0; i < effectsOnThisLayer.length; i++) {
alert(effectsOnThisLayer[i].name);
}
} else {
alert("Select a layer");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment