diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-06-24 20:54:30 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-06-24 20:54:30 +0400 |
commit | 12e02fd4746308746e2f9e316a3b5e8bcd5f2896 (patch) | |
tree | 5d56ceb9eb0fadb020297604ca3dbce663190524 /source/creator | |
parent | 74520bd1ef6ab4264f5e6a24269f7ac3b85b4e23 (diff) |
own patch [#27752] Python Callback (Scriptlink functionality)
Python:
* adds bpy.app.handlers which contains lists, each for an event type:
render_pre, render_post, load_pre, load_post, save_pre, save_post
* each list item needs to be a callable object which takes 1 argument (the ID).
* callbacks are cleared on file load.
Example:
def MyFunc(scene): print("Callback:", data)
bpy.app.handlers.render_post.append(MyFunc)
C:
* This patch adds a generic C callback api which is currently only used by python.
* Unlike python callbacks these are not cleared on file load.
Diffstat (limited to 'source/creator')
-rw-r--r-- | source/creator/creator.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/source/creator/creator.c b/source/creator/creator.c index 8b405d2d4b8..28447ac8e46 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -64,6 +64,7 @@ #include "BLI_threads.h" #include "BLI_scanfill.h" // for BLI_setErrorCallBack, TODO, move elsewhere #include "BLI_utildefines.h" +#include "BLI_callbacks.h" #include "DNA_ID.h" #include "DNA_scene_types.h" @@ -990,6 +991,7 @@ static int load_file(int UNUSED(argc), const char **argv, void *data) #ifdef WITH_PYTHON /* run any texts that were loaded in and flagged as modules */ BPY_driver_reset(); + BPY_app_handlers_reset(); BPY_modules_load_user(C); #endif @@ -1199,6 +1201,8 @@ int main(int argc, const char **argv) IMB_init(); + BLI_cb_init(); + #ifdef WITH_GAMEENGINE syshandle = SYS_GetSystem(); #else |