coa_tools icon indicating copy to clipboard operation
coa_tools copied to clipboard

DragonBones exporter does not export events and Z depth

Open davord45 opened this issue 4 years ago • 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.

davord45 avatar Sep 26 '20 00:09 davord45

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

davord45 avatar Oct 05 '20 15:10 davord45

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

ndee85 avatar Dec 12 '20 21:12 ndee85

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

ndee85 avatar Dec 13 '20 20:12 ndee85

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.

davord45 avatar Dec 14 '20 01:12 davord45

I can make you a sample file tommorow.

davord45 avatar Dec 14 '20 01:12 davord45

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

davord45 avatar Dec 14 '20 01:12 davord45

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.

davord45 avatar Dec 14 '20 01:12 davord45

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.

ndee85 avatar Dec 14 '20 06:12 ndee85

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

ndee85 avatar Dec 14 '20 06:12 ndee85

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

davord45 avatar Dec 14 '20 09:12 davord45

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?

ndee85 avatar Dec 14 '20 09:12 ndee85

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.

davord45 avatar Dec 14 '20 09:12 davord45

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.

davord45 avatar Dec 14 '20 09:12 davord45

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. :-)

ndee85 avatar Dec 14 '20 09:12 ndee85

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.

davord45 avatar Dec 14 '20 09:12 davord45

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

ndee85 avatar Dec 14 '20 14:12 ndee85

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

ndee85 avatar Dec 14 '20 14:12 ndee85

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.

davord45 avatar Dec 14 '20 14:12 davord45

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.

davord45 avatar Dec 14 '20 14:12 davord45

@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.

davord45 avatar Dec 14 '20 15:12 davord45

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

ndee85 avatar Dec 14 '20 15:12 ndee85

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.

ndee85 avatar Dec 14 '20 16:12 ndee85

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?

davord45 avatar Dec 14 '20 16:12 davord45

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

ndee85 avatar Dec 14 '20 16:12 ndee85

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

davord45 avatar Dec 14 '20 22:12 davord45

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.

ndee85 avatar Dec 15 '20 04:12 ndee85

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.

ndee85 avatar Dec 15 '20 05:12 ndee85

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.

davord45 avatar Dec 15 '20 06:12 davord45

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.

ndee85 avatar Dec 15 '20 17:12 ndee85

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

davord45 avatar Dec 15 '20 18:12 davord45

Updated to a new commit,its different error

image

davord45 avatar Dec 15 '20 18:12 davord45

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

ndee85 avatar Dec 15 '20 18:12 ndee85

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.

ndee85 avatar Dec 15 '20 18:12 ndee85

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.

davord45 avatar Dec 15 '20 19:12 davord45

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

ndee85 avatar Dec 15 '20 19:12 ndee85

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.

davord45 avatar Dec 15 '20 19:12 davord45