Happy new year to all


Yes the channel order in my version is not yet flexible and still uses Blender standard, the output in old MakeHuman is XYZ for location and rotation.
You get a message when reading a file with a different order.
I am aware of it and will fix that, when other more important stuff is ready to go.
I managed to get animations back to Blender meanwhile using the bvh lines from my makehuman version. So Blender exporter is nearly completed (well no face-expressions still, but I use a different concept for that).
BVH: One needs additional information for that. The rest pose must be given at least. Then the so-called rest-matrix of each bone must be decomposed (we are in global space) and then it must be used as a correction matrix.
I have to admit, that I needed to understand the mhx2 importer from Thomas Larrson for that. He first calculated a correction matrix.
Then this correction matrix is used to calculate the animation in Blender for each bone. Here is the code for the bone-rotations: I change to Euler and do not use quaternions, because I wanted to allow 360 rotations like a pirouette. (Maybe I change it back to quaternions as an option in the importer, but NOT for root bone).
- Code: Select all
euler = Euler((radians(m[6]), radians(m[7]), radians(m[8])), 'ZYX')
if name in self.bonecorr:
cmat = self.bonecorr[name]
mat = cmat.inverted() @ euler.to_matrix() @ cmat
rot = mat.to_euler()
pbone.rotation_mode = 'XYZ'
pbone.rotation_euler = (rot.x, rot.y, rot.z)
gLTF is next. There the animation is used with buffers (translation and scale as VEC3, rotation in quaternions as VEC4) per bone. One or more input buffers for timeframe, then all the values in output buffer per bone ("channel"), the buffer pair they call a sampler. For a classical "step animation" (or baked animation) input buffer will be 1/24 equidistant time values (that is, what blender creates). This might be configurable but usually game engines allow to change the speed anyway. The output is a lot of smaller binary buffers then, scaling I will not add in the beginning, but it might be supported later, atm. we do not have jiggle bones and even dislocation is not used except for the position of the root bone.
Usually I will struggle with the correct values for quaternions ...

I wrote/improved a glb-file (binary gltf) analyzer in between. Maybe I will add this tool also in our repo or contact the person who wrote the original, there was no skeleton and animations so far. Maybe that helps other people as well.