I have implemented a ModalTimerOperator, based on the sample in Blender's Python templates. At the moment it can be started, stopped and restarted by buttons (located in a menu added to the Info header for testing purposes). Later it should be started automatically when activating the addon I am working on. Important: The timer is intended to run until Blender is closed.
But now I observed that the timer's
cancel() function is called as soon as a *.blend file is loaded, and it stops working therefore (I fear there may be other events doing the same). Putting a return statement into the
cancel() function before calling
wm.event_timer_remove() does not help.
So my questions are:
- How can I prevent my timer from being cancelled?
- Is it possible to restart the timer automatically if cancelled? (My try to restart it from a kind of Python watchdog thread causes Blender to crash as the API documentation's "Gotchas" chapter predicts.)