Bones with python: emulate armature with constraints I have an old 3d model format which defines a mesh and a skeleton. I want to write an import/export script for this model format.

A bone of the skeleton is defined just as a coordinate space. Most bones have parents.

The location of a bone is defined by its parent location + some extra offset value for each frame.

The rotation of a bone is entirely decoupled from that. You can rotate a bone and it will not affect the child bones positions (unlike blender). The rotation values are defined per frame of course.

There is an additional fixed distance from a parent to its child and this distance value is the same across all frames.

EDIT cutting this down so it wont be too much to read.

So this is my first question. I might lack knowledge here, but does blender support such a bone system?

My second question is related to how you would emulate such a bone system?

My current approach is with constraints. I am currently working with "child of" and "limit distance" constraints. The child of constraint lets me model parent child relationship. because i cant simply set parent-child relationship in blender (the normal way). The "limit distance" constraint i cant seem to get to work. I want to achieve with that that when i rotate the bone, it will affect its child positions and there will be one distance of the bone to its child across all frames.

The core problem seems to be that this old format and blenders bone format seems to be incompatible (blender is a kinematic chain, the other is not?). From what i can tell from my own research is that the old format seems to have more degrees of freedom than blenders bone fromat (the one i know, might lack knowledge here about blender). I come to this conclusion by seen that you can rotate a bone and affect its connected vertices, but the child bones positions stay the same. Blender can't do that. So in a sense the old format is more "powerful". Also there is this restriction in blender that the tail of a bone needs to always point into the direction of its child. Any tips welcome here.

I have imported a first version of the format for now, but i cant achieve same distance of parent to child on each frame (distance constraint), and cant achieve that when you rotate a bone it will affect its childs locations.

Below a picture which shows how it currently looks.



Any questions, please shoot or write me a pm.
In short, no, Blender does not support a bone system like that. Blender uses the common approach where a bone's entire transformation matrix defines the coordinate system for their children. What I would suggest is to dive into the math required and rewrite the bone transformations from your system to a matrix that Blender would understand. I think this approach would be easier and saner than trying to emulate your bone system in Blender.

TL;DR: convert your data to Blender's model, rather than trying to force Blender to mimick your model.


  Also there is this restriction in blender that the tail of a bone needs to always point into the direction of its child.


That statement is only true if you keep the "Connected" property of the bone at its default value True. Just uncheck that checkbox and you can move the bone without affecting its parent orientation.