• Editor
  • skin doesn't support multiple slot images?

I have a character with different slot images during animation. And now I need the charactore with the exact animation but a different suit so I created a skin for that charactor. The problem is, the skin doesn't support multiple slot image under it so it's not possible to create a skin animation with custom image change during animating (for example, idle and running requires different images, and I have different helmet so it requires 2 images for the head for a single skin, and that is not supported).

Maybe put this in the backlog? Makes a lot of sense and sometimes truly important.

Related Discussions
...

Having trouble understanding the issue. You can have multiple skin attachments under the same slot.

Nate escreveu

Having trouble understanding the issue. You can have multiple skin attachments under the same slot.

Not sure about how multiple skin attachment under same slot will help this issue, let me re-state it.

Lets say I'm having a charactore with idle and running animation and there needs to be two images for each animation (head for idle and head02 for running). Without skin attachment, I can change slot image during run time so the animation will appear to have different head images.

Now, I need to expand the player so that it can have red or black suits, so there needs to be red suit and black suit as 2 separate skin under Skin tree (not attachment). Then, I can create different skin attachment, in this case for example, I can create a skin attachment under helmet and add different colored helmet image under different skin, so there are two images now (one for red suit skin one for black suit skin). And again, since there are different animations that requires different images, so there actually needs to be 2 images under the helmet in each skin's case, so there are 4 images in total. (That is, for each skin, two images are needed for idle and running under the helmet so there are four images in total.)

The way I want it to be is: I have skin1 for red suits and skin2 for black suits, and for helmet attachment under each skin, there are 2 different images under it so that when idle and running there can be different images and I can switch skin freely to see the effect.

But now that is not supported: you can only have one image under a skin attachment so it cannot switch slot images for each skin.

Sounds complicated, I hope I have re-explained the problem clearly. And btw any insight into how multiple skin attachment can be used? It's not that clear stated from the youtube tutorial

It still isn't perfectly clear, sorry. An image attachment is a single image. From your description you seem to want an image attachment to be multiple images, which doesn't make any sense. :wonder:

A slot can have multiple attachments, but only one can be visible. A skin attachment is an attachment where the actual attachment used comes from a skin. The skin attachment is a placeholder, the actual attachment used depends on which skin is active. You can't have two image attachments under a single skin attachment, that doesn't make sense as it is a single attachment that is a placeholder for a single attachment.

You can do this:

head (bone)
    head (slot)
        idle head (skin attachment)
            red idle head (image attachment in red skin)
            black idle head (image attachment in black skin)
        running head (skin attachment)
            red running head (image attachment in red skin)
            black running head (image attachment in black skin)

In your animations you can show or hide "idle head" or "running head" for the "head" slot. The actual attachment used depends on which skin is active. Does this solve your use case? If not, why?

Nate escreveu

It still isn't perfectly clear, sorry. An image attachment is a single image. From your description you seem to want an image attachment to be multiple images, which doesn't make any sense. :wonder:

A slot can have multiple attachments, but only one can be visible. A skin attachment is an attachment where the actual attachment used comes from a skin. The skin attachment is a placeholder, the actual attachment used depends on which skin is active. You can't have two image attachments under a single skin attachment, that doesn't make sense as it is a single attachment that is a placeholder for a single attachment.

You can do this:

head (bone)
    head (slot)
        idle head (skin attachment)
            red idle head (image attachment in red skin)
            black idle head (image attachment in black skin)
        running head (skin attachment)
            red running head (image attachment in red skin)
            black running head (image attachment in black skin)

In your animations you can show or hide "idle head" or "running head" for the "head" slot. The actual attachment used depends on which skin is active. Does this solve your use case? If not, why?

I'm still trying to understand your solution. I understand that the skin attachment is a place holder and it will change the image hosted when I select different skin under the tree. I uploaded the picture for a single skin case (well, I should say, there is no skin yet, but you can also think of this inside a single skin), and you can see there are two images under a image slot. For the multiple skin case I was expecting something similar to this where you have a skin attachement that will hosts different image slots that contains different images based on the skin. Actually, let me draw it.

That should make it clear, what I want is pretty similar to the solution you provide except you difference them by head image type and I did by head color type. And the thing is, I don't know how achieve this in the editor. The tutorial didn't cover this slightly more complicated situation.

EDIT: BTW I understant that the skin attachment is just a holder, I draw both red and black skin attachment meant to show how the single attachment is changed when choosing different skin under the tree. (Choosing red, you see the above one, choosing black, you see the beneth one) What I basically wanted is instead of having a single image attached to a skin attachment for a particular skin, I wanted to be able to attach a slot that contains several images (the circle thing) to the skin attachment for a particular skin so I can use the exact slot image change key during animation when different skin is selected. (pretty convoluted I know :S)

ryf9059 escreveu

For the multiple skin case I was expecting something similar to this where you have a skin attachement that will hosts different image slots that contains different images based on the skin.

It doesn't work this way. It works as I described above. A skin attachment is a placeholder for a single attachment which comes from a skin. A skin attachment does not have multiple attachments under it. A skin attachment is available for hiding/showing on a slot just like an image attachment. Skin attachments still solve your problem, you just need to think about it differently. Slots have named attachments that are hidden and shown. Skin attachments don't change this. A skin attachment is hidden and shown just like any other attachment on a slot. The only difference is that the actual attachment that will be used comes from the skin.

This confuses our animators too btw. The issue to me is the "default" skin works one way, and has a data structure that is one way and you can have multiple images from the default skin under a single slot. Skins work differently with a different json structure and you can only have one image from a skin per slot.

Why is the default "skin" different from the other skins?

Barry escreveu

Skins work differently with a different json structure and you can only have one image from a skin per slot.

This isn't true. A slot can have any number of skin attachments. Eg, you could have:

head (bone)
    head (slot)
        idle head (skin attachment)
            red idle head (image attachment in red skin)
        running head (skin attachment)
            red running head (image attachment in red skin)
        jumping head (skin attachment)
            red jumping head (image attachment in red skin)

In the editor, the default skin is implicit. At runtime, the default skin is the same as any other skin. The only difference is how an attachment is looked up. When a skeleton needs to find an attachment (Skeleton getAttachment) first it looks in the active skin, if not found it looks in the default skin.

So why does my json structure look very different for the default skin versus a regular skin? Is there some way to make the skin definition output consistent?
regular skin:

	"Clown": {
		"Body": {
			"Body": { "name": "Clown/Human_ClownBody", "x": 30.45, "y": 6.03, "rotation": 90.9, "width": 72, "height": 124 }
		}
	}

default skin:

	"default": {
		"Bandaid": {
			"Damage/Bandaid1": { "x": 35.12, "y": 18.8, "rotation": -87.74, "width": 32, "height": 32 },
			"Damage/Bandaid2": { "x": 29.48, "y": 9.57, "rotation": -87.74, "width": 32, "height": 32 },
			"Damage/Bandaid3": { "x": 35.39, "y": 11.8, "rotation": -87.74, "width": 32, "height": 32 }
		},
	}

Just look at where the image names for the attachements are compared between the two.

It is described in the JSON format docs:
http://esotericsoftware.com/spine-json-format/#skins
The name field is left out for brevity when the actualAttachmentName is the same as the attachmentName. Eg, these are identical:

"Damage/Bandaid1": { "x": 3 ...
"Damage/Bandaid1": { "name": "Damage/Bandaid1", "x": 3 ...

See the docs for more details.