I've managed to set other settings of layers with a script but not that.
How are you supposed to write it?
How to set group masking to "hide all"?
Moderators: Víctor Paredes, Belgarath, slowtiger
-
- Posts: 370
- Joined: Wed Aug 04, 2004 6:23 pm
- Location: Los Angeles
- Contact:
If you only want to set that setting, without get into GUI's and similar, I think you can look at the bottom of the "scripts/menu/Layer Effects/lm_layershadow.lua script to figure it out. Fortunately, you'll be able to find (generally) something closely related (or not) with you are treating to do somewhere inside all that AS scripts, so always it worths to take some time scrutinizing them before star to write blindly. A mine of wisdom and (saved) time
.

...
I think it's kind of tricky. Are you using the script reference HTML help files availabe in the script forum? Very handy.
Here's the description in the reference to change the masking of a group layer:
That is the current layer selected. If that layer is a group layer and you want to change the masking tell lua what type of layer you want the current layer to be referenced as:
Once you've done that you can do group layer stuff to "layer". Even if "layer" was a group layer, AS lua isn't going to know that. You have to tell it specifically to work with a group layer.
Now you can set the masking... I hope this works. Haven't tested it but it's the same as other layer type stuff I've done before.
This should set the masking mode of the current layer to "hide all". In the script reference the following are listed as masking options.
Hope this is not too confusing.
-vern
Here's the description in the reference to change the masking of a group layer:
The first thing you need is the layer reference. If you have done scripty things with layers than you know how to get the layer reference. Then you have to tell lua what type of layer it should be used as:void SetGroupMask(mask)
Sets the group's masking mode. See group masking mode constants.
Return value: none mask (int): the group's masking mode
So if you've done a lot of scripting you know this part:GroupLayer LayerAsGroup(layer)
Converts a generic layer object into a group layer.
Return value (GroupLayer): a GroupLayer object layer (MohoLayer): the layer to cast
Code: Select all
local layer = moho.layer
Code: Select all
layer = moho:LayerAsGroup(layer)
Now you can set the masking... I hope this works. Haven't tested it but it's the same as other layer type stuff I've done before.
Code: Select all
layer:SetGroupMask(2)
remember that you need an INTEGER for the masking reference. The numbers always start with 0 so "hide all" would be 2:The following constants are used to define the masking that happens within a group.
GROUP_MASK_NONE - No masking
GROUP_MASK_SHOW_ALL - Turn on masking, initially showing all sub-layers
GROUP_MASK_HIDE_ALL - Turn on masking, initially hiding all sub-layers
Hope this is not too confusing.

-vern
Now you can set the masking... I hope this works. Haven't tested it but it's the same as other layer type stuff I've done before.
Code: Select all
layer:SetGroupMask(2)
I would use:This should set the masking mode of the current layer to "hide all". In the script reference the following are listed as masking options.
The following constants are used to define the masking that happens within a group.
GROUP_MASK_NONE - No masking
GROUP_MASK_SHOW_ALL - Turn on masking, initially showing all sub-layers
GROUP_MASK_HIDE_ALL - Turn on masking, initially hiding all sub-layers
Code: Select all
layer:SetGroupMask(GROUP_MASK_HIDE_ALL)

-G
-
- Posts: 370
- Joined: Wed Aug 04, 2004 6:23 pm
- Location: Los Angeles
- Contact:
Thank you for all the help, it works now!
I was doing it like this: layer:SetGroupMask(GROUP_MASK_HIDE_ALL)
But realized it had to be: layer:SetGroupMask(MOHO.GROUP_MASK_HIDE_ALL)
It does say that in the documentation on closer inspection...
Doing it Verns way, layer:SetGroupMask(2), worked as well of course.
I was doing it like this: layer:SetGroupMask(GROUP_MASK_HIDE_ALL)
But realized it had to be: layer:SetGroupMask(MOHO.GROUP_MASK_HIDE_ALL)
It does say that in the documentation on closer inspection...

Doing it Verns way, layer:SetGroupMask(2), worked as well of course.