Bone drivers and Python scripted expressions

I’ve been trying to get a bone driver with a scripted expression that will return the value of the (local) position of one bone (let’s call it Controller) and use it for the X scale driver of another bone. Does anyone know what the correct expression to use is? I’ve tried putting in ‘bone(“Controller”).LocX’ but that just gives me an error.

Attachments

PythonDriver.blend (65.9 KB)

That interface probably needs a little work. The expression you are looking for is just “var”.

When you add a “variable” to the driver that becomes a name that you can reference that is filled with the values in its configuration. For your file you have a variable called ‘var’ that is tied to the “Global X Transform” of the “Armature.Controller”.

P.S based on your description, you probably want to change that drop down that says “World Space” to “Local Space”

Attachments


Thank you. I feel kind of embarrassed to have overlooked such an obvious solution. This is actually better than I had hoped, as it looks like it will allow for greater flexibility than what I had intended.