Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ts] Multi-file atlas loading trouble #786

Closed
rpurushotma opened this issue Nov 29, 2016 · 4 comments
Closed

[ts] Multi-file atlas loading trouble #786

rpurushotma opened this issue Nov 29, 2016 · 4 comments
Assignees

Comments

@rpurushotma
Copy link

Things work fine for me when using an atlas/json that only point to one png, but when I try and run a project that has enough assets it breaks it up into multiple png sheets, I'm only able to load the first sheet but no subsequent ones (see screenshot -- Timey2.png and Timey3.png are in the same directory as Timey.png). Is there anything I need to do to add the additional files to the manager? AssetManager retrieves Timey.png in the network log, but no attempt for Timey2.png appears. In general, any console logs for errors and exceptions on asset loading would be great

spine_console

http://esotericsoftware.com/forum/Multi-file-atlas-loading-trouble-7477

@rpurushotma
Copy link
Author

These are the assets I was using incase they're relevant

spine_multi_file.zip

@badlogic badlogic self-assigned this Nov 30, 2016
@badlogic badlogic changed the title Multi-file atlas loading trouble [ts] Multi-file atlas loading trouble Dec 1, 2016
@badlogic
Copy link
Collaborator

badlogic commented Dec 1, 2016

Widgets currently don't support multi-page atlases. I'm working on a fix.

@NathanSweet NathanSweet removed the bug label Dec 1, 2016
@badlogic
Copy link
Collaborator

badlogic commented Dec 1, 2016

I've added a new WidgetConfiguration field called atlasPages. It allows you to specify all the images needed for the atlas, e.g.

new spine.SpineWidget("somediv", {
   json: "assets/spine/Timey.json",
   atlas: "assets/spine/Timey.atlas",
   atlasPages: [ "assets/spine/Timey.png", "assets/spine/Timey1.png", "assets/spine/Timey2.png" ],
   ...

Since all assets are loaded asynchronously, we can not know how many images an atlas is composed of during load time. I'm afraid this is the only way to get multi-page atlases working.

@rpurushotma
Copy link
Author

Sounds good. Right now the messages you get if you, say, don't leave a trailing slash on your imagesPath url are hard to debug. Please consider changing Widget.ts:132 from:

let atlas = new spine.TextureAtlas(this.assetManager.get(this.config.atlas) as string, (path: string) => {
      let texture = assetManager.get(imagesPath + path) as spine.webgl.GLTexture;
      return texture;
   });

to

let atlas = new spine.TextureAtlas(this.assetManager.get(this.config.atlas) as string, (path: string) => {
      let texture = assetManager.get(imagesPath + path) as spine.webgl.GLTexture;
      if (!texture) {
         console.log(`Texture from path ${imagesPath + path} failed to load, please check the file path. If you are loading multiple images from the same atlas, please see https://github.com/EsotericSoftware/spine-runtimes/issues/786`);
      }
      return texture;
   });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants