Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Helper variables
- var proj = app.project; // active project
- var comp = proj.activeItem; // active comp
- var layer = comp.selectedLayers; // selected layers
- var numLayers = comp.numLayers; // count of comp layers
- function setupLayers()
- {
- for (i = 1; i <= numLayers; i++)
- {
- var layer = comp.layer(i);
- var effectsGroup = layer("Effects");
- var effectsOnLayer = [];
- if (effectsGroup !== null)
- {
- for (var v = 1; v <= effectsGroup.numProperties; v++)
- {
- effectsOnLayer[effectsOnLayer.length] = effectsGroup.property(v);
- }
- }
- for (var k = 0; k < effectsOnLayer.length; k++)
- {
- if (effectsOnLayer[k].matchName === "ADBE Set Matte3")
- {
- layerEffectIndex = k+1;
- layerRefIndex = effectsOnLayer[k].property(1).value;
- arr = [layerEffectIndex,layerRefIndex];
- effectsOnLayer[k].name += " $" + arr.toString();
- comp.layer(layerRefIndex).comment = layerRefIndex;
- }
- }
- }
- }
- function findLayerByComment(commentToFind)
- {
- for (i = 1; i <= numLayers; i++)
- {
- if (comp.layer(i).comment === commentToFind.toString())
- {
- return i;
- }
- }
- }
- function resetLayers()
- {
- for (i = 1; i <= numLayers; i++)
- {
- var layer = comp.layer(i);
- var effectsGroup = layer("Effects");
- var effectsOnLayer = [];
- if (effectsGroup !== null)
- {
- for (var v = 1; v <= effectsGroup.numProperties; v++)
- {
- effectsOnLayer[effectsOnLayer.length] = effectsGroup.property(v);
- }
- }
- for (var k = 0; k < effectsOnLayer.length; k++)
- {
- if (effectsOnLayer[k].matchName === "ADBE Set Matte3")
- {
- originalName = effectsOnLayer[k].name.split("$")[0];
- arr = effectsOnLayer[k].name.split("$")[1].split(",");
- effectsOnLayer[k].property(1).setValue(findLayerByComment(arr[1]));
- effectsOnLayer[k].name = originalName.substring(0,originalName.length-1);
- }
- }
- }
- for (i = 1; i <= numLayers; i++)
- {
- comp.layer(i).comment = null;
- }
- }
- //setupLayers();
- //resetLayers();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement