forked from standupmaths/xmastree2020
-
Notifications
You must be signed in to change notification settings - Fork 0
/
blender.py
32 lines (27 loc) · 800 Bytes
/
blender.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import sys
import os
import threading
import importlib
import bpy
sys.path.append(os.path.dirname(bpy.data.filepath))
import neopixel
importlib.reload(neopixel)
xmaslights = __import__("xmaslights-spin")
importlib.reload(xmaslights)
xmaslights.coordfilename = os.path.join(os.path.dirname(bpy.data.filepath),"coords.txt")
duration_seconds = 10
def stop_after_duration():
import time
time.sleep(duration_seconds)
neopixel.finished = True
if __name__ == "__main__":
stop_thread = threading.Thread(target=stop_after_duration)
#Create the LED objects before starting the timer
pixels = neopixel.NeoPixel()
neopixel.finished = False
stop_thread.start()
try:
xmaslights.xmaslight()
except neopixel.FinishedException:
pass
stop_thread.join()