Page MenuHome

custom property (listed in sub-classed panel) does not update driver's variable
Closed, InvalidPublic


I noticed that a custom property of an object that is listed in a sub-classed panel (say, "My Own Panel" for an object) does not propagate its value to a driver's variable. However, the Custom Property panel's entry of the same custom property DOES propagate its value correctly to the driver's variable.

Example script: Run the script and go to Cube object's object panel. Change the property camXLocation value both in the Custom Property panel.. and in the "My Settings" panel. The Custom Properties prop changes translate the camera, the My Settings prop changes doesn't.

import bpy
import mathutils
from math import *
from bpy.props import *

# link the cube's property to camera X location
def setupDriver():
camera =['Camera']
cube =['Cube']

# define and set custom property for cube object
cube.FloatProperty(attr="camXLocation", default = 10.0, min = 0, max = 50)
cube.camXLocation = 10.0

# create a driver for camera x location (scripted)
driver = camera.driver_add("location", 0).driver
driver.type = "SCRIPTED"
driver.expression = "x"

# create a variable for the driver
var = = "x"

# link variable to cube object's camXLocation property
targ = var.targets[0]
targ.id_type = "OBJECT" = cube
targ.data_path = 'camXLocation'
# I also tried targ.data_path = '["camXLocation"]'

# object panel to display camXLocation property
class OBJECT_PT_my_settings(bpy.types.Panel):
'''My Settings Panel'''
bl_label = "My Settings"
bl_space_type = "PROPERTIES"
bl_region_type = "WINDOW"
bl_context = "object"

# draw the gui
def draw(self, context):
layout = self.layout

ob = context.active_object

if ob and == "Cube":
# some property
row = layout.row()
row.prop(ob, "camXLocation", text="Camera X Location")

def register():

def unregister():

if __name__ == "__main__":



Event Timeline

This is something for todo. Dependency graph needs to be redesigned for this. Moving to todo wiki: