• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

set layer mode in multiple layers ?

Explorer ,
Jun 05, 2024 Jun 05, 2024

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

TOPICS
Scripting

Views

122

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jun 05, 2024 Jun 05, 2024

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.
...

Votes

Translate

Translate
Community Expert ,
Jun 05, 2024 Jun 05, 2024

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();

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 07, 2024 Jun 07, 2024

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 07, 2024 Jun 07, 2024

Copy link to clipboard

Copied

LATEST

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();

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 05, 2024 Jun 05, 2024

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:

Screenshot 2024-06-06 at 08.00.15.png

 

The xml file of this block script is attached, such that you can directly load it into Automation Blocks.

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines