How do you access and set a specific bone animation fcurve in python ? e.g. set pinky02_L z rotation = 8 degrees

2018-06-22 15:05:33

I want to access the keyframes for a specific bone in animation_data.action, just so I can reset them to a default value.

My main problem is I dont know how to just access a specific bone.

The general purpose of this is to automatically reset the hand positions of bvh animation loaded onto a manuelbastionilab model. The bvh animation loads it in fine, but because there isnt really any hand data, it sets the animation to a default splayed out position. And because it assigns it to the wrong bones, it comes in with a crooked little finger. So I just want a simple python script to reset any animations I load in to a good default.

I think I should be able to get to the animation data for the keyframes with

myaction = bpy.context.active_object.animation_data.action

But I dont know what comes next, I dont know how to access the fcurves for a specific bone like a joint / bone in my little finger called pinky02_L

This seems incredibly basic but Ive spent ages googling it