Driver Scripting:
authorJoshua Leung <aligorith@gmail.com>
Fri, 6 Nov 2009 11:09:04 +0000 (11:09 +0000)
committerJoshua Leung <aligorith@gmail.com>
Fri, 6 Nov 2009 11:09:04 +0000 (11:09 +0000)
commit5a12b7d159371709580cf8fb07fd10d3c3bfdff3
tree8117e163207324afce4a6856f67ee61bb1c2eb47
parentd4fe2595f7c350c90feba61ba8d520850648b06f
Driver Scripting:

Added RNA functions for adding and removing Driver Targets. Unfortunately, I couldn't do this by simply adding callbacks for the add/remove of the collection, as I've had to add to extra RNA functions to do that.

Example usage - driving Lamp Distance with Cube LocZ:
myOb= bpy.data.objects["Lamp"]
myOb.driver_add("data.distance")

# drivers is list of F-Curves that have driver data
drivers= myOb.animation_data.drivers
distDriver= drivers[0].driver

dtar= distDriver.add_target("ctrl1")
dtar.id_type= 'OBJECT'
dtar.id= bpy.data.objects["Cube"]
dtar.rna_path= "location"
dtar.array_index= 2
source/blender/editors/space_graph/graph_buttons.c
source/blender/makesrna/intern/makesrna.c
source/blender/makesrna/intern/rna_fcurve.c
source/blender/makesrna/intern/rna_fcurve_api.c [new file with mode: 0644]
source/blender/makesrna/intern/rna_internal.h