JSFL Perfecting the merge layer functionality,Ask for help.
At present, the function has met my needs.
But it's not humanized.
Select layer must keep shist selection from bottom.
Because the new layer is on the 1 floor of the active layer.
If I choose from the top down, the active layer is the bottom and the new layer is in the middle of the layer.
However, copy and paste will be pasted to the top,@@
So the layers are messed up.
I hope to improve this function.
1,I want the new layer to be at the top of all selected layers.or the bottom
2,Copy and paste, you can find the merge layer and paste it inside, instead of pasting it into a fixed layer.
These are the problems I need to solve.
Hope to help me perfect this JSFL.
It's a great help for animation.
Perfect function, others can also use, in the production of animation, especially traditional animation will help a lot of people.
var doc = fl.getDocumentDOM();
var tl = fl.getDocumentDOM().getTimeline();
var selFrames = tl.getSelectedFrames();
var frameLength = selFrames[2] - selFrames [1];
fl.getDocumentDOM().getTimeline().addNewLayer("Merging");
tl.currentFrame = selFrames[2]-1;
for (i=0; i<frameLength; i++)
{
for (n=0; n<selFrames.length; n+=3)
{
layerNum = selFrames
curFrame = tl.currentFrame;
tl.setSelectedLayers(layerNum, false);
if(tl.currentFrame == tl.layers[layerNum].frames[curFrame].startFrame)
{
tl.setSelectedFrames(selFrames);
tl.currentFrame = curFrame;
tl.insertKeyframe();
doc.selectAll();
doc.clipCopy();
tl.setSelectedLayers(selFrames[0], true);
doc.clipPaste(true);
n = selFrames.length
}
}
tl.currentFrame --;
}
Demo why need.
If you don't have a merged layer, it means that I need to copy each frame to the new layer, and if it's a lot of frames, it's a huge amount of work.
Of course I'm just a simple demo.If it is a standard animation, the work is more, cumbersome copy frame modify frame, make the production become painful


