# pose.bones.matrix does not update after frame change via script

I write an exporter to retrieve the pose bone matrix for every frame.

The concept looks like this, the code is called from an exporter class via an operation button in the tool shelf:

for action in actions:
for frame in range(action.frame_range[1]):
bpy.context.scene.frame_set(frame)
context.scene.update()

for poseBone in armature.pose.bones:
exportMatrix = poseBone.matrix


However, the exported poseBone.matrix values all have the same values from one frame. I checked in the pyhton console if the values change when i manually change the current frame and they do.

What am I missing to update the pose bone matrix after a frame change?

• you're not setting the armature's active action to "action", and "context.scene.update" should probably be "bpy.context.scene.update" – HENDRIX Feb 26 '19 at 14:54

for action in bpy.data.actions: