Perhaps it's a change in 10/11 or maybe it never worked this way, but I can't get a style to get called.
I see by the docs it *ought* to be:
moho.document:Style(id) or moho.document:Style(name) but trying to cycle through the styles I am getting nowhere with:
for i = 0, moho.document:CountStyles() - 1 do -- this returns count ok
local thisstyle = moho.document:Style(i) -- this returns nil
If I DO call it with a name it works (so moho.document:Style("Skin") returns a style if there is one named Skin). Doesn't help me much if I don't know the names in advance, though.
Anyone have a clue?
Getting all the styles in a document?
Moderators: Víctor Paredes, Belgarath, slowtiger
Re: Getting all the styles in a document?
I was looking into this and unfortunately didn't get anywhere, but to shed some light on some confusing behaviour I did figure one thing out.
Styles are now using UUIDs instead of just integers. So instead of styles being 1, 2, 3, 4, 5 etc., they're 32 character hexadecimal strings. So you'd need to be doing something like
The reason for changing this was to prevent id's clashing when you import between scenes I believe.
There is a theoretical version that could work for smaller files to do this occasionally. You could loop through shapes and get the names of all their styles. In our case it was going to be impractical because of the size of scenes but you might manage it for a tool script on smaller scenes. Alternatively if your needs could allow you to just edit the file outside Anime Studio, I'd run a Python script that opens the file's data to look at the style info there.
Styles are now using UUIDs instead of just integers. So instead of styles being 1, 2, 3, 4, 5 etc., they're 32 character hexadecimal strings. So you'd need to be doing something like
Code: Select all
moho.document:Style("68267908-f00f-45f9-a943-d703f299fe71")
There is a theoretical version that could work for smaller files to do this occasionally. You could loop through shapes and get the names of all their styles. In our case it was going to be impractical because of the size of scenes but you might manage it for a tool script on smaller scenes. Alternatively if your needs could allow you to just edit the file outside Anime Studio, I'd run a Python script that opens the file's data to look at the style info there.