Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects replace source – How to replace layer with a comp – Scripting

  • replace source – How to replace layer with a comp – Scripting

    Posted by Inna Bunmi on January 2, 2013 at 7:33 am

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

    Inna Bunmi replied 13 years, 4 months ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy