Copy link to clipboard
Copied
In After effects there is a layer splitting function. Sometimes it is very practical for example for character arms, to make the change of depth and it is necessary to create a new upper layer to place the frames that continue. I have created a command with the history, but, the layer must be selected properly and the pasting must be more concrete. I share the video of what I am really looking for.
an.getDocumentDOM().getTimeline().copyFrames();
an.getDocumentDOM().getTimeline().addNewLayer();
an.getDocumentDOM().getTimeline().convertToBlankKeyframes();
an.getDocumentDOM().getTimeline().pasteFrames();
Copy link to clipboard
Copied
If this is a feature request, I'd vote for it.
Although, rather than call it Split Layer based on After Effects, how about "Duplicate selected Frames to New Layer"?
Copy link to clipboard
Copied
Hi,
Assign to this command some handy keyboard shortcut and enjoy 🙂
(function(){
var doc = fl.getDocumentDOM();
if( ! doc ){
alert( "No document open." );
return;
}
var tml = doc.getTimeline();
var sel = tml.getSelectedFrames();
if( sel.length != 3 ){
alert( "Make a contiguous selection on one layer in the timeline." );
return;
}
var myLayer = tml.layers[ sel[0] ];
if( myLayer.layerType === "folder" ){
alert( "Select a non-folder layer." );
return;
}
var startFrame = sel[1], endFrame = sel[2];
var newLayerName;
// Change this to "move" if you want to move the frames instead of copy them.
var action = "copy";
if( action === "copy" ){
tml.copyFrames( startFrame, endFrame );
newLayerName = "Copy of " + myLayer.name + " ( "+ (startFrame+1) + "-" + endFrame + " )";
}else if( action === "move" ){
tml.cutFrames( startFrame, endFrame );
newLayerName = "Moved from " + myLayer.name + " ( "+ (startFrame+1) + "-" + endFrame + " )";
}
tml.addNewLayer( newLayerName );
tml.convertToBlankKeyframes( startFrame, endFrame );
tml.pasteFrames( startFrame, endFrame );
})();
Copy link to clipboard
Copied
Amazing!!!
Thanks!!!
Copy link to clipboard
Copied
I have added a label to the frames to which the command is applied, to avoid confusion.
an.getDocumentDOM().getTimeline().setFrameProperty('name', 'Split');
(function(){
var doc = fl.getDocumentDOM();
if( ! doc ){
alert( "No document open." );
return;
}
var tml = doc.getTimeline();
var sel = tml.getSelectedFrames();
if( sel.length != 3 ){
alert( "Make a contiguous selection on one layer in the timeline." );
return;
}
var myLayer = tml.layers[ sel[0] ];
if( myLayer.layerType === "folder" ){
alert( "Select a non-folder layer." );
return;
}
var startFrame = sel[1], endFrame = sel[2];
var newLayerName;
// Change this to "move" if you want to move the frames instead of copy them.
var action = "copy";
if( action === "copy" ){
tml.copyFrames( startFrame, endFrame );
newLayerName = "Copy of " + myLayer.name + " ( "+ (startFrame+1) + "-" + endFrame + " )";
}else if( action === "move" ){
tml.cutFrames( startFrame, endFrame );
newLayerName = "Moved from " + myLayer.name + " ( "+ (startFrame+1) + "-" + endFrame + " )";
}
tml.addNewLayer( newLayerName );
tml.convertToBlankKeyframes( startFrame, endFrame );
tml.pasteFrames( startFrame, endFrame );
})();
an.getDocumentDOM().getTimeline().setFrameProperty('labelType', 'name'); an.getDocumentDOM().getTimeline().setFrameProperty('name', '');