I have three layers in my document: A group layer, a bone layer and a normal layer. At index 1 my script prints: i=1, "Bone layer at 1" but then the error when I try to read the layer count. All IsGroupType()-layers should have CountLayers() because their parent class is GroupLayer, right?
Code: Select all
for i = 0, moho.document:CountLayers()-1 do
local currentLayer = moho.document:Layer(i)
if (currentLayer:LayerType() == MOHO.LT_GROUP) then print ("Group layer at ", i) end
if (currentLayer:LayerType() == MOHO.LT_BONE) then print ("Bone layer at ", i) end
if (currentLayer:LayerType() == MOHO.LT_PARTICLE) then print ("Particle layer at ", i) end
if (currentLayer:LayerType() == MOHO.LT_SWITCH) then print ("Switch layer at ", i) end
if (currentLayer:IsGroupType()) then
print ("Group layer found at index ", i, ", layer count is ", currentLayer:CountLayers())
end
end