I’ve been trying to figure out how to use Timers properly in Bpy, but haven’t had any good luck.
I’ve seen/tried many examples, but in all cases, I usually end up with the Timer either not Stopping, or not being able to re-start…
Usually the ones I find are using Threading, which sounds like maybe isn’t the way to go?
Basically I’m trying to find a way, to Start/Stop something, where I can run a Def, every X milliseconds, until I Stop/Uncheck a UI Button. Then when Clicking it again/ it would Resume/Start the processes again…
I’ve looked into Modal operators as well, but I don’t want to block the UI. I want the user to be able to Model/Navigate like normal, but be doing processing in the BG, every so often, modifying the Geo they have selected/are working on. If they De-Selected/Changed the Selection, I’d break the Timer/Loop as well and want to Stop.
I was able to use a Callback for one my scripts now, to update per Frame/Timeline Frame.
I have to turn on /play Animation, to get it working, but is something I guess.
Modal is the way to go,
return {‘PASS_THROUGH’} in the modal method let events bubble further so it is not blocking.
The only side effect is autosave not working while any modal is running.