• Editor
  • Spine editor vs coronasdk runtime issue with images

  • Modificato
Related Discussions
...

Hey Nate,

As ever, thanks for a real productivity boosting tool, loving it most of the time.

Ok, here's the issue (in laypersons terms). We have created a spine project that is fairly similar to the SpineBoy project using our own ragdoll. Having defined all the slots and attachments, we discovered that some of our images required edits in order for them to sit on the bone as planned. This varied between folder sets of images but once done, the different sized images all sit perfectly on the bones when flipping the images folder. So far so good and exactly as we'd hoped.

However, on exporting the spine json for use in coronasdk, we are finding that the images are not being placed onto the bones (position wise) as they had been inside the GUI editor. We are seeing some torso sections floating into the head section and upper arm sections floating out to the side of the body. Now, I completely understand how this could happen due to the images being different dimensions. However, the fact that they worked inside the GUI, led me to believe that the behaviour would follow when we used the exported json inside corona and changed the images on the slots as required.

Is there some magical property setting that the developer needs to set in order for the images to work in the same way as they do in the GUI?? We don't want to go down the road of mapping different image sizes to the spine json on an adhoc basis, as we literally have 100's of images to work with.

I hope I have explained our predicament clearly and equally hope these is a 'one liner' to solve our woes.

Thanks again for making animation interesting again.

All the best
jim

It should display at runtime exactly as it does in the editor. However, there is a caveat when using Corona. Are you using non-uniform scaling? This means x and y are not scaled the same amount. A rhomboid (diamond) shape for images occurs when the attachment offset rotation is not aligned with the bone and non-uniform scaling is applied:

Immagine rimossa a causa della mancanza di supporto per HTTPS. | Mostra Comunque

Some game toolkits (like Corona) cannot draw rhomboids/quadrilaterals, they can only draw rectangles. For these toolkits, you can just avoid using non-uniform scaling in Spine, or if you do then make sure that your images are aligned with the bones. An easy way to do this is to click the Parent button, then set the rotation to 0, 90, 180, or 270.

If this is not the case, please attached (or email contact@esotericsoftware.com) a zip of the .spine project file and images so I can reproduce the problem.

Hi Nate,

Thanks for the reply. Funnily enough, quite a few of the alignments are exactly as you describe, therefore, may be an issue. I have however, taken the liberty of emailing you the zip file of the basic project and two typical example folders of images. Hopefully, you'll see the problem 1st hand and be able to impart further advice if required.

Once again, thanks for your time and effort, both in terms of development and the extra mile you go in your support duties.

All the best
jim

Thanks. I replied to your email. It seems to render fine with Corona for me.

The project looks fine, except it isn't very flexible to switch how a skeleton looks by swapping the images. Doing this is ok, but means all the images must be the same size. Using a transparent image for images you don't want to show can eat your fill rate, which could be an issue if you target mobile. An alternative way to do it is to use skins. See the skins video for details.

Hi Nate,

I think I suddenly get what's maybe happening under the covers. IF I save a json file, it's using the current attached images to determine the x,y width/height. Therefore, when I change the image folder in the GUI, this process is automatically run against the new images and displays fine inside the said GUI. Therefore, my one shot json, saved against an arbitary image folder, is ONLY good for that set of images. Therefore, a 2nd save of the json would produce different results for the json, after changing the image folder -am I Correct??

If so, this will explain the problem. Also, this leads me to ask a further question, 'what is the best way to achieve dynamic image swapping whereby some fragements are replaced and others remain with the previous selection' (so in my scenario, I may select a suit to dress the character, but will want to change the torso section to a tshirt, by replacing only the torso, and torso-arms-* sections). This is the crux of our current dilemma.

As ever, hope you can..

Cheers
jim

Yes, if you are not using the same images that were used in Spine they must be exactly the same size. You can define attachments programmatically, but the difficulty is defining the attachment offset relative to the bone. When placing an image in the editor, you define this offset per image. So, in the editor you attach all your images, then at runtime you can hide/show any of these images as you wish.

You may want to use the skins feature:
http://esotericsoftware.com/spine-videos/
Using skins is necessary if you are going to key image changes during animations. If you aren't then you don't need to use them, though you still can if you want. Eg, maybe you have a skin for each piece of clothing made up of multiple images (a shirt made up of torso, left arm, right arm images). At runtime you would combine multiple skins (based on what the character is wearing) into a new skin and use that for your character. This would be solely for organization, you don't have to use skins if you don't key image changes. Currently the editor only allows a single skin to be visible, so it would be hard to visualize in the editor.

This may be interesting to you:
viewtopic.php?f=3&t=618&p=2750&hilit=share#p2750

un anno dopo

Hi nate,

Pls have a look at this topic viewtopic.php?f=9&t=2379&p=11705#p11705 and leave a reply.


Hi nate,

pls update the spine as soon as possible . Corona has updated many features , pls update the spine according to that . i know you would be busy with your work ,but pls try to update . 😢 😢 😢

Thanks,
Kumar KS.