- Modifié
[solved] Problems with runtime after update
- Modifié
After an update some of my old projects don't work in runtime:
04-16 15:12:23.545: E/AndroidRuntime(30047): java.lang.IllegalArgumentException: Attachment not found: , for slot: r-item
04-16 15:14:34.730: E/AndroidRuntime(1126): java.lang.RuntimeException: Region not found in atlas: gu-cape (region attachment: gu-cape)
04-16 15:14:34.730: E/AndroidRuntime(1126): at com.esotericsoftware.spine.attachments.AtlasAttachmentLoader.newAttachment(AtlasAttachmentLoader.java:57)
04-16 15:14:34.730: E/AndroidRuntime(1126): at com.esotericsoftware.spine.SkeletonBinary.readAttachment(SkeletonBinary.java:171)
04-16 15:14:34.730: E/AndroidRuntime(1126): at com.esotericsoftware.spine.SkeletonBinary.readSkin(SkeletonBinary.java:160)
04-16 15:14:34.730: E/AndroidRuntime(1126): at com.esotericsoftware.spine.SkeletonBinary.readSkeletonData(SkeletonBinary.java:126)
04-16 15:14:34.730: E/AndroidRuntime(1126): at magory.heroes.MaAnimatedPhysElement.loadAnimations(MaAnimatedPhysElement.java:122)
(the region gu-cape is of course present in the atlas I provide)
I load the skeletons like that:
SkeletonBinary sb = new SkeletonBinary(atlas);
skeletonData = sb.readSkeletonData(Gdx.files.internal("anims/"+name+".skel"));
Have you exported with the latest version of Spine? You should run on the desktop as it makes debugging easier. It only says it doesn't find a region if it isn't in the atlas...
Yes, the latest.
The first problem with attachment "," - I've uncommented the throw for now (it's posibble that it is one of those very old projects you converted to me once from a very old version of spine, maybe there is some wrong attachment still).
The second problems was easier to solve - I modified line 55 in AtlasAttachmentLoader:
AtlasRegion region = atlas.findRegion(attachment.getName().trim());
Apparently there is space or sth in the attachment name and trim removed it... (after thought: maybe the first problem is similar? maybe attachement has empty string, but not null as a name?)
If you want the projects, they are here:
http://s.wieze.org/knight7.project (first problem)
http://s.wieze.org/guard.project (second problem)
Unlikely trim fixes it, I don't see spaces in the data. I also don't see what would cause the first error in the data.
I exported both projects and tried all the animations (and there are 20+). Works fine. I'm afraid you are going to have to do more debugging on your own before calling in for my help. First fix your Java project setup.
OK. I've found the cause of both problems:
Ad. 2. The "Region not found" problem - while adding trim I've also changed throw to log and it masked me loading animation twice, first with wrong atlas (apparently it was not causing a crash in older versions or got uncommented while I updated the code to match newer runtime).
Ad. 1. It crashed on r-item attachement which has empty attachementName in function setAttachment in Skeleton.java after loading - to set empty attachement I followed your (or Shiu) advice and used setAttachment("r-item", "") to make the knight have empty hand (null crashed the old version, apparently right now you have to use null instead of empty string).
Not related to Java project setup as you can see, just one bug in my code and one change in spine runtime. Feel free not to answer and ignore my posts if you don't have time - I post it so other users can answer if they had similar problems while at the same looking for an answer myself (and now everything is stable with Spine in my project, so expect a long silence until the next big update ).
I don't have any problems helping you or anyone else, I just ask that you do the necessary reconnaissance to make the best use of my time. Glad you got things working again!