How to I lock a layer?

Wondering how to accomplish a certain animation task? Ask here.

Moderators: Víctor Paredes, Belgarath, slowtiger

User avatar
mystd
Posts: 101
Joined: Thu Oct 22, 2015 4:10 pm

How to I lock a layer?

Post 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?
new account: brahrah
User avatar
Greenlaw
Posts: 9192
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: How to I lock a layer?

Post 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.
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: How to I lock a layer?

Post 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
Last edited by synthsin75 on Thu Jan 20, 2022 8:00 pm, edited 2 times in total.
User avatar
Greenlaw
Posts: 9192
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: How to I lock a layer?

Post by Greenlaw »

Thanks! I'll give it a shot on my personal setup.
chucky
Posts: 4650
Joined: Sun Jan 28, 2007 4:24 am

Re: How to I lock a layer?

Post by chucky »

Oh Awesome Wes!
Installing now. :D :D :D
chucky
Posts: 4650
Joined: Sun Jan 28, 2007 4:24 am

Re: How to I lock a layer?

Post 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.
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: How to I lock a layer?

Post 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
Last edited by synthsin75 on Mon Jun 05, 2017 12:26 am, edited 1 time in total.
chucky
Posts: 4650
Joined: Sun Jan 28, 2007 4:24 am

Re: How to I lock a layer?

Post 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.
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: How to I lock a layer?

Post 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.
chucky
Posts: 4650
Joined: Sun Jan 28, 2007 4:24 am

Re: How to I lock a layer?

Post 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
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: How to I lock a layer?

Post 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
User avatar
Greenlaw
Posts: 9192
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: How to I lock a layer?

Post by Greenlaw »

Cool! Thanks Wes.
User avatar
striker2311
Posts: 224
Joined: Wed Aug 26, 2020 3:55 pm

Re: How to I lock a layer?

Post 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
User avatar
SimplSam
Posts: 1033
Joined: Thu Mar 13, 2014 5:09 pm
Location: London, UK
Contact:

Re: How to I lock a layer?

Post 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
Moho 14.1 » Win 11 Pro 64GB » NVIDIA GTX 1080ti 11GB
Moho 14.1 » Mac mini 2012 8GB » macOS 10.15 Catalina
Tube: SimplSam


Sam
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: How to I lock a layer?

Post 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?!
Post Reply