Automaticly making precomps i select with same length

What type of scripts do you need?

Moderator: byronnash

Post Reply
tillimanjaro
Posts: 3
Joined: July 11th, 2008, 3:48 am

Hello,

Im a final cut pro user.

If i need to color correct or make some animations on it, i use AE for it.
Im using the magnum edit detector to cut it back in peaces.

Is there a script that can make a precomp from clips i select and also make the length of the clip(so the clip is at the beginning), instead of doing manualy, somewhere? If so i can make the animations in that precomp and later replace comps if needed.

Thx

Mr T.
User avatar
redefinery
Posts: 112
Joined: April 1st, 2005, 8:16 pm
Location: CA
Contact:

tillimanjaro wrote:Is there a script that can make a precomp from clips i select and also make the length of the clip(so the clip is at the beginning), instead of doing manualy, somewhere?
hi mr. t,

will this script do what you need?
http://www.redefinery.com/ae/view.php?i ... re-compose

:jeff
tillimanjaro
Posts: 3
Joined: July 11th, 2008, 3:48 am

Thx Jeff,

It does the right thing but only if you select one.
If i select different(cutted)clips it just makes one precomp from all the clips? Thats just fine, but if im dealing with 60 cuts, that a pain...

Any more help?



redefinery wrote:
tillimanjaro wrote:Is there a script that can make a precomp from clips i select and also make the length of the clip(so the clip is at the beginning), instead of doing manualy, somewhere?
hi mr. t,

will this script do what you need?
http://www.redefinery.com/ae/view.php?i ... re-compose

:jeff
Redsandro
Posts: 108
Joined: June 25th, 2008, 4:55 pm

Hi,

I bet you found another solution, but I've written this script for that purpose.
I thought I'd share it anyway because it's been the ultimate time saver for me.

Code: Select all

/**********
 *	LayerNumbers
 **********
 *	Filename:		RED Precomp Layers Headroom.jsx
 *	Written by:		Redsandro - http://www.rednet.nl/en/
 *	Date:			2009/02/15
 *	Last updated:	2009/06/11
 **********
 *
 *	Description:
 *
 *	UNshy layers to precomps with headroom
 *
 **********/



/* MANUAL CONFIG */
// Do you want each preComp to begin at frame 0 (true) or just have an in and out point in the entire segment (false)? 
var resetComps = true;
/* MANUAL CONFIG */



clearOutput();

var myComp = app.project.activeItem;

if (myComp == null) {
	alert("No composition selected.");
}
else {
	// Vars
	var allLayers = myComp.layers;
	var fDuration = myComp.frameDuration;
	var headroom = "25";
	headroom = parseInt(prompt("How much frames headroom per layer do you want?", headroom));
	headroom *= myComp.frameDuration;

	app.beginUndoGroup("Precomp Layers");

	// Walk layers 
	for (var l = allLayers.length; l> 0; l--) { // BACKWARDS! Or index changes after each precomp! Index NOT zerobased. //Selfnote: Actually I thought it was but this works.
		// Vars
		var layer = allLayers[l];

		// Precompose
		//allLayers.precompose();
		if (!layer.shy && !layer.timeRemapEnabled) {	// timeRemap gaat fout bij precompen in CS3 (geloof ik)
			// Read old values
			var inPnt = layer.inPoint;		// Note: inPnt is parent comp, so from footage point of view inPnt = startTime + inPnt
			var outPnt = layer.outPoint;
			var startTime = layer.startTime; //201

			// Make comp
			myComp = allLayers.precompose([layer.index],layer.name);
			
			// fix comp
			if (resetComps == true) {	// Make preComp length equal to active segment
				// Headroom Check
				var headLead = headroom;
				// var headTrail = headroom; // headTrail fail because there's no layersource.duration function (by heart)
				while ((inPnt - startTime) < headLead) {
					headLead--;
				}
				// Crop segment to frame 0
				myComp.layers[1].startTime = -(inPnt-startTime)+headroom;
				myComp.layers[1].inPoint = 0+headroom;
				myComp.layers[1].outPoint = outPnt-inPnt+headroom;
				// Set workArea to active segment in preComp
				myComp.workAreaStart = headroom;
				myComp.workAreaDuration = outPnt-inPnt;
				// Set new comp length to active segment
				myComp.duration = headroom+(outPnt-inPnt)+headroom;

				// Adjust parent comp for new layer timing
				allLayers[l].startTime = inPnt-headroom;
				allLayers[l].inPoint = inPnt;
				allLayers[l].outPoint = inPnt+(outPnt-inPnt);
			}
			else {						// Make preComp length equal to total segment
										// Selfnote: Not prepared for headroom!
				// Set workArea to active segment in preComp
				myComp.workAreaStart = inPnt;
				myComp.workAreaDuration = outPnt - inPnt;
				
				// Restore active segment for preComp
				allLayers[l].inPoint = inPnt;
				allLayers[l].outPoint = outPnt;
			}
			
			// Change mycomp length
		}
	}

	app.endUndoGroup();
}
avi + m2t -> Vdub + DGIndex -> AE CS3 -> x264 -> Hell On Earth :mrgreen:
Post Reply