Skip to content
Dealga McArdle edited this page Oct 25, 2015 · 18 revisions

I don't know a whole lot about these, and the docs seem to do a good job of covering most things.

Driver from Python file

This is the long way, the scenic route. Using a python expression from a file.

  • Rightclick the property in question, choose Add Single Driver
  • Open the Graph Editor, and switch to Drivers view
  • select the driven property, and toggle the rightside panel
  • Make a script in the Text Editor with content similar to this.
import math
import bpy

def driver_func(current_frame):
    frames = 120   # <-- period.
    theta = math.pi * 2 / frames
    final = math.sin(current_frame % frames * theta)
    return final

# add function to driver_namespace
bpy.app.driver_namespace['driver_func'] = driver_func

If your driver has a python error, you can correct it and run the code again to overwrite the namespace key 'driver_func`.

theimage

Clone this wiki locally