Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
1

How to ignore locked layers when selecting multi-layer operations

Contributor ,
May 30, 2023 May 30, 2023

Select frames on multiple layers for operation. If there are locked layers in the selection, how to ignore the locked layers.

0 (2).png

Can jsfl achieve automatic judgment?

If possible, I need some help. Thanks

TOPICS
Code
816
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Contributor , May 30, 2023 May 30, 2023

 

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

 

Translate
Community Expert ,
May 30, 2023 May 30, 2023

jsfl has a boolean layer.locked property.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
May 30, 2023 May 30, 2023

Thank you for your reply. I will continue to explore

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 30, 2023 May 30, 2023

you're welcome.  (just loop through any timoof interest layers to do what you want.)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
May 30, 2023 May 30, 2023
if(fl.getDocumentDOM().getTimeline().layers[0].locked === false){
	
	}
or do you need to write a ready script ?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
May 30, 2023 May 30, 2023

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
May 30, 2023 May 30, 2023

 

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

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
May 30, 2023 May 30, 2023

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
May 30, 2023 May 30, 2023

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 30, 2023 May 30, 2023

you can return it to its start.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
May 30, 2023 May 30, 2023
LATEST
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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines