Skip to main content
February 2, 2021
Question

【script】【marker】How to add a marker to the inpoint of every layer

  • February 2, 2021
  • 1 reply
  • 427 views

I want to add a marker with a number to the inpoint of all layers in composition.

 

Does anyone know how to write this script?

 

please tell me!

This topic has been closed for replies.

1 reply

February 2, 2021

oh , comp marker !

Inspiring
February 2, 2021
var myComp = app.project.activeItem;
if (myComp != null && myComp instanceof CompItem) {

	var layerTimes = new Array;

	for (var x=1; x <= myComp.numLayers; x++) {
		layerTimes.push(myComp.layer(x).inPoint);	// grab all the layer in points
	}

	layerTimes.sort();	// sort the times from first to last

	if (layerTimes.length > 0) {
		var myMarker ;
		var markerCount = 1;

		for (x = 0; x < layerTimes.length; x++) {
			if (x == 0 || layerTimes[x] > layerTimes[x-1]) {	// don't add multiple markers for layers that have same in points
				myMarker = new MarkerValue(markerCount);
				myComp.markerProperty.setValueAtTime(layerTimes[x], myMarker);
				markerCount++;
			}
		}
	} else alert("This comp has no layers");
} else alert("Select a comp first");
				

 

質問の解決策を受け取った場合は、それを正しいものとしてマークしてください。これにより、投稿内およびコミュニティ内の回答が強調表示され、コミュニティメンバーがあなたと同じ問題を経験したり、同じ質問をしたりした場合に役立ちます。