make layer unselectable?
Moderators: Víctor Paredes, Belgarath, slowtiger
- davoodice2
- Posts: 397
- Joined: Tue Jun 15, 2021 1:14 pm
make layer unselectable?
can be done though script?
خیام اگر ز باده مستی خوش باش
با ماهرخی اگر نشستی خوش باش
چون عاقبت کار جهان نیستی است
انگار که نیستی چو هستی خوش باش
با ماهرخی اگر نشستی خوش باش
چون عاقبت کار جهان نیستی است
انگار که نیستی چو هستی خوش باش
- hayasidist
- Posts: 3841
- Joined: Wed Feb 16, 2011 8:12 pm
- Location: Kent, England
Re: make layer unselectable?
you can lock a layer via scripting: https://mohoscripting.com/methods/576 but it can still be selected
- synthsin75
- Posts: 10267
- Joined: Mon Jan 14, 2008 11:20 pm
- Location: Oklahoma
- Contact:
Re: make layer unselectable?
From my lock layer script:
On frames > 0, selecting a locked layer instantly selects the last selected layer. For the user, it just looks like they can't select that layer.
EDIT: Forgot to include the assignment of self.lastLayer
Code: Select all
function Syn_LockLayer:IsRelevant(moho)
--keep locked layer from being selected
if (moho.frame > 0) and (moho.layer:IsLocked()) and (self.lastLayer) and (moho.document:IsLayerValid(self.lastLayer)) then
moho:SetSelLayer(self.lastLayer)
end
self.lastLayer = moho.layer
end
EDIT: Forgot to include the assignment of self.lastLayer
Last edited by synthsin75 on Fri Sep 03, 2021 12:56 am, edited 2 times in total.
- Wes
Donations: https://www.paypal.com/paypalme/synthsin75 (Thx, everyone.)
https://www.youtube.com/user/synthsin75
Scripting reference: https://mohoscripting.com/
Donations: https://www.paypal.com/paypalme/synthsin75 (Thx, everyone.)
https://www.youtube.com/user/synthsin75
Scripting reference: https://mohoscripting.com/
Re: make layer unselectable?
Oh, that's clever! 

NEW! Visit our Little Green Dog Channel on YouTube!
D.R. Greenlaw
Artist/Partner - Little Green Dog
Little Green Dog Channel | Greenlaw's Demo Reel Channel
D.R. Greenlaw
Artist/Partner - Little Green Dog
Little Green Dog Channel | Greenlaw's Demo Reel Channel
- davoodice2
- Posts: 397
- Joined: Tue Jun 15, 2021 1:14 pm
Re: make layer unselectable?
very interested! . now is it possible to change it to ignore locked layer and select behind layer?synthsin75 wrote: ↑Thu Sep 02, 2021 5:23 pm From my lock layer script:On frames > 0, selecting a locked layer instantly selects the last selected layer. For the user, it just looks like they can't select that layer.Code: Select all
function Syn_LockLayer:IsRelevant(moho) --keep locked layer from being selected if (moho.frame > 0) and (moho.layer:IsLocked()) and (self.lastLayer) and (moho.document:IsLayerValid(self.lastLayer)) then moho:SetSelLayer(self.lastLayer) end self.lastLayer = moho.layer end
EDIT: Forgot to include the assignment of self.lastLayer
خیام اگر ز باده مستی خوش باش
با ماهرخی اگر نشستی خوش باش
چون عاقبت کار جهان نیستی است
انگار که نیستی چو هستی خوش باش
با ماهرخی اگر نشستی خوش باش
چون عاقبت کار جهان نیستی است
انگار که نیستی چو هستی خوش باش
- synthsin75
- Posts: 10267
- Joined: Mon Jan 14, 2008 11:20 pm
- Location: Oklahoma
- Contact:
Re: make layer unselectable?
I don't understand.davoodice2 wrote: ↑Fri Sep 03, 2021 8:03 am very interested! . now is it possible to change it to ignore locked layer and select behind layer?
How do you want to define an unselectable layer?
And do you want it to select the next layer down when it finds one?
- Wes
Donations: https://www.paypal.com/paypalme/synthsin75 (Thx, everyone.)
https://www.youtube.com/user/synthsin75
Scripting reference: https://mohoscripting.com/
Donations: https://www.paypal.com/paypalme/synthsin75 (Thx, everyone.)
https://www.youtube.com/user/synthsin75
Scripting reference: https://mohoscripting.com/
- davoodice2
- Posts: 397
- Joined: Tue Jun 15, 2021 1:14 pm
Re: make layer unselectable?
exactly!synthsin75 wrote: ↑Fri Sep 03, 2021 5:52 pmAnd do you want it to select the next layer down when it finds one?davoodice2 wrote: ↑Fri Sep 03, 2021 8:03 am very interested! . now is it possible to change it to ignore locked layer and select behind layer?
خیام اگر ز باده مستی خوش باش
با ماهرخی اگر نشستی خوش باش
چون عاقبت کار جهان نیستی است
انگار که نیستی چو هستی خوش باش
با ماهرخی اگر نشستی خوش باش
چون عاقبت کار جهان نیستی است
انگار که نیستی چو هستی خوش باش
- synthsin75
- Posts: 10267
- Joined: Mon Jan 14, 2008 11:20 pm
- Location: Oklahoma
- Contact:
Re: make layer unselectable?
If you want to go to the next layer down, including to the next group, you'll have to create a table of all the layers in the document, in layer window order.davoodice2 wrote: ↑Fri Sep 03, 2021 11:02 pmexactly!synthsin75 wrote: ↑Fri Sep 03, 2021 5:52 pm And do you want it to select the next layer down when it finds one?
I have a routine for that, called Recursive, in the Utility functions sections of my switch icons tool. You'll just have to find the clicked layer on that table of layers and select the next layer in the table.
- Wes
Donations: https://www.paypal.com/paypalme/synthsin75 (Thx, everyone.)
https://www.youtube.com/user/synthsin75
Scripting reference: https://mohoscripting.com/
Donations: https://www.paypal.com/paypalme/synthsin75 (Thx, everyone.)
https://www.youtube.com/user/synthsin75
Scripting reference: https://mohoscripting.com/