Text editor / driver script

  1. I have been using the text editor to write driver scripts which are called by a scripted expression. When I make changes to the script, currently I need to save it under a different name, and then change the scripted expression to reflect the new name. So I wind up with a ridiculous number of versions. What am I doing wrong here? Tried reloading it, running the script, but the driver is still using a cached version, or something like that. What am I doing wrong?

  2. I have been using Atom’s method of a dummy empty driver to fire a script on every frame. Is there a better method to call a script on every frame? Note: Atom’s method works perfectly well, it just feels like there’s a better way.

And thanks to Atom, from whom I have copied many lines of robust working code.

  1. I have been using Atom’s method of a dummy empty driver to fire a script on every frame. Is there a better method

Yes, there is a better approach to running a script every frame. There now exists an interface called handlers.
http://www.blender.org/documentation/blender_python_api_2_66_release/bpy.app.handlers.html?highlight=handlers


import bpy


def my_handler(scene):
    print("Frame Change", scene.frame_current)

bpy.app.handlers.frame_change_pre.append(my_handler)

Once setup, the handler will transfer control to your def and provide you with the current scene when the frame changes.

Very nice, I will read up and start using it. And thanks again for your code and time. Many an hour of google searches on arcane api stuff ended with a perfect code snippet written by you.