This is a script I should have written years ago. It’s fairly simple; it duplicates the selected layer in a comp, but unlike the built-in duplicate function it creates a new source for the layer in the project, allowing the copy and the original to be independent of each other.
If you have a precomp and you want to duplicate it, but then make changes to the contents of the duplicate without affecting the original, then this is the tool. It also works on footage, solid and adjustment layers.
But wait, there’s more. I’ve twiddled the knobs a bit, so now it optionally recurses through any subcomps, replacing the sources of any nested comps and (optionally layers) on the way. Oh and a GUI because buttons.
Here’s a diagram which explains what it does. To start with we have a comp containing a layer, and a subcomp which also contains a layer and a nested comp. If you hit the cloninate button with both layers in the original comp selected it will clone the footage layer, making a new source for it in the project, and it will clone the subcomp, making a new, uniquely named clone. If the recurse into subcomps checkbox is armed it will go into the subcomp and make clones of all its subcomps, and so on, all the way down. If the replace footage in subcomps checkbox is checked it will also make unique copies of all the footage layers in all the nested comps.
here’s the original comp:
And here’s what you get when you hit cloninate, with both checkboxes checked:
The layers and subcomps have been cloned with separate sources for all the source layers. Here’s what you get when you hit replacinate:
It looks like the original structure, but all the names have changed, reflecting that all the source layers have been replaced. subComp1 is now subComp2 and layer3 is now layer4. The script checks to make sure there isn’t a layer with the same name as the one it is creating, so you’ll never run into expressions problems or such like.
Update: I fixed a problem with sub-comps that have shape layers. Shape layers have no sources and this was confusing the script somewhat.
Install as you would any other After Effects script:
On a PC move to the After Effects folder in the ScriptUI Panels subfolder. That’s usually:
C:\Program Files\Adobe AfterEffects <version>\Support files\scripts\ScriptUI Panels\
On a Mac it’s in the After Effects Folder in the subfolder
/Applications/Adobe AfterEffects <version>/scripts/ScriptUI Panels/.