Copy link to clipboard
Copied
Hi,
How to adjust one layer settings for multiple compositions at the same time.
I have a layer that I use in several compositions. I would like to find a quicker way than go through all compositions to change the layer settings. Is there a script for this?
For example:
Can the layer setting "mode" be adjusted from "normal" to "color" in multiple compositions at the same time?
This would really help me.
Anybody have an idea?
Kind regards
Not knowing exactly what your spec is, here's an example that goes through all the comps looking for a layer with the same name as the selected layer and if it finds one, it sets the blend mode to "color".
function setLayerMode(){
var comp = app.project.activeItem;
if ( ! comp || ! (comp instanceof CompItem)){
alert ("No comp active.");
return;
}
if (comp.selectedLayers.length == 0){
alert ("No layer selected");
}
var layer = comp.selectedLayers[0];
for (var i = 1; i <= app.project.
...
Copy link to clipboard
Copied
Not knowing exactly what your spec is, here's an example that goes through all the comps looking for a layer with the same name as the selected layer and if it finds one, it sets the blend mode to "color".
function setLayerMode(){
var comp = app.project.activeItem;
if ( ! comp || ! (comp instanceof CompItem)){
alert ("No comp active.");
return;
}
if (comp.selectedLayers.length == 0){
alert ("No layer selected");
}
var layer = comp.selectedLayers[0];
for (var i = 1; i <= app.project.numItems; i++){
if (app.project.item(i) instanceof CompItem){
for (var j = 1; j <= app.project.item(i).numLayers; j++){
if ((app.project.item(i).layer(j) instanceof AVLayer) && (app.project.item(i).layer(j).name == layer.name)){
app.project.item(i).layer(j).blendingMode = BlendingMode.COLOR;
break;
}
}
}
}
}
setLayerMode();
Copy link to clipboard
Copied
Hi Dan, thank you for the script, it works. It seems the adjustment is need for only a couple of my comps per project. Any idea if this script can be adjusted to run for a list of comp names?
Copy link to clipboard
Copied
This variation has an array of comp names at the top, the script will only check comps that are in the list..
function setLayerMode(){
var compNames = ["Comp 1", "Comp 2"];
var comp = app.project.activeItem;
if ( ! comp || ! (comp instanceof CompItem)){
alert ("No comp active.");
return;
}
if (comp.selectedLayers.length == 0){
alert ("No layer selected");
}
var layer = comp.selectedLayers[0];
for (var i = 1; i <= app.project.numItems; i++){
if (app.project.item(i) instanceof CompItem){
var gotOne = false;
for (var j = 0; j < compNames.length; j++){
if (app.project.item(i).name == compNames[j]){
gotOne = true;
break;
}
}
if (! gotOne) continue;
for (var j = 1; j <= app.project.item(i).numLayers; j++){
if ((app.project.item(i).layer(j) instanceof AVLayer) && (app.project.item(i).layer(j).name == layer.name)){
app.project.item(i).layer(j).blendingMode = BlendingMode.COLOR;
break;
}
}
}
}
}
setLayerMode();
Copy link to clipboard
Copied
In my (paid) extension Automation Blocks, you can simply combine the block which loops over project items (like comps) with the block which sets attributes of layers. This example sets the bending mode of the layer with name "Black Solid" to "Multiply" for all comps, which are currently selected in the project panel:
The xml file of this block script is attached, such that you can directly load it into Automation Blocks.