palanolho Posted November 20, 2020 Share Posted November 20, 2020 hey guys, I've recently updated to spine 3.8.0 and my spine work stopped to work and throes a "Cannot read property 'Spine' of undefined" This is what I have on my code: //... const pixiLoader = PIXI.Loader.shared; pixiLoader .add('spineChicken', 'images/spine_animations/Chicken.json'); //... var anination = new PIXI.spine.Spine(pixiLoader.resources.spineChicken.spineData); I 'm using pixi JS 5.2.0 I have the pixijs-spine.js v 3.8.0 included in my project (downloaded from https://github.com/pixijs/pixi-spine) The code was working before (I'm just trying to update the pixi JS and spine versions) I checked the resources after they load and I can see the "spineChicken" is in the data structure It looks identical to the examples on git and on the pixiJS website, so i0m understanding why this error Any ideas? Many thanks in advance. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted November 20, 2020 Share Posted November 20, 2020 (edited) > "Cannot read property 'Spine' of undefined" does PIXI has "spine" property? if not, make sure that pixi-spine.js is loaded. If you dont know how to do it - look in devtools network tab, look if it was actually loaded. if its loaded - look if it actually has same contents than pixi-spine.js, it might get screwed by your web-server. Why am I that sure that "PIXI.spine" cant be undefined? Because of this line: https://github.com/pixijs/pixi-spine/blob/master/dist/pixi-spine.js#L8742 Its set there. Please place breakpoint there and see if its actually called. What can also go wrong? Someone can override PIXI global var after spine was loaded. Check if it happens. If its not enough, you can zip everything and send it to me to check whats wrong. Edited November 20, 2020 by ivan.popelyshev Quote Link to comment Share on other sites More sharing options...
palanolho Posted November 20, 2020 Author Share Posted November 20, 2020 @ivan.popelyshev I did as you suggested and I see the the spike library being loaded and I can step into it. but I still get the same thing I'm attaching an example as you requested so that you can see the problem in action. Many thanks in advance. test-spine.zip Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted November 21, 2020 Share Posted November 21, 2020 Good Anyway, I uncommented "add('Chicken" line and got this in console: SkeletonJson.ts:60 PixiJS Spine plugin supports only format for Spine 3.8. Your model has version 3.6.53. Please look in pixi-spine repository README for another branch. I put this notice in pixi-spine because people often use exports from different spine versions, and then report bugs. Chicken is 3.6, spineboy is 3.3. Both should be loaded in 3.7 version, probably, this branch: https://github.com/pixijs/pixi-spine/tree/pixi5-spine3.7 Quote Link to comment Share on other sites More sharing options...
palanolho Posted November 21, 2020 Author Share Posted November 21, 2020 (edited) Tries to switch to Spine 3.7.0 as you suggested (but still using PixiJS 5.3.3) but it seems it still doesn't work. Sometimes I get the same "spineData not found other times it takes a lot if time to load and end up with this error: GET http://localhost:8000/spine_animations/Chicken.atlas net::ERR_EMPTY_RESPONSE Resource.js:676 Tried to downgrade to PixiJS 4.4.5 (as suggested on the pixijs-spine 3.7) but i'm getting other errors Spine.ts:14 Uncaught TypeError: Cannot read property 'prototype' of undefined at Spine.ts:14 at Spine.ts:704 I tried all combinations for Pixi JS and Pixijs-spine and still the same thing Don't know what else to do Edited November 21, 2020 by palanolho Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted November 21, 2020 Share Posted November 21, 2020 > Tried to downgrade to PixiJS 4.4.5 ( Where did you find this advice? ... can you just re-export your spine models? Quote Link to comment Share on other sites More sharing options...
palanolho Posted November 21, 2020 Author Share Posted November 21, 2020 its what is says on git, no ? I don't have access to a Spine key anymore. I'm looking around to see if there is anyone that could get the files and export them again in a newer version of Spine. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted November 21, 2020 Share Posted November 21, 2020 (edited) I gave you link to specific branch https://github.com/pixijs/pixi-spine/tree/pixi5-spine3.7 I tried it, changed "fighter_1" to "spite_char" and got this: the branch is named "pixi5-spine3.7". It works. I'm the one who does almost everything in this repo. Its too much time for me to manage releases, so releases are old, and if release says "this version shoudl work with pixi4" - yeah, probably it should, but that doesnt mean there's no pixi5-spine3.7 . I dont understand why did you think that 4.4.5 is the latest pixi v4, the latest v4 is 4.8.9 > I don't have access to a Spine key anymore. If you ask esotericsoftware guys, the first thing they'll ask whether you have a license Edited November 21, 2020 by ivan.popelyshev Quote Link to comment Share on other sites More sharing options...
palanolho Posted November 21, 2020 Author Share Posted November 21, 2020 did you use the exact files I sent you with the correct version of the spine you mentioned? I downloaded the files from here has you requested: https://github.com/pixijs/pixi-spine/tree/pixi5-spine3.7/bin and fixed the "fighter_1" to "spite_char" (as you did) But I still get the "Cannot read property 'spineData' of undefined" error... why ... May I ask if you could zip your working version and send it to me so that I can try it? I'm starting to think it' my PC or something like that PS: really appreciate the help you are providing me and i'me happier to know that the files I have are still good and working. Apologies for any headache i'm giving you regarding this :S Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted November 22, 2020 Share Posted November 22, 2020 Yes, that's a good idea. I'm used to people being butterfingers, because i'm of the same kind;) test-spine-working.zip Quote Link to comment Share on other sites More sharing options...
palanolho Posted November 22, 2020 Author Share Posted November 22, 2020 (edited) Ok, 2 things that happen: 1) I add to add the "pixi-spine.js.map" because it was complaining that could not find it and was not loading because of that (Is it supposed to work without it?) 2) i'm getting a pending loading the atlas file (?!) and because of that it's not loading. If I wait a long time, eventually it fails to load and I get error (see attached screens) Apart from the "...js.map" i'm using exactly what you sent me. Edited November 22, 2020 by palanolho Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted November 22, 2020 Share Posted November 22, 2020 Works for me. What webserver do you use? If its not something basic like npm http-server , you have to add "atlas" file extension with "text/plain" mime/type Quote Link to comment Share on other sites More sharing options...
palanolho Posted November 22, 2020 Author Share Posted November 22, 2020 I'm using this app to create webserver: http://fenixwebserver.com/ Quote you have to add "atlas" file extension with "text/plain" mime/type How do I do that ? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted November 22, 2020 Share Posted November 22, 2020 (edited) i didnt work with fenix, i dont know ) Alternatively: there's a way to rename atlas file: https://github.com/pixijs/pixi-spine/blob/master/examples/change_atlas_extension.md Of course you're unlucky to stumble across http-server-related problems even in hello-world app Edited November 22, 2020 by ivan.popelyshev Quote Link to comment Share on other sites More sharing options...
palanolho Posted November 22, 2020 Author Share Posted November 22, 2020 It worked!!! thanks a lot Is there an easier (or as easy) way to make a webserver other than using fenix? 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.