ADOBE AFTER EFFECTS: Forum Expressions Tutorials Podcasts Creative Cloud

replace source - How to replace layer with a comp - Scripting

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Inna Bunmireplace source - How to replace layer with a comp - Scripting
by on Jan 2, 2013 at 7:33:02 am


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 replaced

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

for (var j = 1; j <= app.project.numItems; j++){
if (app.project.item(j).name == aStr + "_Comp"){
var currentComp = app.project.item(j);

I get stuck on the replace Source bit.

Help is greatly appreciated.

Thank You

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2016 All Rights Reserved