bpy.app.handlers.1.py 509 B

12345678910111213141516171819202122
  1. """
  2. Persistent Handler Example
  3. ++++++++++++++++++++++++++
  4. By default handlers are freed when loading new files, in some cases you may
  5. want the handler stay running across multiple files (when the handler is
  6. part of an add-on for example).
  7. For this the :data:`bpy.app.handlers.persistent` decorator needs to be used.
  8. """
  9. import bpy
  10. from bpy.app.handlers import persistent
  11. @persistent
  12. def load_handler(dummy):
  13. print("Load Handler:", bpy.data.filepath)
  14. bpy.app.handlers.load_post.append(load_handler)