jsfl Add keyframe to non selected layer
Is it possible to add a keyframe to a non selected layer using jsfl? Or does it need to be selected first with setSelectedLayers(index)?
Is it possible to add a keyframe to a non selected layer using jsfl? Or does it need to be selected first with setSelectedLayers(index)?
Hi.
If I'm understanding correctly, the currentLayer approach is what you want.
But please notice that selecting a layer and selecting a keyframe are different things.
The code below should select the second layer and create a keyframe at index 5. Then it should reselect the original layer and the original keyframe.
var doc = fl.getDocumentDOM();
var timeline = doc.getTimeline();
var currentLayer = timeline.currentLayer;
var selectedFrames = timeline.getSelectedFrames();
var targetLayer = 1;
var targetFrame = 5;
timeline.currentLayer = targetLayer;
timeline.convertToKeyframes(targetFrame);
timeline.currentLayer = currentLayer;
timeline.setSelectedFrames(selectedFrames);
Please let us know if this is helpful somehow.
Regards,
JC
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.