chinedufn / landon

A collection of tools, data structures and methods for exporting Blender data (such as meshes and armatures) and preparing it for your rendering pipeline.
https://chinedufn.github.io/landon/
147 stars 17 forks source link

compatibiltiy with skeletal-animation-system? #26

Open kevzettler opened 2 years ago

kevzettler commented 2 years ago

Hi @chinedufn I haven't looked very deeply but it seems the armature export structure is quite different from what I have in an older project that is using skeletal-animation-system The obvious thing I've noticed is the old JSON has fields for "frame_time_secs": 0.625 and skeletal-animation-system expects keyframes indexed by time. I'm not seeing any reference to animation time in the landon output. I know at one point landon was returning this frame_time field as I have an old pipeline that was parsing and acting on it.

chinedufn commented 2 years ago

Ah yeah.

My skeletal animation needs have gotten much more complex since I wrote that skeletal-animation-system library, I've since written a much more robust skeletal animation library (currently closed source).

i.e. it supports things like additive blending https://devjournal.akigi.com/december-2020/098-2020-12-20.html


Ultimately it all stems from the same Blender keyframe data so you should be able to massage it back into the old format.

i.e. IIRC the new output has frame numbers and a framerate, so to get that frame_time_secs you can just divide the frame number by the framerate.

Let me know if you have any trouble with this! I'm more than happy to hop on a call to help get you up and running.

kevzettler commented 2 years ago

Thanks @chinedufn

i.e. IIRC the new output has frame numbers and a framerate, so to get that frame_time_secs you can just divide the frame number by the framerate.

I'm not seeing framerate in the output.

image

I do see frame_range_inclusive. is that related?

chinedufn commented 2 years ago

Ah just checked my codebase and it looks like I have the framerate hard coded to Blender's default of 24 FPS.

So yeah blender-armature doesn't currently export the framerate from Blender, sorry!

Although if you haven't touched it then yours should also be 24.

So frame_time_secs = (frame_range_inclusive.1 - frame_range_inclusive.0) / 24.0

frame_range_inclusive is just the start and end frame of the action.

So if an action starts on frame 10 and ends on frame 34, it's frame range is [10, 34] and it's frame_time_secs would be 1 second.