Skip to main content
sergiopop75
Inspiring
June 16, 2022
Question

Split layer

  • June 16, 2022
  • 2 replies
  • 439 views

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();



https://youtu.be/UnLDqlCEKUA

This topic has been closed for replies.

2 replies

Vladin M. Mitov
Inspiring
June 17, 2022

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 );

})();

 

 

 

 

- Vlad: UX and graphic design, Flash user since 1998Member of Flanimate Power Tools team - extensions for character animation
sergiopop75
Inspiring
June 19, 2022

Amazing!!!

Thanks!!!

____2D vector animator since 2000 & PhD
Warren Heaton
Community Expert
Community Expert
June 16, 2022

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"?