-
replace source – How to replace layer with a comp – Scripting
Hi,
I edit a video in Adobe Premiere using several clips. I import the project in After Effects as a composition with several layers edited accordingly.
I am trying to write a script that will do the following:
– Create Comps for every piece of footage in the project window.
– Replace the instances of the footage in the edited composition with the Comped versions of the footage.
So basically if I open a footage comp and add color correction it affects all instances of the footage in the edited composition.Here is what I have so far:
{ var mySelection = app.project.selection;
// Identify the Sequnce in which the footage will be replacedfor (var i = 1; i <= app.project.numItems; i++){
//var myComp = app.project.item(‘Sequence 01’);
if (app.project.item(i).name == “Sequence 01”){
var myComp = app.project.item(i);
}
}for (var i = 0; i < mySelection.length; i++){
var aStr = mySelection[i].name;
var aWidth = mySelection[i].width;
var aHeight = mySelection[i].height;
var aPX = mySelection[i].pixelAspect;
var aDur = mySelection[i].duration;
var aFrm = mySelection[i].frameRate;
var movComp = app.project.items.addComp(aStr + “_Comp”, aWidth, aHeight, aPX, aDur, aFrm);
movComp.layers.add(mySelection[i]);for (var j = 1; j <= app.project.numItems; j++){
if (app.project.item(j).name == aStr + “_Comp”){
var currentComp = app.project.item(j);
}
}
//movComp.layers.addText(mySelection[i].name);
myComp.layer(mySelection[i]).replaceSource(app.project.item(1));
}
}I get stuck on the replace Source bit.
Help is greatly appreciated.
Thank You
Sorry, there were no replies found.