Page 1 of 5

How to I lock a layer?

Posted: Tue Jul 19, 2016 3:16 pm
by mystd
I often mess up my art when I forget on which layer I am, can I lock down layers so I can't draw on the wrong one?

Re: How to I lock a layer?

Posted: Tue Jul 19, 2016 4:00 pm
by Greenlaw
That's a feature many users, including myself, have been requesting for a long time.

Personally, I wish I could lock Reference layers. To keep artists from animating the Reference layers, I append the title with REF_[layer name] and then I color code the layer red. This doesn't prevent someone from editing the layer but it helps make it more obvious that you shouldn't.

As for an actual 'lock' button, hopefully, we'll see that in a future release.

Re: How to I lock a layer?

Posted: Tue Jul 19, 2016 7:06 pm
by synthsin75
Here's a menu script that locks layers. This works for all selected layers and will toggle the locked state.

https://dl.dropboxusercontent.com/s/di9 ... r.zip?dl=0

Re: How to I lock a layer?

Posted: Tue Jul 19, 2016 7:12 pm
by Greenlaw
Thanks! I'll give it a shot on my personal setup.

Re: How to I lock a layer?

Posted: Wed Aug 10, 2016 3:10 am
by chucky
Oh Awesome Wes!
Installing now. :D :D :D

Re: How to I lock a layer?

Posted: Wed Aug 10, 2016 3:52 am
by chucky
chucky wrote:Oh Awesome Wes!
Installing now. :D :D :D
Ahh so ,I normally only want this when I want to re-time an entire document with messing up my particles.
That means I run the re time script, which overrides the syn script.
Is there a way to fix that?
Also is there a way to identify the layers that are locked visually?
Oh here's a couple of icons.
Image
Image
They look a little invisible here, I have done them in the Moho12 style, may need a line in the script to get the highlights to work, I don't know about that stuff.

Re: How to I lock a layer?

Posted: Wed Aug 10, 2016 6:13 am
by synthsin75
Hey Chucky, are you talking about Animation>Rescale Keyframes? If so, I doubt they wired that up to respect locked layers, and there's no way for a script to stop it.

This version uses your colorized icon (and works so much better as a button...I'd been using it as a menu script). I've also made it to where it will add "(LOCKED)" on the end of your layer names when locked. Let me know if it would work better at the beginning of the layer name (or maybe something shorter, like "(X)" or something).
https://www.dropbox.com/s/di9qqlq4mho4k ... r.zip?dl=0

Re: How to I lock a layer?

Posted: Wed Aug 10, 2016 7:03 am
by chucky
OH that works great!
I love the rename trick, nice one!
I will definitely keep this..
I had an idea about the retime menu script.
Maybe that could be modified to ignore layers with LOCKED in the name?
Just an idea.
I get caught with that all the time.
Just a few days ago I was working on the Retro Space Pack and needed to add some seconds at the start.
I applied the script and kept animating only to realise later on that (NOOO!) did it again and all my particles animations were stretched and I had to waste valuable time manually fixing all those layer's animations.
I actually wish that script had an 'ignore particles' setting but a if it could work with your locked button that would be awesome.

Re: How to I lock a layer?

Posted: Wed Aug 10, 2016 7:47 am
by synthsin75
Animation>Rescale Keyframes is not a script, it is hard-coded, so it can't be modded. That would have to be done by the devs, so you might want to report it.

Re: How to I lock a layer?

Posted: Wed Aug 10, 2016 8:29 am
by chucky
synthsin75 wrote:Animation>Rescale Keyframes is not a script, it is hard-coded, so it can't be modded. That would have to be done by the devs, so you might want to report it.
Yeah I did do a that while back ( I think) I'll check that now. :D

Re: How to I lock a layer?

Posted: Fri Feb 08, 2019 7:24 pm
by synthsin75
I've updated this script so that you cannot even select locked layers after frame zero:

https://www.dropbox.com/s/di9qqlq4mho4k ... r.zip?dl=0

Re: How to I lock a layer?

Posted: Fri Feb 08, 2019 7:27 pm
by Greenlaw
Cool! Thanks Wes.

Re: How to I lock a layer?

Posted: Sat Jun 26, 2021 5:41 am
by striker2311
synthsin75 wrote: Fri Feb 08, 2019 7:24 pm I've updated this script so that you cannot even select locked layers after frame zero:

https://www.dropbox.com/s/di9qqlq4mho4k ... r.zip?dl=0
Thanks synthsin I'll try too

Re: How to I lock a layer?

Posted: Sat Jun 26, 2021 6:52 am
by SimplSam
HeHe .. I made a small hack to this a while ago, to include a lock symbol on the locked layer.

Image

Code: Select all

function Syn_LockLayer:Run(moho)
	local lock_prefix = "🔒 " -- len == 5
	for i=0, moho.document:CountSelectedLayers()-1 do
		local layer = moho.document:GetSelectedLayer(i)
		layer:SetLocked(not layer:IsLocked())
		local name = layer:Name()
		if (layer:IsLocked()) then
			layer:SetName(lock_prefix .. name)
		else
			if (name:sub(1,5) == lock_prefix) then
				layer:SetName(name:sub(6))
			end
		end
	end
end

Re: How to I lock a layer?

Posted: Sat Jun 26, 2021 9:10 am
by synthsin75
SimplSam wrote: Sat Jun 26, 2021 6:52 am HeHe .. I made a small hack to this a while ago, to include a lock symbol on the locked layer.

Image

Code: Select all

function Syn_LockLayer:Run(moho)
	local lock_prefix = "🔒 " -- len == 5
	for i=0, moho.document:CountSelectedLayers()-1 do
		local layer = moho.document:GetSelectedLayer(i)
		layer:SetLocked(not layer:IsLocked())
		local name = layer:Name()
		if (layer:IsLocked()) then
			layer:SetName(lock_prefix .. name)
		else
			if (name:sub(1,5) == lock_prefix) then
				layer:SetName(name:sub(6))
			end
		end
	end
end
WT?! What text editor are you using that can handle emojis, and since when does Lua interpret them?!