Aodaruma/coa_tools2

Add export functionality (As it was in the original ("Export json" button))

Opened this issue · 7 comments

Is your feature request related to a problem?:
I've tested the addon in Blender 3.5 and could't find any export functionality.

Describe the solution you'd like:
I've tried only this fork, but looks like the ndee85's original coa_tools has the feature to do export in intermediate format in .json and after that - use it to export in Godot engine - I think the best way would be to reimplement (or fix) that.

Additional context:
In general, I think, the ability to export into other apps is essential for the addon.
From my perspective, the most needed is Godot (Both 4 and 3) - becouse its internal tools for skeleton animation are poor and haven't evolved for 4 years. And (maybe) Unity3D - but its tools are good enough so I would not focus on that first.
P.S. Personally, I'm primarily interested in export to Godot 4 - that is why I found coa_tools in the first place.

Thank you for the issue. There is a COA export panel in the render property, but is this not what you mean?

I've been using coa_tools to create animations and export them as videos, so I haven't really touched the output functions to other apps (I know Godot is a game engine, but I don't know specifically what features it has and doesn't have).
However, I am interested in making games with Godot, so I would like to fix bugs to make it usable and add features if necessary.

I would love to get a generic json export format for skeletal animations, and then implementing a bunch of engine-specific importers. It will be much more modular, since engine importers could be separate community projects as well.

I'm talking about this:
https://youtu.be/krCYZ7BPdCI?si=h7pLRfBCoIUjY209&t=297

The script is already there:
https://github.com/Aodaruma/coa_tools2/blob/master/coa_tools2/operators/export_json.py

I spend some time fixing it and managed to make it produse a .json and then imported it in Godot 2
With this import addon:
https://github.com/Aodaruma/coa_tools2/tree/master/Godot/coa_importer
(Turned out the last compatible version of Godot for it is 2.1.4)

But, the json I've got is only partialy valid at the moment:
It has bone structure, and it's wrong, but has set of sprites on their places
Also animation turned broken and sprites needed to be assigned manually etc.

If I make it usable I could create a pull request with the fixes.

Here is the json:
export_test.json.txt

Test scene in blender (Export json button is working here):
blender_kYHA6AJF1j

In Godot 2 it has two packs of sprites:
First - just arranged sprites without bone structure
Godot_v2 1 4-stable_win64_6VLNNueMs7

Second - the bone structure itself and sprites inside - after making scale to one I've got some miserable creature:
изображение

I also checked that the Export json button is missing from the UI panel.
I think it is missing from the UI panel code, so I will add the code from the original repository and fix it.

Also, the unintended behavior of godot is another problem(Most likely a problem with export_json.py or Godot coa_importer), so let's create a separate issue and work on checking and fixing it there.

I have implemented a button in the export json UI, but it seems likely that export_json.py is not compatible even with Blender 2.8 or higher. We will be working on a fix for this as well, but it will take a long time to get all the code in the file to support version 3.4 and above.

I think I could help you with this.
I've already fixed export_json.py so it could run with Blender 3.6 and managed to make it to export bones' rotations/positions right
BTW, the Godot 2 importer should be working ok, the wrong bone structure from my previous reply was because of my mistakes during convertation process of export_json.py to Blender 3.0+

изображение

I appreciate to hear that! The button UI is fixed in branch "fix-addExportJsonButton-#28" and it'll be merged to develop branch, so I will check and merge it if you send PR to that.