Replace footage in comp

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
byronnash
Posts: 321
Joined: July 7th, 2004, 2:30 pm
Location: Charlotte, NC
Contact:

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
calier
Posts: 13
Joined: January 18th, 2005, 1:45 pm

I am looking for the same thing. Anybody out there knows if there any way to do that ?
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.
byronnash
Posts: 321
Joined: July 7th, 2004, 2:30 pm
Location: Charlotte, NC
Contact:

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.
Post Reply