• Editor
  • Looking for centered exporting

  • Editado
Related Discussions
...

Hey there,

First of all, I have to say: I love spine, it covers all the features I've always been dreaming of.

As I am just getting started with this wonderful tool, I'm not sure if there is already a possibility to export animations to png, jpg and gif files with the root node centered in the actual frame.
I need something like an "export with mirrored bounding box"-button, so the sprite edges get cropped symmetrically.
My Workaround at the moment:
I use a large transparent image as a child of the root node, where the root node is at the bottom center of the image, but this produces huge file sizes.
Is there any other way or would it be easily possible to implement a feature that allows mirrored cropping?

Spine currently outputs as small as possible images. Centering the root in the image would do the same as using a large transparent image. The large transparent image is fine, just use texture packing to strip off the whitespace.

Thank you for helping, Nate.
I messed around with the built-in texture packer, but it does not seem to solve my problem.

I need to export the Animations into single frames, each frame as a separate png file.
Stripping all the whitespace off the centered character in the large transparent image leads to the minimum size again (green box in the attached image).
Symmetrical cropping would lead to an output image like the pink box in the attachment.
This is what I need (some kind of "strip whitespace x mirrored relative to root"), because that way the information of the root position could be kept, but I have no idea how to do that.

Spine uses the smallest image that fits an entire animation. This is the problem:

Image removed due to the lack of support for HTTPS. | Show Anyway

The X is the origin (0,0) in Spine. You need to know the position (in red) of this in your image, so you have a reference point to position your image. Each animation is likely to move differently so the export will be a different size and you'd need to record the origin offset for every animation sequence.

Use a large transparent image in Spine to force a specific exported image size so it doesn't change per animation sequence. This way you always know the origin position. Your transparent image should be larger in every direction from the root than any attachments during all your animations.

Once you have that, you can use Spine's texture packer to strip whitespace. At runtime the atlas provides the number of pixels that were stripped, so you can draw your images in the correct place.

The large transparent image is just what I do at the moment.
It is centered, so the X is always at image.width/2.
The game engine I am working with is Adventure Game Studio, and it does not support the atlas.
Also, to keep things compatible for every kind of engine, I try to stick to only image files, so the animations can be used by everyone.
As an artist and animator, I am planning on selling some animated characters (did them with Skeleton 1.1 before, a very old tool you may know), and I think, simple png files are best for that purpose.

My combined workaround at the moment:
The large transparent image stores the offset, then I duplicate all the frames and batch flip them with Image Magick, afterwards I crop them with SmartCropper and then delete the flipped ones.
That is quite slow, but it works.