ndee85/coa_tools

DragonBones exporter does not export events and Z depth

davord45 opened this issue · 36 comments

Hi ndee85.

Dont know if you are working on this addon anymore,i see you post a commit from time to time.I gotta report that DragonBones exporter is not finished,if you could please finish it so that it exports Z depth animation and events.I use it in Godot game engine and its awesome,just lacking those features.

Hope you see this.

#173
I made a pull request for this isssue,for anyone having the same problem.

Hi @davord45,
do you have a sample file that animates those properties? Do you use a custom build godot version to test?

Implemented zOrder animation with this commit: ceb5a4c
Next I am going to implement the event system.

Sorry for getting back so late,i am using Godot Dragonbones module which you can download here:

https://www.godotdragonbones.com/

Its already compiled so no need to do that.

I can make you a sample file tommorow.

Thanks for taking the time to implement these features btw! @ndee85

Also the events i managed to export only Sound and Play type not regular events cause they are a Array of events and the JSON formatter caused an error when i tried to add an array. Hopefully you can figure that out. Right now in my pull request In COA regular events are play events.

I have checked the regular events yesterday. I think it shouldn't be to hard to add. I will have a look at it when I have some spare time.

I didn't know that extra godotdragonbones version existed :-)
Good to know.

I tested out zOrder export and it works great!
Way more elegant than what i had lol.

Great. Glad to hear!
Goint to add the event system soon and than I think the exporter should be more or less complete. Or do I still miss something?

Well i found that meshes that are Slots which have a ShapeKey driver deformation, those deformations dont get exported like regular Mesh ShapeKey deformations. And animation curves always get exported as a standard S curve. Also i found that when the bone scale for instance X goes to negative value it exports Y value as a negative as well,even when its positive. I have implemented some fixes for that. Do you think it is possible also to make 2 bone IKs to export as DragonBones IK? Cause i know that IKs get baked into chain bones.

Slots deformation and scale are kind of a bug and Curve and IK are more of a new feature.
Thats all i found missing in the exporter,rest is amazing.

the problem with ik is that they don't behave the exact same way as in dragonbones. Blender is more powerful in that regard. So I thought the best way would be to bake those. Based on the setup it can differ quite a lot in blender. So think the best way is to bake in that case. It is similar with the curves. Blenders graph editor is way more flexible, end exporting this is not as easy. :-)

Understandable,i managed to export curves but in some cases when the curve is really extreme DragonBones runtime starts freaking out. But i found that when i divide the value i can get some variation in curves. It helps the animation,but i guess baking the animation solves that issue, but it leaves bunch of keyframes.

Ok. Timeline Events are now fully supported. Please have a test with your files and see if they work as expected!
Commit: ba0e0ad

Forgot to commit some changes. So now everything should be updated.
ea3dc7e

I added the events but they dont export or they export in the JSON but are not imported in the DragonBones Editor. And now i got a bug with the zOrder export as well,i made a simple one arm go behind the body and other go in front.In DragonBones Editor it made the keyframes but the only plays second arm going in front of the body but on a keyframe where first arm goes behind the body.

Do you want me to send you the .blend to test with it?
Also there is no limit to sound events,if you add too many sound events it crashes the DragonBones Editor and probably the runtime.

@ndee85 Here is the link to the .blend file:
https://www.mediafire.com/file/e02akkpnvz2ov5m/nDeechaser.blend/file

Attack animation is the only one that has events and zOrder animation.
Also i didnt bake the animation when i was exporting.

Thanks. I'll have a check with your file an see what is causing the problem.

Are you sure you updated the sources correctly? I just tested your file and all events did export properly. Also adding multiple sound events should not be possible on the same frame. Do you have an "Animation" event? If not, you did not update correctly.

Just checked that drawing order is still not working correctly in some cases. Will have a recheck on that.

I didnt have "Animation" type,I downloaded the commit from blender28 and installed it to Blender. Do i need to update in Blender as well?

make sure to zip the coa_tools directory from Blender directory. Install that zip file then.

You are right i was downloading the wrong branch. Sorry about that.

Now exporting works very nicely, I like how you give on Animation events dropdown of all animations!

May i ask how do Target,Int,Float,String fields on regular events effect JSON and what is their use in DragonBones?

Thank you for this nice feature! @ndee85

I have to admit I am not sure how to use the custom event. I asume it will trigger a callback in the runtime with the given parameters that can be set. The rest will be up to the dev what callback will be doing. But those are just assumptions.

I just reverse engineered the json file that dragonbones exports and made sure it outputs the same structure.

Just checked the godotdragonbones. It seems there are two signals in godot. One is for triggering sounds and the other is used to trigger customEvents.

dragon_anim_snd_event
dragon_anim_event

The dragon_anim_event will have a dictionary parameter which delivers the int, float and string props.

Nice, that does seem useful actually.

Was wondering could you add a field on the export panel for naming the armature? Cause right now everything that gets exported is called "Armature". Godot Dragonbones module has a way to control child armatures that are parented to a bone of another armature. Demonstrated in the video below.

https://youtu.be/qUPBceXtIDM

Naming the armature in COA would save some time.

#176
This pull request has a field for naming the armature.

ok. Just added the armature name in the export settings.
You can also update COATools via the addon preferences. There for open the addon settings.
Refresh and then install the blender28 branch. Just force the install. This will get the latest source from the github repo.

I get this error when i try to export. But i dont have slots in this armature.
image

Updated to a new commit,its different error

image

Is this the exact same file you posted above? Strange exports fine for me. Did you restart after updating blender?

Also just added a check which makes sure that slot_data does exists before accessing it. Not sure if this will fix your issue. Or something else is the root. But please make sure to restart blender after updating to latest branch.

It was the same project. I updated it but i dont see a check for slots. But it worked now correctly.

Armature name in DB Editor is as i set it in COA.

Ok. Still working on exporting the zOrder correctly. I noticed some problems which I need to think of how to best fix.

If it helps i noticed that the zOrder in DragonBones is looking at the default order and then comparing to the changed order on the keyframe. It looks what is the fastest way of rearranging the order of meshes from top to bottom in order. It does not compare changed order to the previous order in animation,just the default one.

Hopefully that helps you out.