I am looking at 7feet's SwitchSlave script for inspiration (closest example I have) but it uses LayerAsSwitch... and there doesn't seem to be one of "those" for a bone layer... so... I don't have an example for how to apply my bone master "stuff" to the layers that are found.
I think I've got a handle on looping through the list and finding those layers and such... I just need to know what to assign to a variable when it finds those other matching layers. This should be an array as well since there could be a bunch of layers controlled by one master.
-- recursive search for the source
local stack= {}
local sp= 0
local document= moho.document
for i= 0, document:CountLayers() - 1 do
local layer= document:Layer(i)
local parent= nil
local sub= 0
while true do
if (layer:IsGroupType()) then
--push onto the stack (there are sub-layers to scan)
table.insert(stack, { parent, sub - 1 })
sp= sp + 1
parent= moho:LayerAsGroup(layer)
sub= parent:CountLayers()
end
--here comes the main part, check the layer, recognise and modify its contents
-- like: if (string.sub(layer:Name(),-15) == "controlled.ctrb") then ...
if (something to recognise the layer) then
-- do it here what you want
end
--this is the stack administration
if (sub > 0) then
sub= sub - 1
layer= parent:Layer(sub)
else
sub= -1
while (sp > 0) do
parent, sub= stack[sp][1], stack[sp][2]
table.remove(stack)
sp= sp - 1
if (sub >= 0) then
layer= parent:Layer(sub)
break
end
end
if (sub < 0) then
break
end
end
end
end
By the way, what do you think about the news? The Anime Studio? How this will change our programming in Lua?
As far as the new version of "MohanimeProXP" and scripting... I have no idea.
I hope it doesn't change too much. I would like to think... if it aint broke... don't fix it... just add new stuff.
Hmm... I wonder though... will we have to change all the scripts references to "moho" to "anime"?
Easy enough with search and replace right?
I've seen other programs that had coding like this just leave the old references in there. Adobe Golive still has custom JS code that references "CS" when it use to be CyberStudio... they never bothered to change those variable names.
You can read my thoughts on the new name in the "Lookout Flash" thread in the general forum.