Activity › Forums › Adobe After Effects › Duplicate layer without changing name
-
Duplicate layer without changing name
Posted by Criis Daw on September 20, 2019 at 10:09 amDoes any body know of a way ro duplicate a layer but have the name remain the same ?
for example.
Layer_01 duplicates to Layer_02
but i would like it to remain Layer_01
any ideas ??
Criis Daw replied 6 years, 8 months ago 2 Members · 3 Replies -
3 Replies
-
Walter Soyka
September 20, 2019 at 9:04 pmYou could do this with a script.
Save this code as “01-duplicateLayerPreserveName.jsx” in your Scripts folder. (The number is important to force it to the top of the list, alphabetically, so we can assign a keyboard shortcut to it later.)
// duplicate selected layers and rename dupes to match originals exactlyapp.beginUndoGroup("Duplicate selected layers and preserve exact names");
if (app.project.activeItem instanceof CompItem) {
var renamedLayerCount = 0;
for (var i = 0; i < app.project.activeItem.selectedLayers.length; i++) {
try {
var originalLayer = app.project.activeItem.selectedLayers[i];
var newLayer = originalLayer.duplicate();
newLayer.name = originalLayer.name;
renamedLayerCount++;
} catch (err) {};
}
writeLn("Renamed " + renamedLayerCount + " layer(s).");
}app.endUndoGroup();
Reload Ae, then Edit > Keyboard Shortcuts. Search the command list for “script” and find the “01-duplicateLayerPreserveName” entry. Assign it a keyboard shortcut, and then you can easily rename layers without incrementing their names. (Note that this can cause unexpected results if you’re using expressions that refer to layers by name!)
Walter Soyka
Designer & Mad Scientist at Keen Live [link]
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
@keenlive | RenderBreak [blog] | Profile [LinkedIn]
Reply to this Discussion! Login or Sign Up