Jump to content

Setting Spine skins..?


d13
 Share

Recommended Posts

Hi Everyone! Just wondering what the the current practice is for setting skins in Spine?

I tried the following, based on this (https://github.com/pixijs/pixi-spine/blob/master/examples/change_skin.md)... but so far it hasn't worked:

this.animation.skeleton.setSkin(null);
this.animation.skeleton.setSkinByName('newSkinName');

I know the skins are working, because if I change the names any of them to `default` in the JSON, they show up when the animation starts as expected.

Is there something else I need to do to make sure the new skin is applied?

Thanks!!

Link to comment
Share on other sites

We had a bug with skins a bit ago, so please use latest version.

As for practice - its a question for EsotericSoftware forums and official spine-ts plugin.

Pixi-spine has special function hackTextureBySlot or something like that for 3 years already, in case you just want to change texture of one attachment, and you can use any pixi texture, not just something that came from spine.

Edited by ivan.popelyshev
Link to comment
Share on other sites

Thanks Ivan! Yes, I'm using the latest pixi-spine. I will and see if I can it working using hackTextureBySlotName (https://github.com/pixijs/pixi-spine/blob/master/examples/hack_texture.md)

By the way, are the images in the spine texture atlas accessible as individual textures through Pixi's resource loader? Or will they need to be loaded separately?

Link to comment
Share on other sites

... Just to be a bit more specific, I have some slots that look like this:

"slots": [
    { "name": "lamp", "bone": "root", "attachment": "lamp" },
    { "name": "glove_bottom", "bone": "glove", "attachment": "glove_bottom" },
    { "name": "sample_skin", "bone": "sample", "attachment": "sample_skin" },

]

I'm trying to figure out how to change the skin for "sample_skin". I've tried this:

this.animation.hackTextureBySlotName('sample_skin', newTexture, { width: 40, height : 40 });

... but without luck. Is this the correct way to do it, or is there something else I'm missing?

Link to comment
Share on other sites

1 hour ago, d13 said:

Thanks Ivan! Yes, I'm using the latest pixi-spine. I will and see if I can it working using hackTextureBySlotName (https://github.com/pixijs/pixi-spine/blob/master/examples/hack_texture.md)

By the way, are the images in the spine texture atlas accessible as individual textures through Pixi's resource loader? Or will they need to be loaded separately?

Yes. 

However, you are already on the edge of our collective knowledge. You have to look in sources, debug stuff, make an example , then if you are successful you can submit PR with new article for examples. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...