d13 Posted November 28, 2019 Share Posted November 28, 2019 Hi Everyone, Another Spine question: Is it possible for many Spine animations to share one texture atlas? For example, I have some animations that look like this: animationOne.json animationTwo.json animationThree.json My atlas and PNG look like this: myAnimation.png myAtlas.png I basically need my three animations to share the same .png and .atlas files I have read this, https://github.com/pixijs/pixi-spine/blob/master/examples/reuse_texture.md, but I'm not sure whether it applies to this use case..? (If it does, please let me know!) Thank, you! Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted November 28, 2019 Share Posted November 28, 2019 (edited) That's something I can clarify. Yes, it applies to your case , and that's one of the ways to do it. Another is to load json's without spine loader, and manually create all SpineData's passing the same atlas around. The problem is that there's no way to specify loader API to NOT use particular loader, and I really don't want to explain how to hack it because, well, its better to spend that time later on actual loader patch. Edited November 28, 2019 by ivan.popelyshev Quote Link to comment Share on other sites More sharing options...
d13 Posted November 29, 2019 Author Share Posted November 29, 2019 Thanks Ivan! I'm having a little trouble understanding how this might work. In this example... var atlasLoaderOption = { metadata: { imageNamePrefix: 'spineAtlas_' } }; PIXI.loader .add('flyingAnimation.json', spineLoaderOptions); .add('walkingAnimation', spineLoaderOptions); .add('anotherAnimation.json', spineLoaderOptions); ... will my JSONs need to have the same root name for them to share the single atlas and png? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted November 29, 2019 Share Posted November 29, 2019 (edited) You need the same name of atlas inside those "json" files. There's nothing to understand before you actually run it - then you get result, debug it, understand whats went wrong. There's no theory in loaders, they all have hacks to support several ways people use. If new way is discovered - its added in loader and in docs. I really hope that someone will make alternative loader that wont be that hacky. Edited November 29, 2019 by ivan.popelyshev Quote Link to comment Share on other sites More sharing options...
d13 Posted November 29, 2019 Author Share Posted November 29, 2019 Thanks Ivan... just digging around my files, there doesn't seem to be a reference to the .atlas in the spine .json files. Do you mean the reference to the .png in the .atlas file? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted November 29, 2019 Share Posted November 29, 2019 (edited) Yes, probably that png file. As the reuslt, it will have different set of Texture's but same BaseTexture. Edited November 29, 2019 by ivan.popelyshev Quote Link to comment Share on other sites More sharing options...
d13 Posted December 2, 2019 Author Share Posted December 2, 2019 Just for reference, I finally managed to get this working by duplicating the atlas files for as many JSON files as I have (15), giving them the same name as the JSON, and pointing the atlas to the same single PNG file. I'm getting the error message, "BaseTexture added to the cache with an id [assets/animations/observation/observation.png] that already had an entry", but I can live with that for now. If I find a better, less hacky, way to do this, I will report back ? 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.