1
$\begingroup$

I know its possible to bake the values of drivers to keyframes using Object > Animation > Bake Action but is there a way to bake a driver that is controlling a Camera's properties? I want to delete these drivers while keeping the same Camera animation.

Edit: Link to Blend

link to comparison video

$\endgroup$
1
$\begingroup$

Quick script to bake camera data.

Bake a bpy.types.Camera object's drivers to keyframes.

  • Bakes all driven properties of scene.camera.data from scene.frame_start to scene.frame_end in frame_step steps.
  • Assumes there are no array type properties on camera
  • Leaves drivers intact, will need to be removed. (Currently code used to remove camera drivers crashes my version of 2.8, and doesn't work on 2.79) Keyframes trump drivers. Remove manually if happy with result.

Test script

import bpy
context = bpy.context
scene = context.scene
cam_ob = scene.camera
cam = cam_ob.data
frame_step = 1
ad = cam.animation_data

f = scene.frame_start
if ad:
    while f <= scene.frame_end:
        scene.frame_set(f)
        for d in cam.animation_data.drivers:
            cam.keyframe_insert(d.data_path)
        f += frame_step
$\endgroup$
  • $\begingroup$ The script itself looks to have worked, and quite fast as well. Im rendering the result and will mark as accepted answer if it works. $\endgroup$ – Haybale100 Feb 14 at 1:21
  • $\begingroup$ As previously said, the script itself looks to have worked for the project in Blender's viewport, but upon rendering (through the distributed render farm, Sheepit), the result is not correct (seems that the focal length is not adjusting as expected). I have updated my question with a link to a simplified version of the blend file and the rendered result clip to compare if you or anyone want to test locally. $\endgroup$ – Haybale100 Feb 14 at 3:44
  • $\begingroup$ As a rule to self, I don't download 90Mb files to answer BSE questions. Can you add a stripped down file with the driver set up (no vid) to blend-exchange.giantcowfilms.com ? (paste link in question) $\endgroup$ – batFINGER Feb 14 at 8:03
  • $\begingroup$ That is fair, I did not know that blend-exchange.giantcowfilms.com existed. I've updated the link on the question $\endgroup$ – Haybale100 Feb 14 at 12:13
  • $\begingroup$ You are driving the ortho_scale on a perspective camera? $\endgroup$ – batFINGER Feb 14 at 12:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.