• Editor
  • Skeleton Merger Tool

Related Discussions
...
5 días más tarde
              1. Skeleton Merger Tool

Recently (and in the past), there has been quite a few threads of people wanting to merge two (or more) skeletons into one. Spine allows you to create multiple skeletons in one project. Unfortunately spine does not allow you to take bones from one skeleton and copy them across to another skeleton. Spine also restricts copying key frames, in that you can not paste key frames to another skeleton.

I bring to you, Skeleton Merger Tool!

Download(beta)

What does it do?
The Skeleton Merger Tool (SMT) will take two Spine skeletons and merge them into one skeleton.

Can't I Do This My Self... Why should I use this tool?
Sure you can! Lots of cases it can just be copy/paste of one json into another. The problem comes with meshes however, rearranging vertices would be pretty time consuming and annoying. (see next question)

Why isn't this officially supported by the Spine editor?
My best guess is that this could potentially take A LONG time, remapping vertices is probably the most expensive operation. Each vertices in SkinnedMeshs (mesh with weights) is tied to a bone ID, and the bone ID is related to the position of the bone in the bone list. As you are adding new bones to that list, all of those vertices bone ID need to change. And to make things worse those bone IDs are deeply nested in data types. Also Spine would need to deal with name conflicts on animations, bones, skins and slots.

If Spine supported this, it would also have to support splitting up of skeletons, which (im pretty sure) could take much more time.

How does Skeleton Merger Tool deal with name conflicts
If you have name conflicts between the two(on Bones, Slots, Skins or Animations), SMT will resolve them by adding a number at the end of the name, it will increase the number until the name is unique.

For Example:
Skeleton1
bone1
bone2

Skeleton2
bone1

Merged skeleton
bone1
bone2
bone3

I feel like this could be done in a better way, I am open to suggestions.

Can SMT Merge animations and skins?
Currently, no. The reason is, once both your skeletons are merged, you can copy keyframes to the original animation if you want. Or in the case for skins, apply two skins at runtime.

This being said, it is planned in a future update to add command flags to allow you to merge skins and animations.

Is there a preview window?
No, I felt like adding this would make the tool a little too much like the spine editor. If I get express permission from Esoteric Software I may add one. Although adding it will be low priority.

Can SMT Split skeletons into new skeletons?
No. Reason is, I feel like this would be a conflict of interest with my work. Can't go into detail, sorry. My work was kind enough to let me release this though 🙂 .
(maybe in future though)

How do I use SMT?

  1. !!BACK UP!!

  2. Run the .exe

  3. Enter the directory of the skeleton you want to merge

  4. Enter the directory of the skeleton you want to merge to.
    (The output will be in the same directory)

  5. import merged skeleton .json

Any Future Plans / will this be supported?
I will be supporting it, however I have limited free time (sorry). If any major bugs pop up I will try to address them immediately.

Things I plan to do:

  1. Add support to merge skeletons from .spine file

  2. Add Merge Flags to merge animations/skins

  3. Better Bone Ordering

Things that I might do:

  1. Merge hierarchy of bones to a skeleton

  2. Load/Save skeletons/bones

  3. Add a GUI

Please feel free to request things and I will (probably) add them to the list.

Need something urgently? PM me and reply to this thread, maybe we can arrange something :happy: .

Will This be open source?
Hmmm, this one is unanswered. I would like to make it open source, but before that happens I need to finalise how the data is stored.

Download
Not yet, soon. [edit] I accidentally posted this, I meant to preview, rather than delete I will just update when I release the tool (should be a day or two....?). The current state of the tool is that it works, for bones, meshes, slots, attachments and skins. I'm currently working on getting animations to merge.


appendix
The way I have read and stored the json file (skeleton to merge) means that the bones will be in a different order, their hierarchy should remain the same. This is not a problem for spine Versions 2.1.27 or 2.1.7. Any other version the merger may not work. I will update if this changes in V3.

I would also recommend that you always import to spine and do a fresh export before using the merged skeletons.

Keep at it! Awesome people who support stuff like this make development better for everyone!

10 días más tarde

      1. SMT 0.01 Download (beta)

Here is the first Release of the SMT: Download

(It is in beta as I have not tested the current version with spine, as I do not own a copy. I will remove the beta status on conformation that it is working as intended)


Just tested, This will work if you don't have any scales on your skeleton or images. Will fix tonight so it will write out the correct scale.

SMT 0.01 installer will install the program to the desktop. ( C:\Users\Public\Desktop\BinaryCats ). Inside the instillation folder will contain two sub folders (Input and Output) and the .exe. Inside the Input folder there will be an example .json file which you can test, that file is called SkeletonBasic.

To use SMT

  1. Place the skeleton(s) you want to merge in the Input directory - C:\Users\Public\Desktop\BinaryCats\Input

  2. Run the .exe - You may need to run as administrator if SMT does not output a file.

  3. Enter the first skeletons name - Do not include the file extension (.json)

  4. Enter the second skeletons name - Do not include the file extension (.json)

  5. Locate your merged file, and import it into spine.

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


Loading the first skeleton and info

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


Loading the second skeleton and outputtin

I want to add more usability to this program, if you have any suggestions, please let me know.

Avast Antivirus Users
It seems Avast has a 'deep screen' mode which targets unknown applications and prevents them from exporting. You may have to turn of the File system shield to allow SMT to output a file. From Avast Settings menu: Active Protection>File system shield>Off>10Mins .

I am aware that this isn't a solution and am currently working to resolve this issue. Sorry.

TY!
exe extentions is not good )
source language?

mfedorov escribió

Sorry I removed it from my drop box, then forgot to upload the new one. Check back in 3 hours when im home ands it will be uploaded (hopfully), I will zip the .exe up, hopfully it wont be flagged as a virus then 🙁

Language is c++, but I doubt the source will be released soon


updated Download link

21 días más tarde

Has anyone tried using this?

I keep getting "Unable to write json file" errors, using the sample json file and a simple one of my own with 1 bone in it.

Is there any other way to merge 2 skeletons into one project (maybe each skeleton under a new master bone)?

I know I can Import them into a new project, but I need to be able to have them all within the same draworder to be able to go infront/behind/in between the other skeleton.

DoobyDude escribió

Has anyone tried using this?

I keep getting "Unable to write json file" errors, using the sample json file and a simple one of my own with 1 bone in it.

Is there any other way to merge 2 skeletons into one project (maybe each skeleton under a new master bone)?

I know I can Import them into a new project, but I need to be able to have them all within the same draworder to be able to go infront/behind/in between the other skeleton.

Are you running in admin? (i.e. right click, run as admin)

Second question: you would need to edit the jsons manually, which is the purpose of this tool.

BinaryCats escribió

Are you running in admin? (i.e. right click, run as admin)

Second question: you would need to edit the jsons manually, which is the purpose of this tool.

Ah no I wasn't - running as admin does indeed fix the error message.

Sadly, I am using Spine v1.6.42 so the exported file after merging will not import back into Spine as I think you said you only support back to v2.1.x.

DoobyDude escribió
BinaryCats escribió

Are you running in admin? (i.e. right click, run as admin)

Second question: you would need to edit the jsons manually, which is the purpose of this tool.

Ah no I wasn't - running as admin does indeed fix the error message.

Sadly, I am using Spine v1.6.42 so the exported file after merging will not import back into Spine as I think you said you only support back to v2.1.x.

It might work, I am just unable to test it 🙁 .

(there is a known bug with meshes. I don't know what is causing it, yet, however. Sometimes it works, sometimes it doesn't (depending on the project :/). If it merges sucsessfully, but doesn't import try making meshes images, sorry I know this isn't a solution, but im trying to work on it)

BinaryCats escribió

It might work, I am just unable to test it 🙁 .

(there is a known bug with meshes. I don't know what is causing it, yet, however. Sometimes it works, sometimes it doesn't (depending on the project :/). If it merges sucsessfully, but doesn't import try making meshes images, sorry I know this isn't a solution, but im trying to work on it)

No it doesn't work - I did test before I posted.
To clarify - the merge works fine, but it then won't import back into Spine.

I don't use any meshes or anything like that as they aren't supported in my version - just images, bones and SRT.

This is probably why your merged json doesn't import correctly - there is too much extra information in the json that v1.6 just isn't expecting (meshes etc as you say)

DoobyDude escribió
BinaryCats escribió

It might work, I am just unable to test it 🙁 .

(there is a known bug with meshes. I don't know what is causing it, yet, however. Sometimes it works, sometimes it doesn't (depending on the project :/). If it merges sucsessfully, but doesn't import try making meshes images, sorry I know this isn't a solution, but im trying to work on it)

No it doesn't work - I did test before I posted.
To clarify - the merge works fine, but it then won't import back into Spine.

I don't use any meshes or anything like that as they aren't supported in my version - just images, bones and SRT.

This is probably why your merged json doesn't import correctly - there is too much extra information in the json that v1.6 just isn't expecting (meshes etc as you say)

Im sorry to hear that. Would you mind posting the Merged.json, or pming it me? There may be an error I can fix 🙂

BinaryCats escribió

Im sorry to hear that. Would you mind posting the Merged.json, or pming it me? There may be an error I can fix 🙂

I've PM'd you with a link to the files.

seems to be some error with renamed bones and Animations, I will look into it tonight 🙂 I have fixed the merged json and messaged it to you.

(although the animations will be borked. as the broken bone (in the data) was named toroot. Cut the root key frames and paste them onto the desired bone)

Just used tool to merge 2 skeletons in one file - awesome time saver!!!!!!!!!

BinaryCats escribió

seems to be some error with renamed bones and Animations, I will look into it tonight 🙂

That would be awesome!

Thanks for your time, I appreciate it.


BinaryCats, have you had chance to look into the error yet?

7 días más tarde

Thanks man, I will check when I get some time over the next few days and let you know how I get on.

I appreciate your time and help! 🙂


I've used the updated version of the tool to merge a few different json files now and everything seems to be working fine! 🙂

Only thing I don't like is all the spaces/tabs(?) inserted into the exported json when compared to the json output from Spine - but I've just realised this is a none-issue as you will be exporting from Spine after merging anyway lol!

Thanks for a great tool, it will save me a LOT of time as I have a lot of things I need to merge, so I will keep you updated as to how it performs and if I find any bugs or not.

Thanks again!

Eh, that's because I exported it with pretty print on. So I could easily debug stuff. If you import into spine, and re-export it will go back to normal ( I recommend doing that anyway)

🙂 Thanks 🙂

Haha yeah I realised a minute after I posted - idiot.

I think I spoke a little too soon, I have a crash trying to merge 2 files.

Both files work if I input them first, they report correct bones, animations etc, but when I add the second file the program crashes.
I have PM'd you a link to the offending files. 🙂