Whilst playing around with drivers I noticed you could also keyframe over the top of them with code. This will give the impression in the UI they are being animated by keyframes, yet the driver takes precedence.
In the example file I have a cube with a shape key driven by the x pos of a bone in the armature. If you run the script you will see that it creates the keyframes for the shape keys, whilst still being driven by the bone. To run the script right click in script window and “run script” (Make sure you have the cube selected (active))
context = bpy.context
scene = context.scene
object = context.object
frame = scene.frame_start
while frame <= scene.frame_end:
frame = frame + 1
This is a simple example for only one shapekey, modifying for more isn’t difficult, if you need a hand give me a hoy.
driver_to_keyframes.blend (445 KB)