d13 Posted November 25, 2019 Share Posted November 25, 2019 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!! Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted November 25, 2019 Share Posted November 25, 2019 (edited) 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 November 25, 2019 by ivan.popelyshev Quote Link to comment Share on other sites More sharing options...
d13 Posted November 25, 2019 Author Share Posted November 25, 2019 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? Quote Link to comment Share on other sites More sharing options...
d13 Posted November 25, 2019 Author Share Posted November 25, 2019 ... 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? Quote Link to comment Share on other sites More sharing options...
jonforum Posted November 25, 2019 Share Posted November 25, 2019 (edited) tested and work on my side, i can change skin multiple time. "pixi.js": "^4.8.7", "pixi-spine": last branche 3.8, also this tread can interest youhttp://esotericsoftware.com/forum/Need-Setup-pose-help-12659 Edited November 25, 2019 by jonforum Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted November 25, 2019 Share Posted November 25, 2019 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. Quote Link to comment Share on other sites More sharing options...
d13 Posted November 25, 2019 Author Share Posted November 25, 2019 (edited) I'm using Pixi 5 and the have installed the pixi-spine master branch (2.1.4). Edited November 25, 2019 by d13 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted November 26, 2019 Share Posted November 26, 2019 In that case, if you have problems with skins, you can try official html5 runtime https://github.com/EsotericSoftware/spine-runtimes/tree/3.8/spine-ts . Try to set skins there, and if it produces output different from pixi-spine - we have a bug :) Quote Link to comment Share on other sites More sharing options...
d13 Posted November 26, 2019 Author Share Posted November 26, 2019 Thanks! I will do some more testing and report back Quote Link to comment Share on other sites More sharing options...
d13 Posted November 26, 2019 Author Share Posted November 26, 2019 ... I should also mention, I'm getting this warning: `"export 'spine' (imported as 'PIXI') was not found in 'pixi.js'`. But, otherwise, no other errors. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.