- Editado
Help with Texture packer and Cocos2d-x. Newbie
Hello, I'm very new to app development and animating but I am running into some problems with Spine. I might be doing something wrong, but couldn't find an answer on the forums. I am an independent artist making the animations and I hired a 3rd party programer to do the coding, so please excuse my ignorance in this matter.
When I export my Json animations and atlas png, I'm having problems implementing the animations in cocos2d-x. I realized that the atlas png files had different size than the .atlas file. But if I open the .atls as text and change the size to match the png, then it works on cocos2dx. Is this a bug? or I am doing something wrong.
I am using meshes, so I unclick Strip White on the texture packer. Is that right? What's strip white anyway?
I realized that on images that have a soft alpha edge, when I export the atlas with multiplied alpha, the borders become grey and dont render properly. If I unclick premultiply alpha, then the borders are fine. The file is larger but I re compressed with PNGYU software and get a reasonable size again. Does this workflow have any penalty? It definitively looks better with no premultiply, but I guess it will take longer to render in the ios right?
I think I have read that pvr.ccz is very convenient for app develpment but spine can't export this format. If I bought a license of texture packer pro, is there a way I could use that with spine and make it work?
On one animation we've done. This is what my programmer told me "I have checked boy.json file and I have found that inside "bones" directory first array there was an extra x & Y coordinate elements, when I delete them, then the animations works properly." What's this problem? is it a bug?
Thank you very much for developing such a great tool for independent creators. I truly love your software. Having so much fun experimenting and learning animation. I think it is great!
Thanks for your help.
muffunny escribió1. When I export my Json animations and atlas png, I'm having problems implementing the animations in cocos2d-x. I realized that the atlas png files had different size than the .atlas file. But if I open the .atls as text and change the size to match the png, then it works on cocos2dx. Is this a bug? or I am doing something wrong.
What is the problem? Use scale on the JSON loader:
http://esotericsoftware.com/spine-using ... s/#Scaling
- I am using meshes, so I unclick Strip White on the texture packer. Is that right? What's strip white anyway?
Yes. It removes blank pixels from the images edges.
- I realized that on images that have a soft alpha edge, when I export the atlas with multiplied alpha, the borders become grey and dont render properly. If I unclick premultiply alpha, then the borders are fine. The file is larger but I re compressed with PNGYU software and get a reasonable size again. Does this workflow have any penalty? It definitively looks better with no premultiply, but I guess it will take longer to render in the ios right?
PMA should be used for correct blending. It will look wrong in an image editor but render correctly with cocos2d-x. Search the forum for more info.
- I think I have read that pvr.ccz is very convenient for app develpment but spine can't export this format. If I bought a license of texture packer pro, is there a way I could use that with spine and make it work?
Yes, you can create your atlas using Texture Packer Pro. Choose the libgdx atlas format. I think newer versions actually have a "Spine" export format, which is the same.
- On one animation we've done. This is what my programmer told me "I have checked boy.json file and I have found that inside "bones" directory first array there was an extra x & Y coordinate elements, when I delete them, then the animations works properly." What's this problem? is it a bug?
No idea. Please post the problematic JSON.
- Thank you very much for developing such a great tool for independent creators. I truly love your software. Having so much fun experimenting and learning animation. I think it is great!
Glad you are enjoying it!
Thanks for the reply.
I'm sorry but I still don't understand some concepts. I apologize since I know these things a pretty basic:
Nate escribióWhat is the problem? Use scale on the JSON loader:
http://esotericsoftware.com/spine-using ... s/#Scaling
Well, I use scale and suffix to create two different atlas, for retina and non retina. Since scaling on the app was creating some aliasing. But the problem I see is that, let's say my skeleton name is : boy. When I export the animation, I export boy.atlas and the atlas image. boy.png, and here is the problem. boy.png size is: 2048x2048 but if I open the boy.atlas as txt, it says
"boy.png
size: 2044,2024
format: RGBA4444"
And unless I change the size to match 2048x2048, then the animation won't run in cocos2d-x
Nate escribióYes, you can create your atlas using Texture Packer Pro. Choose the libgdx atlas format. I think newer versions actually have a "Spine" export format, which is the same.
Ok, I think I got it, but not sure 100%: Is this the way?
- edit files in photoshop and use LayerstoPNG.
- Import json data into spine.
- animate
- file/export/->json (unclick atlas, so I don't create the atlas from Spine.
- Open texture packer pro. Load all the images used for animation.
- (we are using cocos2d-x) Use output "data format" LibGDX and texture format "zlib compr, PVR(.ccz)
- ?? I am using meshes, but I don't see any option to unclick strip white in Texture packer pro, but there is an option "clean transparent pixels" is this the shame as "strip white?" . Can I activate it with meshes?
One question regarding this workflow. I have two skeletons. One for character animation and one for background animations.
When I export the atlas from spine, it creates two atlases and two json files. Can I combine all the images in texture package pro and export just one atlas for efficiency? and end up with just one atlas and two json files?
If not, is there an easy way to combine two skeletons into one in spine setup mode? so I could use just one global atlas instead of several png or pvr files for each skeleton?
muffunny escribióNo idea. Please post the problematic JSON.
This is the problematic json. I see that in this json after "bones" it has an x,y coordinate, that in another json I have exported, it doesn't. Maybe I move the root with translation by mistake instead of moving the bones.
Thanks
{
"skeleton": { "spine": "1.9.17", "hash": "WaOUaZC5tx7vdQOjMteK9A22aAM", "width": 184.13, "height": 391.06 },
"bones": [
{ "name": "root", "x": 1041.62, "y": 272.61 },
{ "name": "arm animate", "parent": "root", "length": 48.29, "x": 67.55, "y": 257.9, "rotation": -115.74 },
{ "name": "arm tshirt animate", "parent": "root", "length": 35.69, "x": 73.67, "y": 259.61, "rotation": -114.91 },
{ "name": "p4_Cloth1", "parent": "root", "length": 40.55, "x": 44.28, "y": 171.21, "rotation": -75.66 },
{ "name": "p4_Cloth2", "parent": "root", "length": 41.79, "x": 37.2, "y": 169.93, "rotation": -75.74 },
{ "name": "p4_Cloth3", "parent": "root", "length": 33.93, "x": 36.04, "y": 169.92, "rotation": -80.61 },
{ "name": "p4_Glass", "parent": "root", "length": 32.53, "x": 150.37, "y": 296.6, "rotation": 142.34 },
{ "name": "p4_H_0", "parent": "root", "length": 62.11, "x": 122.72, "y": 367.33, "rotation": -115.65 },
{ "name": "p4_H_1", "parent": "root", "length": 58.94, "x": 129.79, "y": 360.9, "rotation": -116.38 },
{ "name": "p4_H_2", "parent": "root", "length": 46.75, "x": 142.65, "y": 362.18, "rotation": -121.22 },
{ "name": "p4_H_3", "parent": "root", "length": 56, "x": 110.5, "y": 369.9, "rotation": -111.48 },
{ "name": "p4_H_4", "parent": "root", "length": 45.14, "x": 150.37, "y": 364.11, "rotation": -115.99 },
{ "name": "p4_H_5", "parent": "root", "length": 60.81, "x": 130.44, "y": 370.54, "rotation": -109.51 },
{ "name": "p4_H_6", "parent": "root", "length": 58.68, "x": 156.8, "y": 359.61, "rotation": -124.71 },
{ "name": "p4_H_7", "parent": "root", "length": 58.17, "x": 117.58, "y": 384.69, "rotation": -103.29 },
{ "name": "p4_H_8", "parent": "root", "length": 93.88, "x": 109.86, "y": 355.75, "rotation": -90 },
{ "name": "p4_Shirt", "parent": "root", "length": 52.33, "x": 84.78, "y": 262.52, "rotation": -95.39 },
{ "name": "p4_Shirt_top", "parent": "root", "length": 30.81, "x": 68.71, "y": 259.95, "rotation": -113.03 },
{ "name": "p4_bananas", "parent": "root", "length": 17.27, "x": 105.36, "y": 219.44, "rotation": 135 },
{ "name": "p4_body", "parent": "root", "length": 311.21, "x": 48.15, "y": 55.88, "rotation": 73.64 },
{ "name": "p4_shoes", "parent": "root", "length": 38.96, "x": 70.64, "y": 10.46, "rotation": 128.19 },
{ "name": "p4_top_arm", "parent": "root", "length": 57.1, "x": 50.71, "y": 237.44, "rotation": -82.37 },
{ "name": "bone2", "parent": "arm animate", "length": 36.25, "x": 50.48, "y": -0.88, "rotation": 42.88 },
{ "name": "bone3", "parent": "bone2", "length": 16.43, "x": 36.96, "y": 0.17, "rotation": 0.26 }
muffunny escribióI export boy.atlas and the atlas image. boy.png, and here is the problem. boy.png size is: 2048x2048 but if I open the boy.atlas as txt, it says
"boy.png
size: 2044,2024
format: RGBA4444"And unless I change the size to match 2048x2048, then the animation won't run in cocos2d-x
Aha, this was a bug, fixed in 1.9.18. Good find, thanks!
- ?? I am using meshes, but I don't see any option to unclick strip white in Texture packer pro, but there is an option "clean transparent pixels" is this the shame as "strip white?" . Can I activate it with meshes?
Texture Packer Pro calls it "trimming". Everything else sounds good.
When I export the atlas from spine, it creates two atlases and two json files. Can I combine all the images in texture package pro and export just one atlas for efficiency? and end up with just one atlas and two json files?
Yes. You can also run the Spine texture packer separately, not as part of exporting JSON, and pack all your images in one atlas. You can also run it from the command line:
https://code.google.com/p/libgdx/wiki/TexturePacker
This is the problematic json. I see that in this json after "bones" it has an x,y coordinate, that in another json I have exported, it doesn't. Maybe I move the root with translation by mistake instead of moving the bones.
Aye, you must have translated the root bone.