Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Notice: this is for the Blender 2.5/2.6 API.

Back in the old days in the Blender 2.4 API, you could easily create a bone from a transform matrix in your 3d file as EditBones had an attribute named "matrix", which was an armature-space matrix you could access and modify.

The new 2.5+ API still has the "matrix" attribute for EditBones, but for some unknown reason it is now read-only.

So how to create EditBones from transform matrices? I could only find one thing: a new "transform()" function, which takes a Matrix too.

Transform the the bones head, tail, roll and envelope (when the matrix has a scale component).

Perfect, but you already need to have some values (loc/rot/scale) for your bone, otherwise transforming with a matrix like this will give you nothing, your bone will be a zero-sized bone which will be deleted by Blender.

if you create default bone values first, like this:

bone.tail = mathutils.Vector([0,1,0])

Then transform() will work on your bone and it might seem to create correct bones, but setting a tail position actually generates a matrix itself, use transform() and you don't get the matrix from your model file on your EditBone, but the multiplication of your matrix with the bone's existing one. This can be easily proven by comparing the matrices read from the file with EditBone.matrix.

Again it might seem correct in Blender, but now export your model and you see your animations are messed up, as the bind pose rotations of the bones are wrong.

I've tried to find an alternative way to assign the transformation matrix from my file to my EditBone with no luck.

share|improve this question

closed as off-topic by Byte56 Dec 19 '13 at 17:00

  • This question does not appear to be about game development within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

    
this is exact duplicate of gamedev.stackexchange.com/questions/31959/… –  theli Jul 17 '12 at 8:06
    
This question appears to be off-topic because it is about Blender, not game development. Blender questions should be asked on the Blender stack exchange. –  Byte56 Dec 19 '13 at 17:00