How to move poseBone using relative to parent transform?


I’ve been reading a file which contains “relative to parent” translation/rotation transformation from every bone in the skeleton on every frame.

I tried to use this way which worked loading the skeleton on edit bones, but I’m still pretty new about 3D and Blender in general.

# Check frame by frame.. check every pose bone from current frame, then apply transformation below and continue to the next since they are hierarchy ordered already

# Set transformation from parent through bone matrix
poseBone.matrix = poseBone.parent.matrix if poseBone.parent else Matrix()
poseBone.matrix = poseBone.matrix @ Matrix.Translation(Vector(keyframe['parent_translation'])) @ Quaternion(keyframe['parent_rotation']).to_matrix().to_4x4()

I’m basically setting the matrix to the parent and applying transformation from there but the animation results are not as expected. The animation is there but then something is missing.

You can take a look to the values stored, maybe I’m wrong and the values are not “relative to parent” but something else. chinawoman_vendor01.json (1.1 MB)

Any kind help is highly appreciated, thanks!

Solved! It’s all about how Blender applies transformations on pose bones I guess.

I had to change slightly the code to apply the transformation on parent matrix before applying it to the pose bone.