pixijs / spine

Pixi.js plugin that enables Spine support.
Other
570 stars 217 forks source link

Spine v3.8 json format breaking changes #300

Open YuryKuvetski opened 5 years ago

YuryKuvetski commented 5 years ago

As I understand in Spine v3.8 json format was changed, skins now is an Array. It breaks your logic in the readSkeletonData function, it expects that root.skins is an object with skin names as keys and attachments as values.

ivanpopelyshev commented 5 years ago

well shit. OK, I can make another pass on changes in my upstream, spine-ts. There's a way to speed-up this: do you know if there is skin example in official spine-ts repo that i can use to test if its fixed?

YuryKuvetski commented 5 years ago

is that enough? http://esotericsoftware.com/spine-json-format

ivanpopelyshev commented 5 years ago

No. I'll take skins example from https://github.com/EsotericSoftware/spine-runtimes/blob/3.7/spine-ts/webgl/demos/skins.js

I'm sorry, i have very long queue, maybe i'll do it in a week. You can modify pixi-spine.js file manually if you want to use it right now.

YuryKuvetski commented 5 years ago

ok

YuryKuvetski commented 5 years ago

@ivanpopelyshev Also there is a bug with a bones section of an animation.

"bones": {
   "boneName": {
      "timelineType": [
         { "time": 0, "angle": -26.55 },
         { "time": 0.1333, "angle": -8.78 },
...

"time" parameter is optional now as I understand. So in my case it looks like this:

"animations": {
  "animation": {
    "bones": {
      "_0008_male_main_body": {
        "rotate": [
          { "curve": 0.25, "c3": 0.75 },
          { "time": 0.8667, "angle": 1.92, "curve": 0.25, "c3": 0.75 },
          { "time": 1.6667 }
        ],
        "translate": [
          { "curve": 0.25, "c3": 0.75 },
          { "time": 0.8333, "x": -29.15, "y": -216.47, "curve": 0.25, "c3": 0.75 },
          { "time": 1.6667 }
        ],
        "scale": [
          { "curve": 0.25, "c3": 0.75 },
          { "time": 0.8333, "x": 1.133, "y": 1.133, "curve": 0.25, "c3": 0.75 },
          { "time": 1.6667 }
        ]
      },
...

So time is undefined and after some calculations it is NaN. Solution is to use 0 if time is undefined.

ivanpopelyshev commented 5 years ago

How do I update pixi-spine: I take all commits between previous and current version of https://github.com/EsotericSoftware/spine-runtimes/tree/3.8-beta/spine-ts , and apply them to pixijs runtime.

Thanks to your notices i'll be able to do it faster ;)

anna8810 commented 5 years ago

Hi, @ivanpopelyshev will these changes be added to the v4.x branch as well?

ivanpopelyshev commented 5 years ago

Only by demand :) Is your project big enough to stay on v4 because of possible problems with migration?

anna8810 commented 5 years ago

Yes, that would make us miss our deadline... :(

ivanpopelyshev commented 5 years ago

Spine 3.8 is still in beta. Are you sure you need it?

anna8810 commented 5 years ago

Our animator unfortunately updated to the beta version, and did a lot of work that I need to get in :(

ivanpopelyshev commented 5 years ago

OK, start the countdown, its 16:44 MSK time.

jonlepage commented 5 years ago

@anna8810 you do the same error as me lol. badlogic and nate tell me how get back (recover) to old version and not lost your work. it not the 3.8 but the 3.8.13 b http://esotericsoftware.com/forum/3-8-13-crash-pixijs-and-corrupted-project-file-Search-this-12066?p=53931#p53931

the 3.8.11 b work fine with pixi-spine. so you can keep 3.8 feature with freeze version at 3.8.11 b.

ivanpopelyshev commented 5 years ago

Well, i've got sidetracked by emergency, but im working on it. In a pair of hours you will get pixi-v4 + spine3.8

ivanpopelyshev commented 5 years ago

OK, please test this branch: https://github.com/pixijs/pixi-spine/tree/v4.x-3.8beta/bin

I've tested only raptor demo, but i didnt test any skins features

jonlepage commented 5 years ago

work fine on my side , thanks for this now, let see if we can have a tool for batch convert all files in a projet. :) http://esotericsoftware.com/forum/batch-convert-json-to-3-8-13-with-java-node-12087

ivanpopelyshev commented 5 years ago

@YuryKuvetski @anna8810 guys?

anna8810 commented 5 years ago

Sorry, we had a public holiday in Sweden yesterday so I was not at work. This will work for me, thanks guys! <3

YuryKuvetski commented 5 years ago

Works fine for me, thanks. Sorry for late.

YuryKuvetski commented 5 years ago

@ivanpopelyshev Should your code support old spine formats? image

I can't find any logic which can parse an old format of skins. So I'm getting this exception( image

ivanpopelyshev commented 5 years ago

No, its supposed to be 3.8-beta only, because there are too many changes that I dont know if its actually possible to load something old and show it the same way as new one.

ivanpopelyshev commented 5 years ago

OK, both v4 and v5 pixi + spine 3.7 3.8 are supported now. Just in different branches.

Ashden commented 5 years ago

No, its supposed to be 3.8-beta only, because there are too many changes that I dont know if its actually possible to load something old and show it the same way as new one.

It is possible, I've cloned v4.x-3.8beta and updated the changes to the JSON export, and tested on a spine containing slots, skins, constraints, transforms, animation and blend mode. It is backward-compatible with 3.7 and no regression issues for 3.8 (I can provide an example export from both 3.7 and 3.8 for demo purposes)

@ivanpopelyshev I read you said that is 3.8-beta only, so I'm wondering if you want a pull request into a specific branch, or a new branch for this?

Note: the changes are for PIXI v4 (which we are currently using), but I assume the changes are easily applicable to PIXI v5 (I can do that as well, if you want the backward-compatibility)

ivanpopelyshev commented 5 years ago

@Ashden Please look in the README - https://github.com/pixijs/pixi-spine#pixi-spine

3.8beta branch is outdated.

3.8 has changes in IK and animations too, im not sure that they are not breaking.

When there were breaking changes between spine3.2 and 3.3 I also wondered whether i can make universal JSON import. The answer was "yes, but i dont want to support it in future".

Here is the same - there are already enough pixi-specific changes in runtime, and if I add some in JSON importer i'll take responsibility for it . I'm not sure that I'll be able to maintain them in future.

Ashden commented 5 years ago

@ivanpopelyshev If your plan is to only use the latest Spine implementation and use the same strategy as they do (which is the obvious and natural choice), then yes, I fully agree with your decision. That being the case, I guess I can maintain a backwards-compatible version until all our projects get up to date with Spine 3.8, then we can move on your stable build for it.

PS: Just for kicks, I applied my patch on pixi4-spine3.8 and it's still working 😄

ivanpopelyshev commented 5 years ago

ok, give me the patch, just in case ;)

ivanpopelyshev commented 5 years ago

Of course I can make spine runtime much better than official, but.. ugh.. i have too many pixijs plugins on me :) need to stop sometimes. And badlogic might look at me funny, I dont want to undermine his authority on whats good for spine users.

Its better if I put more effort in publishing GPUPATCH again, it affects performance when people use big number of spine animations with deformed meshes.

Ashden commented 5 years ago

backward-compatibility_to_3_7.patch.zip

I have the issue with many spines with deformed meshes too, so I'd like a fix for that 😄

ayanguptapcg commented 5 years ago

Hi, I am trying to move to pixi 5 and spine 3.8.72. I have a very basic spine file and it is not working. Can someone please look into my files and see where I am wrong. This is very urgent as we are going to start a big game and we have already made a lot of animations using spine 3.8.72. Any help would be really appreciated. Spine_Run_tinkered.zip

ivanpopelyshev commented 5 years ago

@ayanguptapcg I'm on it . Can you at least tell me how its supposed to look?

ivanpopelyshev commented 5 years ago

@ayanguptapcg i dont understand what did you put in that whip.json , how it should work. Also spineboy.json is clearly outdated so if you tried to test that too - it wont work, its like very very very old json file without skeleton section.

I think you have a problem with your exports.

You can contact me in telegram t.me/hackerham if you want to solve it ASAP

ayanguptapcg commented 5 years ago

Sorry for late reply. Here is modified file with another acutal atlas from the game. Spine_Run_tinkered.zip

ayanguptapcg commented 5 years ago

It gives AtlasAttachmentLoader.ts:43 Uncaught Error: Region not found in atlas: error

ayanguptapcg commented 5 years ago

For this error we made some change as demo file in whip atlas so atleast that was not throwing error but also does not show up anything.

ivanpopelyshev commented 5 years ago

Animated alpha is 0.03 . Any idea why?

ivanpopelyshev commented 5 years ago

nope, still nothing even if i set alpha to 1 everywhere

ayanguptapcg commented 5 years ago

are you checking the whip or mysteryDoll? I don't see animated alpha anywhere...

ivanpopelyshev commented 5 years ago

doll. i've modified atlas file of course.

ayanguptapcg commented 5 years ago

I am not able to see any alpha value in the atlas.. what should we do then? is 3.8.72 not supported? or are we doing something wrong. Can I get one 3.8 spine file which is working with the library to cross check or some hints for exports.

ivanpopelyshev commented 5 years ago

3.8 release with pixi-v5 works for everyone. Of course you are doing something different than other people. I dont know about that .72 part, i didnt look at latest-latest changes. The problem is that I cant even determine whether that wrong is a spine bug , pixi-spine bug or just you messing with files :)

ivanpopelyshev commented 5 years ago

I'll try later again, but right now I suggest to look in official runtime https://github.com/EsotericSoftware/spine-runtimes/tree/3.8/spine-ts and try to put your files in official spine widget, I remember that some people posted videos on youtube on how to do it.

If your stuff doesnt work in official widget too, then its a problem for esotericsoftware forum.

Of course pixi-spine is also official, but its one step further from editor - it has spine-ts as an upstream but it also has changes specific to pixi users.

ayanguptapcg commented 5 years ago

Thanks Ivan.. we will do that and come back to you with our finding. Thanks a lot for taking this up.

ivanpopelyshev commented 5 years ago

Hold on, im picking up something strange on my side.

ayanguptapcg commented 5 years ago

ok.. fingers crossed

ivanpopelyshev commented 5 years ago

I published new version with a few changes that i picked from , but it doesnt help in your case.

The bigger problem is: https://pixijs.io/examples/#/plugin-spine/dragon.js is for spine 3.7 , and I dont have ANY examples that run with pixi in 3.8 on this computer. I cant test anything. I dont even know whether current version works at all on demo files.

It seems that I forgot to update examples from my other computer. I'll do it in a few hours, but right now I cant test anything :(

ayanguptapcg commented 5 years ago

I just ran a test with the runtime and it does not load there. I tried both. Whip loads but does not show any animation and doll does not load at all. will try with some more atlases.

ivanpopelyshev commented 5 years ago

Heh, then you have to bother guys from esotericsoftware :) I certainly need more info to help you, maybe later.

ayanguptapcg commented 5 years ago

I just found something that the json is having two skins. Though we have one called general in our spine software but when created it creates skins as an array and adds an default skin. So in the player if we change the skin manually by clicking the menu we can see the animation. Any idea how to set the skin by default to general.

ivanpopelyshev commented 5 years ago

use setSkin, i guess :)

ayanguptapcg commented 5 years ago

Thank you Ivan..