I'm writing an export script for an armature (using Blender 3.0.0). In this script, I'm attempting to clear bone roll, then force local bone matrices (
bone.matrix_local) to be recomputed before writing to a file, as follows:
bpy.ops.object.mode_set(mode = 'EDIT') # I could also use bpy.ops.armature.roll_clear() for editBone in armature.edit_bones: editBone.roll = 0 # I've tried this script with and without the following line (setting the armature's node to be active). bpy.context.view_layer.objects.active = node bpy.context.view_layer.update()
This seemingly has no effect, as I've confirmed that exported local bone matrices include roll (rather than zeroing roll first). What am I missing? How can I force the export script to recompute bone matrices immediately?