How do i use scripted expressions in drivers?

Hi !

In 2.49, I was able to use clever python functions as drivers.
I can’t do it in 2.50.

Example: if i have a scene with a sphere and a cube, i create a driver for the x location of the sphere and ask for it to be a “scripted expression”.
In there I type:[“Cube”].location.z

So in fact Sphere’x should be the same as Cube’s Z.
It says this expression is correct, but the thing isn’t re-evaluated when I move the cube !

Hi there,
You need to select the cube as the object in the variables panel below the expression. See the image below:

Alternatively, to avoid having to type etc every time you want to use a property, you can define it as a variable directly. See below,

Hope that helps,

Thanks Truman
I don’t get it though… Why do i have to select the cube ? I specified[“Cube”] in my expression, there shouldn’t be a need for more i think ?

All explained well here.

Thanks for that, I suspected that they needed to be variables but I wasn’t sure.

Interesting read.
Thanks !