Drivers: python functions not updating driven values

So I spent some time learning the basics of drivers today, and tried to rig up a simple custom grid array as a test. But then, I found out Blender seems to have trouble auto-updating driven values when making calls to Python functions. Here’s a screenshot and explanation of what I tried to do:

There’s a “leader” object (greeble_f_leader - the active object in the screenshot), and a bunch of “follower” objects (greeble_follower.001, 002, etc) that have drivers applied to their X and Y location values. Each of those drivers calls a relevant Python function (defined in the Text Editor) to organize these “follower” objects into rows and columns, based on the “leader” object’s position and some voodoo using indices.

It all works fine when first duplicating the “follower” objects to create the array, but then when I try to move the original “leader” object, the “follower” locations don’t update based on the new “leader” location. I tried all sorts of things: scrubbing the timeline, changing the Py code around, etc. This is broken in both 2.79 and 2.80. Finally, I stumbled on a way to force-refresh the driven values: 1) hit the “Run Script” button in the Text Editor, and then 2) hit Undo in the 3D viewport. (?!) But that’s useless if you want to animate the “leader” object’s location.

After some digging, I found this BA thread from 5+ years ago talking about this very same problem: No more way to use python functions in drivers ?

Apparently this behavior broke around the time of the 2.5x refresh, but it had worked fine in 2.4x and earlier. There’s a workaround where you create a dummy variable in the driver UI of the Graph Editor for each driven property and then pass it in a function, but that’s a pain. Since this didn’t get fixed this far into 2.80 development, I’m guessing it’s not a high priority, and probably won’t get fixed until Animation 2020.

Is there a fix for this that people know about? Or am I better off learning Animation Nodes for now, to work with these kinds of setups?

So I gave in, and tried the workaround of passing variables to Python using the Graph Editor UI’s variable stuff. Managed to get this other test working. It’s hard to work this way though, so I think I’m gonna learn some Animation Nodes.

1 Like

Hi @pablohotsauce

I was the one starting that old thread, and it’s sad to see that there seems not to be another way to manage that.
2.49 was so simple in that respect…

1 Like