Jump to content

One atlas many json for spine


Recommended Posts

I want to use one atlas for many spine animations in my game.

I found the way how to do it with loader. I am loaded atlas with game loader (name other.atlas) and got in game.loader.resources.other. Then i am trying to load json file of my animation from console.

otherLoader = new PIXI.loaders.Loader()
spineLoaderOptions = { metadata: { spineAtlas: 'game.loader.resources.other' } };
otherLoader.add('someJson', 'static/img/content/fullHD/machine/elements/testJ.json', spineLoaderOptions)

But it will not work. Loader still wants to load atlas with name of my json.

GET http://localhost:3004/static/img/content/fullHD/machine/elements/testJ.atlas 404 (Not Found)

I think it is because of atlas parser . I need varibale "pages" in my metadataAtlas, but there is no pages.

How atlas data looks like in console.


I am doing something wrong and i dont know what.

Link to comment
Share on other sites

You have to create "PIXI.spine.core.TextureAtlas", and use this method: https://github.com/pixijs/pixi-spine/blob/master/src/core/TextureAtlas.ts#L74 . Then pass it to the loader.

Something like https://github.com/pixijs/pixi-spine/blob/master/examples/dynamic_texture_atlas.md , but you can just pass "resources['myAtlas'].textures" to addTextureHash.

Btw, I'm working on automatic runtime atlas at the moment.

Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...