Jump to content

One atlas to keep all imfromation of spine and json


max0805
 Share

Recommended Posts

I already read this topic https://www.html5gamedevs.com/topic/32522-one-atlas-many-json-for-spine/

and I following the anwser, and can not find the solution.

I want to using one atlas to manage all json.

I want to manage json by one atlas so I wrote this code.

 

But it show me like this https://imgur.com/a/jITTg4w

 

Looks I just make a dynamic atlas. How do I using one atlas to contain all spine information?

 

 

slot_1601_TEST.7z

Edited by max0805
Link to comment
Share on other sites

This is how pixi-spine loader works: https://github.com/pixijs/pixi-spine/blob/master/src/loaders.ts#L29

 

This was the attempt to fix the single atlas issue but I dont like it so i didnt merge it https://github.com/pixijs/pixi-spine/pull/281

Unfortunately, many people are struggling with this particular issue. I thought that community can deal with it, but it looks like it cant :(

I'm the only one who can actually fix that and patch pixi-spine, but I'm very nervous about, I just had a panic attack.

Please understand me and either 1. wait when I'm ready to fix it 2. do it yourself and save pixi-spine.

 

Link to comment
Share on other sites

thank to reply  , I just want to make our file smaller as soon as possible.  Our artist say he can make one atlas to manage all json and spine so he say that may using in pixi.js. 

I know you need to fix a lot of new issue, cos this awesome plugins is too much user maybe you can pointer a way to using hard code fix this issue.

 

Edited by max0805
Link to comment
Share on other sites

Options

1.

Take https://github.com/pixijs/pixi-spine/pull/281/files , apply it to latest pixi-spine, rebuild it.

Add your atlas file in loader first, it should work. specify "PIXI.loaders.useMasterAtlasData=true"  - that's for atlas itself. For image you have to specify imageLoaderAdapter for it, maybe through Texture.from()

If it doesnt work - debug.

2.

Use same atlas file for all json files, just copy it many times. But for image use your own imageLoaderAdapter. That way texture regions will be copied many times but bitmap data will be loaded&stored only once.

 

 

If you want real solution - wait for weekend :)

 

 

Link to comment
Share on other sites

Actually, everything is easier. One person just gave me this:

See the line about metadataAtlas https://github.com/pixijs/pixi-spine/blob/0e0431a81b2a061a872730b2cd6f7fa83413763b/src/loaders.ts#L66

We can load one main spine skeleton that has atlas with everything, then load others with same atlas. In that case you need json/atlas/png file and not just "test atlas/png" you made.

preLoader.add('mainSpine', 'img/main.json');

preLoader.load(() => {
  const options = {
      metadata: {
          spineAtlas: preLoader.resources.mainSpine.spineAtlas
      }
  };

  loader.add('hello', 'img/Cherry.json', options);
  loader.add('hello2', 'img/Bell.json', options);

  loader.load(onAssetsLoaded)
});

function onAssetsLoaded() {
//...
}

I put it here: https://github.com/pixijs/pixi-spine/blob/master/examples/single_atlas_multiple_models.md

Edited by ivan.popelyshev
Link to comment
Share on other sites

Can I have a official solution for this. My javascript not very well. 

Debug spine loader. Even with official solutions you will have to do it.

Please make minimal demo with the approach i mentioned that doesnt work for you and i'll fix it, no need to publish your actual spine files, but you need to make the same exact situation: two spine models+atlases and one model+atlas that has ALL attachments in it. Or, alternative, texturepacker atlas with all attachments.

Edited by ivan.popelyshev
Link to comment
Share on other sites

I can not using the same way make what I want to do.

I see my project when I using PIXI.Loader add json and using add() to add my json then load.

It will give me the spineData in loader.resources.spineData when load finish .

But when I using your way I can not take this property. They is a similary names data. But when I using it they will say   "Cannot read property 'children' of undefined"

 

This is my code example.

Please check pixiatlastest.html 

line 47 and 58.

mytest.rar

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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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