MouseCaneta Posted January 2, 2018 Share Posted January 2, 2018 I'm trying to load an atlas created with TexturePacker using: PIXI.loader .add("game", "assets/sprites/game.json") .add("ui", "assets/sprites/ui.json") .on("progress", loadProgress) .load(setup); But for some reason pixi seems to be indexing the loaded assets by incremental numeric id instead of using the labels contained in the respective json files. Because of this I'm getting index collision when loading more than one atlas. Anyone know why? Another question, how hard it is to write a custom loader. I'm trying to import animations from ToonBoom which uses a specific xml format. I want to load it automatically as with the TexturePacker atlas. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted January 2, 2018 Share Posted January 2, 2018 There was an issue about indexing but didnt give any details on it. Your issue also does not contain any necessary info to replicate it. You can look at https://github.com/pixijs/pixi.js/blob/dev/src/core/textures/Spritesheet.js#L158 , "i" is certainly a key and not an index. JSON parser is inside Spritesheet class, you have to do your own Spritesheet and loader for it, its not a big deal comparing to creation of your own renderer plugin or a filter Quote Link to comment Share on other sites More sharing options...
MouseCaneta Posted January 2, 2018 Author Share Posted January 2, 2018 Found out what the problem was about the indexing, seems like the exported atlas I was using was published in the Phaser format instead of the Pixi one. I knew that actually, but I wrongly assumed they would be the same since Phaser uses Pixi. Are there any guidelines for writing custom loaders? Anywhere I can read about? ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted January 2, 2018 Share Posted January 2, 2018 Pixi using this lib: https://github.com/englercj/resource-loader , you can pester @xerver about examples No, actually, its easier to just look up the code and do the same thing. https://github.com/pixijs/pixi.js/blob/dev/src/loaders/spritesheetParser.js Just make a middleware and use() it, you have to submit a function that processes resource. SpritesheetParse is a factory that returns that kind of function, please make sure you understand that you need submit a function and not the factory 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.