Page 1 of 1

Replace footage in comp

Posted: February 4th, 2005, 10:39 am
by byronnash
Can this function be done in scripting? There are two ways to do it with keyboard shortcuts or dragging. I am importing some files into a project and need to swap the new items with layers that exist in a comp.

Replace a selected layer's source footage in Composition window with selected footage:

Ctrl + Alt + /
Command + Option + /


-or-

Replace a selected layer's source footage item or composition:

Alt-drag footage item from Project window into composition
Option-drag footage item from Project window into composition

Posted: March 14th, 2005, 7:27 pm
by calier
I am looking for the same thing. Anybody out there knows if there any way to do that ?

almost acceptable workaround

Posted: March 14th, 2005, 10:49 pm
by zold
The only way that I can see to do this (by way of workaround; don't ask me why source is read-only ... bizarre) is by the following:
  • 1)precomp the specified layer:
    newComp=layerColl.precompose([1], ("foo"), false);
    //where layerColl is the activeLayer.layers, [1] is layer 1 (or whatever it's supposed to be), false keeps properties in original comp instead of nesting them

    2)either set the original layer's enabled to false:
    newComp.layer(1).enabled=false;
    //or remove it:
    newComp.layer(1).remove();

    3)make a new layer collection object from the new comp (which can be empty, i.e. no layers):
    newCompLayerColl=newComp.layers;

    4)add the 'replacing' AV Item to newComp:
    newCompLayerColl.add(otherAVItem);
    //where otherAVItem is a previously specified AV Item
More coding needs to be done to retain the inPoints and outPoints in the nested comp, but you end up with a nested comp effectively taking the place of the old layer & the replacing item within it.

Posted: March 15th, 2005, 5:22 am
by byronnash
That's not a bad idea zold, I didn't think of precomposing it. It's not quite as clean as you would like but the end result should get you there.

With the script I was asking this question for, I ended up copying the values from a text file. I coped and pasted keyframe data to a file and then read from that file when I came to each importing each layer into a comp. It worked OK, but took a little time setting up.