I'm trying to drive the Lens property (focal length) of a camera with a custom property, to constrain it to a range (in this case, between 70 and 200mm). When this value goes from 70 to 200, I also want to be able to move an Empty that the camera is targeted to slightly up and down in Z (when the camera is at 70mm the vertical framing is right, but when it goes to 200 the empty is too low so the top of the subject is cropped out of frame).

I've added a custom property on the camera called "Zoom" - Blender gives its full data path as bpy.data.cameras["Cam_tight"]["Zoom"]. Adding a driver to the focal length property, set to Scripted Expression with values as below, doesn't work. (I can't even paste anything into the Path box, I have to type the path in manually.) What am I doing wrong? (I'm on 2.93.2 fwiw.)

Driven property panel

  • $\begingroup$ I think that, because Prop already indicates Cam_tight as the target object (and so already has a reference to the target object), you should only need to give the name of the property itself, like: ["Zoom"] rather than bpy.data.cameras["Cam_tight"]["Zoom"] $\endgroup$ Sep 3, 2021 at 11:33
  • $\begingroup$ Relatedly, if you Copy Data Path on the "Zoom" custom property and paste it into the driver's Path section, I believe you'll get exactly ["Zoom"]. This is how I normally build similar drivers $\endgroup$ Sep 3, 2021 at 11:35
  • $\begingroup$ that's what I thought, but ["Zoom"] on its own doesn't seem to work. And I can't paste anything into the Path box anyway for some reason. It should work and it's how I've seen others do it but it may need some bashing of head on desk for a bit $\endgroup$
    – Nickh129
    Sep 3, 2021 at 11:47
  • $\begingroup$ It should work though. Make sure you added the custom property to the OBJECT (orange rectangle in the properties editor) and not the CAMERA (green camera icon in the properties editor). And it's case sensitive $\endgroup$
    – Gorgious
    Sep 3, 2021 at 11:59
  • 1
    $\begingroup$ Yes they do, but you have to change what's called the "ID type" beforehand. i.stack.imgur.com/u3i93.png You can add custom props to pretty much all ID Types. i.stack.imgur.com/uMm0D.png $\endgroup$
    – Gorgious
    Sep 3, 2021 at 13:51

1 Answer 1


In Blender you can add custom properties to all objects that derive from the ID Type. You can also add custom props to Bones.

These types can be found by expanding the enumerator in the driver interface :

enter image description here

Usually you can find the custom properties interface in the far bottom of the ID type properties panels.

A camera object can have custom properties tied to its Object type (basically the data container) :

enter image description here

And its Camera type, where all the camera-related attributes can be tweaked :

enter image description here

Those props, although they share the same name, are in fact different objects and are not accessed the same way.

Here's how to access the Object custom property :

enter image description here

and the Camera custom property :

enter image description here

Note : The custom properties are case sensitive and they must be encased in double quotes and brackets : ["prop"]. Since you are writing a path relative to the selected object, you don't need to specify for instance bpy.data.objects["Camera"] beforehand.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .