• Editor
  • Issues with texturepacker and cocos2d runtime

  • Düzenlendi
Related Discussions
...

Hi,

I just bought the license and started using it in my cocos2d environment. Pretty excited with what I have seen so far. I am having the following issues, would be great to hear from you:

  1. If image-names are of the format "<img-name><number>", the texturepacker saves atlas region as name=<img-name>, index=<number>. Spine run-time doesn't understand this and attempts to looks for a region with name "img-name_number" ignoring the index element. This fails with "unable to find region" error. I modified the Atlas.c/Atlas_findRegion function to have the logic to consider index as part of the name:

            if (region->index > 0)
                sprintf(name2, "%s_%d",region->name, region->index)
    

    This is working for me, but I am not sure if this is the right thing to do. I can't change the naming convention of the images as it affects bunch of other things. I don't see any settings on texturepacker to force it use the full image names instead of creating index value.

  2. The animation is working only if I disable "rotation" during texture-packing. This makes the sprite sheet larger than necessary. So spine can't work with texture atlas with rotated images?

  3. Is there a way to add multiple images at once to a slot in the Spine GUI tool? I would like to add 10s of images to a slot (say the wing of a flying bird that keeps changing every few frames) but I am forced to add one image at a time.

Cheers!

1) You can use this texture packer:
https://code.google.com/p/libgdx/wiki/TexturePacker
It has a "useIndexes" setting you can set to false.
https://code.google.com/p/libgdx/wiki/T ... r#Settings
If you are using Texture Packer Pro from texturepacker.com then I would ask the author to add a setting for you.

2) spine-cocos2d-iphone does handle rotated regions in an atlas. Make sure you have the latest Texture Packer Pro, there used to be a bug with it.

3) No, you need to add them one at a time. Adding the image defines the attachment offset SRT. If your images are the same size then you will be saved some trouble when this feature is implemented:
https://trello.com/card/drop-image-on-a ... c0059d9/18

Nate yazdı

1) You can use this texture packer:
https://code.google.com/p/libgdx/wiki/TexturePacker
It has a "useIndexes" setting you can set to false.
https://code.google.com/p/libgdx/wiki/T ... r#Settings
If you are using Texture Packer Pro from texturepacker.com then I would ask the author to add a setting for you.

Thanks Nate. Using the libgdx texturepacker solved the index problem. Just posting an update in case it helps others.

I switched to the libgdx texturepacker. The GUI tool returns error if I use "useIndexes" in the pack.json settings file. Other settings work fine but if I add "useIndexes: true (or false)" setting, it gives an error:



---

 Starting TexturePacker for pack '*****'


---


[error] Exception occured: Error packing files.

I switched to the command line version:

java -cp gdx.jar:extensions/gdx-tools/gdx-tools.jar com.badlogic.gdx.tools.imagepacker.TexturePacker2

and the same folder with same pack.json setting file worked as expected.

Glad that worked for you. I didn't write or support the GUI version of my texture packer. Looks like it is out of date. My opinion is that texture packing is a command line thing, and one of the innovative things my tool does is used file naming conventions and subfolders to make a lot of configuration obsolete. They other cool thing it does is using the JSON files for further configuration. Note the pack.json files inherit everything from the parent folder(s) pack.json files.