I'm curious if anyone else is having trouble calling the "CountLayers" function.
local LayerNumber = moho.layer:CountLayers()
returns "CountLayers" is nill, despite the fact that there are several child layers to the selected group. This might be a bug, but I need some confirmation here.
--UPDATE--
The CountLayers function fails to work for group or bone layers, but appears to work for switch layers. I'm thinking this is a glitch now.
Count Layer issue
Moderators: Víctor Paredes, Belgarath, slowtiger
- hayasidist
- Posts: 3523
- Joined: Wed Feb 16, 2011 8:12 pm
- Location: Kent, England
Re: Count Layer issue
it's not "moho.layer" -- you need to recast the selected layer as a group
e.g.
is the glitch that switch "works" as not a group type!?
e.g.
Code: Select all
local ctLayer
local layer = moho:LayerAsGroup(moho.layer)
if layer == nil then
-- error
else
ctLayer = layer:CountLayers()
end
- synthsin75
- Posts: 9973
- Joined: Mon Jan 14, 2008 11:20 pm
- Location: Oklahoma
- Contact:
Re: Count Layer issue
If you had previously done moho:LayerAsSwitch(moho.layer) it will be a proper group for counting layers. Otherwise the only bug would be switch layers always cast as group layers, which shouldn't harm anything.
- 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: Count Layer issue
Thanks guys, this helped a lot.