python access to driver namespace, rather then have a textblock defined for drivers allow scripts to add functions directly.

- bpy.app.driver_namespace, read-only dictionary, edit in-place.
- reset on file load and new file.
- on errors the namespace used to be reset, this should not be needed.

simple example.

  def driverFunc(val):
    return val * val
  bpy.app.driver_namespace['driverFunc'] = driverFunc

... now all drivers can access this function.
This commit is contained in:
2010-11-27 02:39:51 +00:00
parent 4a804855b2
commit 02cc80691d
7 changed files with 38 additions and 14 deletions

View File

@@ -28,4 +28,8 @@
PyObject *BPY_app_struct( void );
/* bpy_driver.c */
int bpy_pydriver_create_dict(void);
extern PyObject *bpy_pydriver_Dict;
#endif