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

How to ignore locked layers when selecting multi-layer operations

Participant ,
May 30, 2023 May 30, 2023

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.

0 (2).png

Can jsfl achieve automatic judgment?

If possible, I need some help. Thanks

TOPICS
Code

Views

486

Translate

Translate

Report

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

 

Votes

Translate

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

Copy link to clipboard

Copied

jsfl has a boolean layer.locked property.

Votes

Translate

Translate

Report

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
Participant ,
May 30, 2023 May 30, 2023

Copy link to clipboard

Copied

Thank you for your reply. I will continue to explore

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

if(fl.getDocumentDOM().getTimeline().layers[0].locked === false){
	
	}
or do you need to write a ready script ?

Votes

Translate

Translate

Report

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
Participant ,
May 30, 2023 May 30, 2023

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

Votes

Translate

Translate

Report

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

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

 

Votes

Translate

Translate

Report

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
Participant ,
May 30, 2023 May 30, 2023

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

Votes

Translate

Translate

Report

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
Participant ,
May 30, 2023 May 30, 2023

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

you can return it to its start.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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