How to set group masking to "hide all"?
Posted: Mon Jun 14, 2010 3:04 pm
I've managed to set other settings of layers with a script but not that.
How are you supposed to write it?
How are you supposed to write it?
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)
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
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)