diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-11-03 10:53:52 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-11-03 10:53:52 +0400 |
commit | e2393d11090765caf987e5ef8e2e688d80c0e64d (patch) | |
tree | 2aa909746eb9c11fb47c60740f80fb197384565b /source/blender/windowmanager | |
parent | 7d7977658ad12a940597da5b78ce70e4e5081f4b (diff) |
ability to have permanent callbacks that stay active when new blend files are loaded.
this works by tagging functions, eg:
def my_func(scene):
pass
bpy.app.handlers.permanent_tag(my_func, True) # <-- important bit
bpy.app.handlers.frame_change_pre.append(my_func)
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r-- | source/blender/windowmanager/intern/wm_files.c | 4 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_init_exit.c | 7 |
2 files changed, 6 insertions, 5 deletions
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index c292e9e2825..83e4681251f 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -408,7 +408,7 @@ void WM_read_file(bContext *C, const char *filepath, ReportList *reports) #ifdef WITH_PYTHON /* run any texts that were loaded in and flagged as modules */ BPY_driver_reset(); - BPY_app_handlers_reset(); + BPY_app_handlers_reset(FALSE); BPY_modules_load_user(C); #endif @@ -538,7 +538,7 @@ int WM_read_homefile(bContext *C, ReportList *UNUSED(reports), short from_memory BPY_string_exec(C, "__import__('addon_utils').reset_all()"); BPY_driver_reset(); - BPY_app_handlers_reset(); + BPY_app_handlers_reset(FALSE); BPY_modules_load_user(C); } #endif diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index b0be4bb9720..f32e2afa3e0 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -61,8 +61,9 @@ #include "BKE_sequencer.h" /* free seq clipboard */ #include "BKE_material.h" /* clear_matcopybuf */ -#include "BLI_blenlib.h" -#include "BLI_winstuff.h" +#include "BLI_listbase.h" +#include "BLI_string.h" +#include "BLI_utildefines.h" #include "RE_engine.h" #include "RE_pipeline.h" /* RE_ free stuff */ @@ -158,7 +159,7 @@ void WM_init(bContext *C, int argc, const char **argv) BPY_python_start(argc, argv); BPY_driver_reset(); - BPY_app_handlers_reset(); /* causes addon callbacks to be freed [#28068], + BPY_app_handlers_reset(FALSE); /* causes addon callbacks to be freed [#28068], * but this is actually what we want. */ BPY_modules_load_user(C); #else |