How Do I Find the L/R/S of a Posed Bone?

The title says it all, really.

Once a bone has been posed, how would I get the location/rotation/scale values using Python?

In the 3D View, if I select a posed bone, all the transforms are at their defaults.

If you get the Object that represents the Armature then the Object will have “Object.pose” This is a “bpy.types.Pose” object and it stores a collection of PoseBone objects. These store the change required to move a bone in Edit/Rest position into the posed position.

There are a lot of trick ‘spaces’ that the Armature, Edit bones, and Pose bones are relative to so it can be a bit mind bending to figure out how to work with all of them.

e.g.

ob = bpy.context.object
bone = ob.pose.bones[-1]

print(bone.location)
print(bone.rotation_quaternion)
print(bone.scale)
print(bone.matrix_basis)
print(bone.matrix_channel)

Yeah, that’s why I asked on here. I spent a very long hour this morning poring over the API for this and had to take a nap afterwards.

Thanks for jumping into the conversation, kastoria.

Thanks for the example, CoDEmanX.

EDIT: (I rephrased my question)

If I want to copy matrices from one object to another (bone to mesh or mesh to mesh) which functions/methods would I use? I thought they’d be in MathUtils, but I can’t seem to find them.

Would you point me in the right direction, please?

Like this?

ob1 = bpy.data.objects.get("Object1")
ob2 = bpy.data.objects.get("Object2")

if ob1 and ob2:
    ob2.matrix_world = ob1.matrix_world

Ah-ha! Excellent! Thank you very much, CoDEmanX!