bone local_matrix all at location 0,0,0?

I'm trying to update a script from blender 2.55 to 2.7 which was supposed to work, but here I have an issue, to get the bone matrices I take the armature world_matrix and multiply by the bone local_matrix but all my bone seems to be at 0,0,0. I need to obtain the world matrix of each bone in object mode.

my test code:

import bpy
from bpy.props import *

ob=bpy.context.selected_objects[0]

for bone in ob.modifiers[0].object.pose.bones:
print("matrix channel",bone.matrix_channel)
for bone in ob.modifiers[0].object.data.bones:
print("matrix_local",bone.matrix_local)


For both I have 0,0,0 for location (last line 0 0 0 1)

Thanks

• can you post how you are getting 0,0,0 , and did you try armature.pose.bones[0].matrix_channel – Chebhou Mar 14 '15 at 23:32
• A pose bones location is relative to it's rest position, it will be 0,0,0 unless you have moved it in pose mode. – sambler Mar 15 '15 at 6:20
• @Chebhou I added the code to my post, I have the same with matrix_channel – Entretoize Mar 15 '15 at 9:12
• @sambler I don't find where to get the rest matrix.. – Entretoize Mar 15 '15 at 9:52
• OK I finally found the error, it seems that rows and columns have been switched from blender 2.5 to 2.7 or my script was already buggy... Then matrix_local is the one to use. – Entretoize Mar 15 '15 at 13:12