Copy link to clipboard
Copied
Select frames on multiple layers for operation. If there are locked layers in the selection, how to ignore the locked layers.
Can jsfl achieve automatic judgment?
If possible, I need some help. Thanks
var tl = fl.getDocumentDOM().getTimeline()
var sel = tl.getSelectedFrames()
for (var i = 0; i < sel.length; i += 3) {
if (tl.layers[sel[i]].locked === true) {
tl.setSelectedFrames([sel[i], sel[(i + 1)], sel[(i + 2)]], false)
}
}
Copy link to clipboard
Copied
jsfl has a boolean layer.locked property.
Copy link to clipboard
Copied
Thank you for your reply. I will continue to explore
Copy link to clipboard
Copied
you're welcome. (just loop through any timoof interest layers to do what you want.)
Copy link to clipboard
Copied
if(fl.getDocumentDOM().getTimeline().layers[0].locked === false){
}
or do you need to write a ready script ?
Copy link to clipboard
Copied
The effect I want to achieve is to select multiple layers and insert keyframes (or other operations), then automatically ignore locked layers (locking layers does not add keyframes (or other operations)),
Copy link to clipboard
Copied
var tl = fl.getDocumentDOM().getTimeline()
var sel = tl.getSelectedFrames()
for (var i = 0; i < sel.length; i += 3) {
if (tl.layers[sel[i]].locked === true) {
tl.setSelectedFrames([sel[i], sel[(i + 1)], sel[(i + 2)]], false)
}
}
Copy link to clipboard
Copied
Perfect, that's great,
By the way, what is the logical idea behind this string of code?
Because I thought about it before asking the question, but the direction was wrong, and my efforts were in vain
Copy link to clipboard
Copied
I found that the playback head will automatically jump to the first frame in the blue range of the selected frame. Can I keep it as it is without jumping
Copy link to clipboard
Copied
you can return it to its start.
Copy link to clipboard
Copied
var tl = fl.getDocumentDOM().getTimeline()
var current_frame = tl.currentFrame;
var sel = tl.getSelectedFrames()
for (var i = 0; i < sel.length; i += 3) {
if (tl.layers[sel[i]].locked === true) {
tl.setSelectedFrames([sel[i], sel[(i + 1)], sel[(i + 2)]], false)
}
}
tl.currentFrame = current_frame