jcmeyer5 schriebSay I have an animal skeleton. I have several skins for this animal skeleton... a lion, a tiger, and a bear.
A lion, a tiger, and a bear? Oh my! :tmi:
Each has its own set of eye images... angry eyes, open eyes, closed eyes, dead eyes. When I build this skin, I will have an attachment for each.
That last sentence lost me, because you don't have just one skin.
You'll have an "eyes" slot with skin placeholders: angry, open, closed, dead. Then you'll have 3 skins: lion, tiger, bear. In the lion skin, the angry skin placeholder for the eyes slot will use the lion-eyes-angry image, the open skin placeholder will use lion-eyes-open, etc. In the tiger skin, the angry skin placeholder for the eyes slot will use the riger-eyes-angry image, etc.
When I load that skin, how do I know which one is loaded?
This also isn't clear. When you load a skin from JSON, it is just a mapping of slot+name to attachment. Eg your lion skin will look like:
eyes slot + "angry" = lion-eyes-angry attachment
eyes slot + "open" = lion-eyes-open attachment
eyes slot + "closed" = lion-eyes-closed attachment
eyes slot + "dead" = lion-eyes-dead attachment
When you set a skin on a skeleton, it just changes where it finds an attachment. Eg if you set the lion skin and then use Skeleton#setAttachment("eyes", "closed") then it will find the lion-eyes-closed attachment.
Each SlotData has an attachment name that is the attachment to show for the setup pose. If the "eyes" slot has "dead" shown by default, the if you set the lion skin and then call Skeleton#setSlotsToSetupPose(), it will use the lion-eyes-dead attachment for the eyes slot. If you set the tiger skin and then call Skeleton#setSlotsToSetupPose(), it will use the tiger-eyes-dead attachment for the eyes slot.
OR... are you saying that the name of the default attachment when setting up the slot is the attachment I should look for in the skin (not default skin)? Is there a naming consistency that I need to adhere to? What if different skins have different default eyes... the tiger has cute eyes by default, the bear has angry eyes by default, but both skins have cute and angry eyes?
Yes, the SlotData is a name to use for looking up an attachment. It doesn't care what names you use, use names that make sense to you. Different skins cannot have different default eyes. You will have to set the skin, then set the eyes you want.
Make sense now? ๐