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)
This commit is contained in:
2011-11-03 06:53:52 +00:00
parent 7d7977658a
commit e2393d1109
6 changed files with 119 additions and 11 deletions

View File

@@ -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