diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-11-27 05:39:51 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-11-27 05:39:51 +0300 |
commit | 02cc80691d71ea305780655d3b0d4cd4530db9c7 (patch) | |
tree | f41d0aeb97e5667d4697c2a90b7fc2becc65ffa6 /source/creator | |
parent | 4a804855b26bd764b7752e673052c0001dce32a1 (diff) |
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.
Diffstat (limited to 'source/creator')
-rw-r--r-- | source/creator/creator.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/source/creator/creator.c b/source/creator/creator.c index 966a36d5625..aaa96752cc3 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -926,6 +926,7 @@ static int load_file(int UNUSED(argc), char **argv, void *data) /* WM_read_file() runs normally but since we're in background mode do here */ #ifdef WITH_PYTHON /* run any texts that were loaded in and flagged as modules */ + BPY_reset_driver(); BPY_load_user_modules(C); #endif |