Thursday, 6 December 2018

Export From DragonBones To Spine

DragonBones has an export option where you can output a spine json, spine atlas and spine texture.

With these files then you can import the character from DragonBones into Spine. At least that is the idea.

BUT ...

It doesn't work 100% without any issues. I'll demonstrate it via one of DragonBones sample project.
dragonbones sample project


This is the demon sample project. Assume we want to export it into Spine. All we have to do is to headover to export window, choose spine and hit finish.


export window with spine data format


Here are the outputed files. Fine.
3 files

Now let's import these files into spine and see what we get.

missing images

Why are the images missing?  We have everything right there?
Taking a closer look on the image path inside spine we get to understand that spine expects separated images not a texture spritesheet. So that is the problem.

Solving The Issue


What you can do to solve this issue is to unpack the spritesheet. Luckily Spine has an option for that. Go to file > Texture unpacker

Textur Unpacker in spine
You will be prompted with this window. Here you have to choose the atlas file which was included in the DragonBones export. Hit Unpack.

You should see the entire texture sheet unpacked into separated layers afterwards.

unpacked texture sheet.
When you then return to spine

fixed project
you will see that the missing image is fixed and you have successfully imported your character from DragonBones into Spine.


Umm that's fine. Why we don't simply export as images instead of a texture spritesheet in DragonBones like this?


image sprites instead of texture sheet

That's actually easier.. if it worked as it is supposed to be. If you choose Images as Image Type and not the texture atlas option DragonBones will output all the images in a folder and a spine json.
However when you try to import this spine json into Spine you get an error


Error loading spine json

The dialog says that there was an error loading the json file due to the file being invalid.


As you have seen the Spine Export from DragonBones works but it works with a work around for now. Whether Spine fails to load it's data correctly or DragonBones fails to export in the right format is out of my knowledge.

No comments:

Post a Comment