Page 1 of 1

Move layers to layer marks

Posted: June 5th, 2007, 12:36 am
by jeffedit
I'm sure this is feasible, but clearly above me:
I do a lot of see and say lists...vo says it, type comes on screen. I will preview audio on a layer and drop marks at each point that the text line should come on. All the marks are on one layer. I use a script to import a csv list and create a comp layer for each line of text. Is there a script that I can program so that after I drag all the text layers into the comp (same start point, say the first mark), it will then line up each subsequent layer with the next mark, similar to the keyframe assistant "sequence layers"?
Any help appreciated. TIA
Jeff

Posted: June 11th, 2007, 9:21 am
by byronnash
I'm not aware of an existing one but that doesn't sound too hard to do. You can access an array of the markers and then shift the layer startTime to the keyTime property of each marker.

Posted: June 12th, 2007, 9:30 pm
by nab
a very basic script could be like this:
(assuming the first layer has the markers on it, layers below have to be shifted according to the marker keys time)

Code: Select all

{
	var myComp = app.project.activeItem;
	if (myComp == null || !(myComp instanceof CompItem))
		alert("No active composition");
	else if (myComp.numLayers < 2)
		alert("At least two layers are required.");
	else
	{
		var markerLayer = myComp.layer(1);
		var markerGroup = markerLayer.Marker;
		var iter = Math.min(markerGroup.numKeys,myComp.numLayers);
		
		app.beginUndoGroup("markersToStartTimeDemo.jsx");
		for (var i = 1; i < iter; i++)
		{
			var curTime = markerGroup.keyTime(i);
			myComp.layer(myComp.numLayers - i + 1).startTime = curTime;
		}
		app.endUndoGroup();
	}	
}