chrismweb

With 1.09, it seems to change the format enough to break the libGDX runtime with the error (even using the example files):
Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: java.lang.ClassCastException: com.badlogic.gdx.utils.Array cannot be cast to com.badlogic.gdx.utils.OrderedMap
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:113)

Caused by: java.lang.ClassCastException: com.badlogic.gdx.utils.Array cannot be cast to com.badlogic.gdx.utils.OrderedMap
at com.esotericsoftware.spine.SkeletonJson.readSkeletonData(SkeletonJson.java:63)
at com.esotericsoftware.spine.MixTest.create(MixTest.java:37)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:127)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:110)
Old format:
"bones": {
"root": { "length": "0" },
"hip": { "parent": "root", "length": "0", "x": "0.64", "y": "114.41" },
"left upper leg": { "parent": "hip", "length": "50.39", "x": "14.45", "y": "2.81", "rotation": "-89.09" },
"left lower leg": { "parent": "left upper leg", "length": "49.89", "x": "56.34", "y": "0.98", "rotation": "-16.65" },
"left foot": { "parent": "left lower leg", "length": "46.5", "x": "58.94", "y": "-7.61", "rotation": "102.43" },
"right upper leg": { "parent": "hip", "length": "42.45", "x": "-20.07", "y": "-6.83", "rotation": "-97.49" },
"right lower leg": { "parent": "right upper leg", "length": "58.52", "x": "42.99", "y": "-0.61", "rotation": "-14.34" },
"right foot": { "parent": "right lower leg", "length": "45.45", "x": "64.88", "y": "0.04", "rotation": "110.3" },
"torso": { "parent": "hip", "length": "85.82", "x": "-6.42", "y": "1.97", "rotation": "93.92" },
"neck": { "parent": "torso", "length": "18.38", "x": "81.67", "y": "-6.34", "rotation": "-1.51" },
"head": { "parent": "neck", "length": "68.28", "x": "20.93", "y": "11.59", "rotation": "-13.92" },
"right shoulder": { "parent": "torso", "length": "37.24", "x": "76.02", "y": "18.14", "rotation": "133.88" },
"right arm": { "parent": "right shoulder", "length": "36.74", "x": "37.6", "y": "0.31", "rotation": "36.32" },
"right hand": { "parent": "right arm", "length": "15.32", "x": "36.9", "y": "0.34", "rotation": "2.35" },
"left shoulder": { "parent": "torso", "length": "35.43", "x": "74.04", "y": "-20.38", "rotation": "-156.96" },
"left arm": { "parent": "left shoulder", "length": "35.62", "x": "37.85", "y": "-2.34", "rotation": "28.16" },
"left hand": { "parent": "left arm", "length": "11.52", "x": "35.62", "y": "0.07", "rotation": "2.7" },
"pelvis": { "parent": "hip", "length": "0", "x": "1.41", "y": "-6.57" }
},
New format:
"bones": [
{ "name": "root" },
{ "name": "hip", "parent": "root", "x": 0.64, "y": 114.41 },
{ "name": "left upper leg", "parent": "hip", "length": 50.39, "x": 14.45, "y": 2.81, "rotation": -89.09 },
{ "name": "left lower leg", "parent": "left upper leg", "length": 56.45, "x": 51.78, "y": 3.46, "rotation": -16.65 },
{ "name": "left foot", "parent": "left lower leg", "length": 46.5, "x": 64.02, "y": -8.67, "rotation": 102.43 },
{ "name": "right upper leg", "parent": "hip", "length": 45.76, "x": -18.27, "rotation": -101.13 },
{ "name": "right lower leg", "parent": "right upper leg", "length": 58.52, "x": 50.21, "y": 0.6, "rotation": -10.7 },
{ "name": "right foot", "parent": "right lower leg", "length": 45.45, "x": 64.88, "y": 0.04, "rotation": 110.3 },
{ "name": "torso", "parent": "hip", "length": 85.82, "x": -6.42, "y": 1.97, "rotation": 94.95 },
{ "name": "neck", "parent": "torso", "length": 18.38, "x": 83.64, "y": -1.78, "rotation": 0.9 },
{ "name": "head", "parent": "neck", "length": 68.28, "x": 19.09, "y": 6.97, "rotation": -8.94 },
{ "name": "right shoulder", "parent": "torso", "length": 49.95, "x": 81.9, "y": 6.79, "rotation": 130.6 },
{ "name": "right arm", "parent": "right shoulder", "length": 36.74, "x": 49.95, "y": -0.12, "rotation": 40.12 },
{ "name": "right hand", "parent": "right arm", "length": 15.32, "x": 36.9, "y": 0.34, "rotation": 2.35 },
{ "name": "left shoulder", "parent": "torso", "length": 44.19, "x": 78.96, "y": -15.75, "rotation": -156.96 },
{ "name": "left arm", "parent": "left shoulder", "length": 35.62, "x": 44.19, "y": -0.01, "rotation": 28.16 },
{ "name": "left hand", "parent": "left arm", "length": 11.52, "x": 35.62, "y": 0.07, "rotation": 2.7 },
{ "name": "pelvis", "parent": "hip", "x": 1.41, "y": -6.57 }
],
Seems to work for binary still, (but I need to edit the JSON each time since my texture packer doesn't include tons of subfolders when it packs, which I have to remove from the JSON)
Avatar utente
chrismweb
  • Messaggi: 135

Søren

Nate did some changes to the texturepacker so it can pack items in subfolders, might have missed something there when he did the update. If it is indeed a bug (my programming skills are pretty horrid I'm afraid), it will be fixed shortly.
Avatar utente
Søren

Shiu
  • Messaggi: 2452

Nate

Yes, 1.0.9+ changed the JSON format. You need to export your skeletons and animations again, and also updated your libgdx files to the latest Spine runtime for libgdx. The examples should be all up to date. The binary format did not change.

Instead of editing the JSON, you could fix up the region attachment names at runtime, see TextureAtlasAttachmentResolver in the libgdx runtime.
Avatar utente
Nate

Nate
  • Messaggi: 12040

chrismweb

In the spine 1.10 download, it's still showing the libGDX runtimes for 1.0.3, updated 2/1/13.

Is there a place to download the updated runtime?

Also, in "Skeleton.java" - it's using the old shape renderer in libGDX that was changed recently, just for debug drawing:
renderer.setColor(Color.GREEN);
renderer.begin(ShapeType.FilledCircle);
for (int i = 0, n = bones.size; i < n; i++) {
Bone bone = bones.get(i);
renderer.setColor(Color.GREEN);
renderer.filledCircle(bone.m02, bone.m12, 3);
}
renderer.end();
Avatar utente
chrismweb
  • Messaggi: 135

Nate

Oops! Sorry, I forgot to update the libgdx runtime! :$ I'll upload Spine 1.0.11 in a few minutes. The updated runtime will be version 1.0.4.
Avatar utente
Nate

Nate
  • Messaggi: 12040

chrismweb

Awesome, thanks Nate!
I'll try out the 'TextureAtlasAttachmentResolver' for sure. I think older Android phones had problems with LibGDX's JSON loader, and I think binary is faster, so will probably end up using that for production.


On a side note (unrelated to Spine):
I was trying out the LibGDX texture packer (on the fly), and it is convenient, and I'll probably use it to save time during development.

But compared to Andreas's, it seems to always prefer at least 2 textures, no matter if they could fit on one (even doing 4096x4096 I get 2 files, though they'll normally fit on a 2048x2048), with fast mode off. Aside from that, the only thing missing is he has a option to "reduce border artifacts", which somehow keeps the edges clean when resizing, and the option to resize (I'm working with largest scale resolution textures, and I just resize them for medium and small resolutions).

I'll be using spine a ton for the next couple weeks!
Avatar utente
chrismweb
  • Messaggi: 135

chrismweb

Thanks again Nate! Downloaded the updated runtime, seems to work! :D

There is a labeling issue in the zip- it still says 'spine-libgdx-1.0.3-source.zip', but is the 1.04, so it still works :D

Let me know if you need help testing anything in the next couple weeks, I assume you'll probably be pretty busy!

One new weird problem: in Spine 1.0.11, when I open my project, under images, it is only showing one folder from that directory, and not the one with my images in. I moved everything to a folder with only my images folder, and it found them, but for some reason it's now only finding the first folder in the directory, instead of all of them.
Avatar utente
chrismweb
  • Messaggi: 135

Nate

JSON will work on all phones, even old ones. Binary is faster of course.

You said on-the-fly packer? Are you using PixmapPacker or TexturePacker2?

Fixed zip name, thanks.

How many images do you have? If you have more than 500 images, it will stop loading. This is to prevent someone pointing Spine at C:\ and having it try to load every image on their HDD. It also only looks 5 directories deep.
Avatar utente
Nate

Nate
  • Messaggi: 12040

chrismweb

I had found, a few months before, that LibGDX crashed on pre Android 2.1 when trying to load JSON, but XML worked well.

I am usingTexturePacker2- even with width and height set to 4096, it gives me two images, 4096x512, and 4096x256, een though it all should be able to fit on one 2048x2048 with room (it just barely rolled over from 2048x1024 with some new items).

243 images in my images folder, but there are other folders in the same directory as well, a copy of that folder with out any sub-folders(so another 243), and just the examples, ect.

But right now it only loads my "backups" folder, which is just the Spine 1.08-1.11 folders, and nothing else. Although checking the properties, there are 668 files in the backups of spine (probably just in the 4 version of source runtime files).

Is there a way to change it so it only counts against you for the number of images, instead of just files? And maybe up to 1000, just in case? :S 243 images sounds like a lot, but the number one complaint for our game is "more items", so that's bound to triple..... :o
Avatar utente
chrismweb
  • Messaggi: 135

Søren

Maybe we can add a limit to the preferences dialog once we implement that. We should be able to come up with a temporary solution maybe.
Can you move your assets for now?
Avatar utente
Søren

Shiu
  • Messaggi: 2452

chrismweb

Yeah, I did- I just moved the project to it's own folder, with just the assets folder, so it's not a game breaking issue.

I hopefully won't have 500+assets for a month or so though :D

Another nice thing would be the option to save out the project file in some kind of readable format- in case you change the folder the project is in, and have to change all the assets locations (or like me, originally have them in a sub folder, and have the right side panel need to scroll left and right for everything- which would be another nice thing- being able to make that panel wider)
Avatar utente
chrismweb
  • Messaggi: 135

Nate

You should set the path in the images directory so it only needs to load images that you are going to use. The 500 limit is just images.

For TexturePacker2, maybe you have padding on and that causes some large images to not fit? If you send me your images that don't pack well, I can see if there is a bug.
Avatar utente
Nate

Nate
  • Messaggi: 12040

chrismweb

Thanks Nate for checking that out (SOLUTION: it was that each sub folder goes onto a different image, had to use'combineSubdirectories' in LibGDX).

Will there be an option later on to increase it beyond 500 images? I don't display them on the animation all at one time, but need a lot of parts for customization.

Oy, I need to find a better game people actually play without so many custom parts :-p
Avatar utente
chrismweb
  • Messaggi: 135

Nate

Yeah, if 500 isn't enough we can increase it. :)
Avatar utente
Nate

Nate
  • Messaggi: 12040

chrismweb

Yeah, I have them in their own folder, but maybe in 2-3 months I will probably have to have over 500 assets(for the one skeleton) :(
Avatar utente
chrismweb
  • Messaggi: 135


Torna a Editor