Page 1 of 1

Auto Set reference layer or group ignore layer selector

Posted: Wed Jan 15, 2025 4:01 am
by peng
There is a problem where i always accidentally select and manipulate the reference layer using the layer selector, which breaks the sync without knowing. it would be great to make the reference layer automatically ignored by the layer selector because the fundamental reason for reference layer is to use the base layer to drive its movements.

Re: Auto Set reference layer or group ignore layer selector

Posted: Wed Jan 15, 2025 4:12 am
by Greenlaw
Some tips:

Set the Reference Layer to Ignored By Layer Selector. This should prevent selecting the layer from the Working Area.

If the problem is that you're selecting the layer from the Layers Window, set the layer to a bright color (like red,) and add the words REFERENCE in front of the layer name. This discourages me from selecting the layer.

If this is still a problem, consider using Synthsin75's Lock Layer script.

Hope this helps.

Re: Auto Set reference layer or group ignore layer selector

Posted: Wed Jan 15, 2025 4:37 am
by peng
Thank you Greenlaw, but i still wish the reference layer when created is auto set to be ignored by layer selector, this will prevent people from selecting the layer from the main workarea. A small improvement but will help streamline the work process by a big mile. Wonder if there is a way for me to suggest it to the developers :)

Re: Auto Set reference layer or group ignore layer selector

Posted: Wed Jan 15, 2025 6:21 am
by Greenlaw
Yeah, I agree...having Ignored By Layer Selector automatically enabled for Reference layers could be a useful option.

Re: Auto Set reference layer or group ignore layer selector

Posted: Wed Jan 15, 2025 8:37 am
by SimplSam
Working from the answers you received the last time you raised the subject: is there a way to auto set the reference layer ignored by the layer selector?

To do this automatically, you can do it with a script tool. A script of this nature has been posted to mohoscripts.com: https://mohoscripts.com/script/ss_create_reference

The guts of the script...

Code: Select all

local thisLayer = moho.layer                           -- Get the current layer
local refLayer  = moho:DuplicateLayer(thisLayer, true) -- Create the Reference Layer
refLayer:SetName("REF " .. thisLayer:Name())           -- Set name with Prefix
refLayer:SetIgnoredByLayerPicker(true)                 -- Set Ignore Layer selector
refLayer:SetLabelColor(01)                             -- Set Layer Color (01 == Red)
moho:UpdateUI()                                        -- Refresh the Layers Display

Re: Auto Set reference layer or group ignore layer selector

Posted: Wed Jan 15, 2025 2:51 pm
by Greenlaw
This script sounds very useful, SimplSam! I'll check it out later today.

Oh, and thanks for commenting the script. I made a New Year's resolution to get competant with Moho scripting, and every comment helps. :D

Re: Auto Set reference layer or group ignore layer selector

Posted: Thu Jan 16, 2025 2:19 am
by peng
OMG, this is so helpful, thank you so much SimplSam for creating this script. I wish the creators can integrate this into their official moho release

Re: Auto Set reference layer or group ignore layer selector

Posted: Thu Jan 16, 2025 4:54 am
by synthsin75
Or if you want it fully automated, you can drop this code in the IsEnabled function of any tool in your custom content tool folder:

Code: Select all

	if moho.layer:IsReferencedLayer() and not moho.layer:IsIgnoredByLayerPicker() then
		moho.layer:SetIgnoredByLayerPicker(true)
	end