collider

Adding an attachment creates a node under a slot with a puzzle piece icon. What is it used for? Thanks!
사용자 아바타
collider
  • 전체글: 14

Søren

If you check out the goblin examples, you can see attachments being used extensively.

First create a new skin, under the Skins node in the tree. Then when you create a new attachment and place an image on it (in the future it will be for more than just images) that image will only show up when that skin is visible, if you create another skin, and set that visible instead, images placed under the previous one will not be visible. The cool thing about this, is that all animation transfers between the skins.

I hope this helps :) I was planning on doing a video today, but unfortunately the flu has got me sounding very strange. I'll hopefully be able to do it over one of the next couple of days.
사용자 아바타
Søren

Shiu
  • 전체글: 2446

Nate

Careful with the nomenclature. An attachment is anything that goes in a slot. It could be an image, bounding box, etc. There is a special type of attachment called "skin attachment". This is the one that has a puzzle piece icon. This are one of the trickier parts of Spine, but I'll give explaining it a go.

The skin attachment provides a level of abstraction for what is actually attached there. It is a named placeholder. What is actually attached comes from a skin. Switching between skins changes what images are used for the skin attachments. Skins allow different looking characters to reuse the same skeleton and ALL the animations.

To use skin attachments, create them under a slot. Eg, under the eyes slot, create eyes-open and eyes-closed skin attachments. Next create a new skin. When a skin is visible, you can put images in the skin attachments. Put in images for eyes-open and eyes-closed. Create another skin and notice that the skin attachments are empty. Put in images for eyes-open and eyes-closed for that skin. Now when you switch skins, the images in the skin attachments change appropriately.

This way of doing skins may seem a little clunky at first, but it is much more powerful than a more naive skin solution which might just directly change the images that are in slots. Imagine you have one skeleton and two skins, a green goblin and a purple goblin. In an animation, you want to have the character blink. For the "eyes" slot, you simply show the correct skin attachment, either "eyes-open" or "eyes-closed". This way the green goblin uses his eyes open/closed images and the purple goblin uses her eyes open/closed images.

If the skin system didn't use skin attachments and instead it just changed the images that are visible, what would you do to blink in an animation? You would have to show either the green OR purple eyes closed, and then it would look wrong for the other skin. To fix this you would have to have an animation per skin, which means you aren't reusing the animations at all!

Note that skins are not meant to be used to change what weapon is in the characters hand or what hat she has on. For these, just use slots with regular images. You will have to manage setting which images are visible on which slots in your game code. Skins are for when you have multiple characters that use the same skeleton and you want to reuse all the animations.
사용자 아바타
Nate

Nate
  • 전체글: 11795

Humfleet

cool this helps me out a lot can't wait to see the video tho...
Humfleet
  • 전체글: 8

collider

Thanks, both of you! Just looking at the Goblin demo cleared it up for me, but the extra explanation helps (and I have a feeling this will help others). I should leave you guys alone now and just wait for the docs - just very fun to dive in and put it through its paces.
사용자 아바타
collider
  • 전체글: 14

Humfleet

ok so i have another question, once i make a skin is there a way to duplicate that skin so that way all the images are in the right places and then all i would have to do is change the directory names for the corresponding pieces?
Humfleet
  • 전체글: 8

Nate

I've added a duplicate button for skins in 1.0.7, which will probably be available sometime today.
사용자 아바타
Nate

Nate
  • 전체글: 11795

Humfleet

sweet can't wait to see this working
Humfleet
  • 전체글: 8

terrymisu

This post was great. It touches on something I've been curious about. Can you explain a bit more about how you'd go about switching out what a character is wearing? Is there an example that shows this?

I'd love to see a video tutorial specifically covering both topics.
사용자 아바타
terrymisu

Kickstarter Backer
  • 전체글: 136

Søren

I'll be starting work on more tutorial videos as soon as the Kickstarter is over :) I'll try to do some videos that cover specific topics and attachments will be one of them.
사용자 아바타
Søren

Shiu
  • 전체글: 2446

Nate

terrymisu 작성:Can you explain a bit more about how you'd go about switching out what a character is wearing?
To do this you would put multiple images in the same slot, then switch the images for that slot to change the clothes. Likely a piece of clothing is made up of multiple images, eg a shirt might have a part for the torso, left arm, and right arm. You'll need to manage yourself what images make up a piece of clothing, and in the runtime make the appropriate images visible. Note that you wouldn't normally use a skin or skin attachments to do this. It's as simple as just hiding/showing images in slots.
사용자 아바타
Nate

Nate
  • 전체글: 11795


다시 돌아감: Editor