Python API Docs: Examples for new timer api
This commit is contained in:
17
doc/python_api/examples/bpy.app.timers.3.py
Normal file
17
doc/python_api/examples/bpy.app.timers.3.py
Normal file
@@ -0,0 +1,17 @@
|
||||
"""
|
||||
Run a Function n times every x seconds
|
||||
--------------------------------------
|
||||
"""
|
||||
import bpy
|
||||
|
||||
counter = 0
|
||||
|
||||
def run_10_times():
|
||||
global counter
|
||||
counter += 1
|
||||
print(counter)
|
||||
if counter == 10:
|
||||
return None
|
||||
return 0.1
|
||||
|
||||
bpy.app.timers.register(run_10_times)
|
||||
Reference in New Issue
Block a user