Baking drivers to keyframes on any property
In general, to my knowledge, there does not seem to be a way to convert a driven property into keyframes. There exists the Bake Action function that does allow to convert drivers (and other stuff) to keyframes when it comes to the basic transforms of objects and bones and such, but not other properties of the object, material or anything else.
Wanting to convert drivers to keyframes can have a number of reasons, for example, to more easily manipulate and adjust the setting of a property after having gotten the "shape" of the animation from the driver (f.e. adjusting the center value of a waveform created by a driver just by dragging the keyframes). More importantly, there are multiple online render farms (notably Sheep-It), that do not allow drivers (scripted expressions considered dangerous) and their users could really use the ability to simply convert any driven property into a set of keyframed values.
I would imagine that it would be useful and hopefully possible to develop this and add it, for example, as a Right-click option on a driver or somewhere in the driver editor.
1 Comment
I had to write custom code to do this, it would "bake" the animation of the driver then mute it after so I could change something, unmute and bake it once more. So in short agree it would be nice to be able to do this built in..
Here is some rough code to do it....and there are smarter better devs that can do this but for render farms and for quickly sharing actions that are easy to update for lots of driven animation, this is a must.
the code isn't formatted correctly but you can at least see it..
import bpy
ob = bpy.context.active_object drivers_data = ob.animation_data.drivers ad = ob.animation_data
context = bpy.context scene = context.scene
frame_step = 28 frameEnd = int(scene.frame_end) frameStart = int(scene.frame_start)
f = int(scene.frame_start)
if ad: for f in range(frameStart, frameEnd+1, 28): scene.frame_set(f) for d in drivers_data: ob.keyframe_insert(d.data_path)
for d in drivers_data: d.mute = True
bpy.context.area.ui_type = 'FCURVES' bpy.ops.anim.channels_select_all(action='SELECT') bpy.ops.graph.interpolation_type(type='CONSTANT') bpy.context.area.ui_type = 'TEXT_EDITOR'