feat: draw users

This commit is contained in:
Swann Martinez
2019-08-14 14:25:20 +02:00
parent 26fde5da43
commit d15c099d05
7 changed files with 96 additions and 91 deletions

View File

@ -30,7 +30,7 @@ class Drawable():
:type duration: float
"""
def __init__(self, coords=DEFAULT_COORDS, indices=DEFAULT_INDICES, location=(0.0, 0.0, 0.0), mode='POINTS', color=(1, 0, 0, 1), duration=1):
def __init__(self, coords=DEFAULT_COORDS, indices=DEFAULT_INDICES, location=(0.0, 0.0, 0.0), mode='POINTS', color=(1, 0, 0, 1), duration=0):
self._duration = duration
self._color = color
self._coord = [tuple(numpy.add(c,location)) for c in coords]
@ -42,8 +42,9 @@ class Drawable():
self._handler = bpy.types.SpaceView3D.draw_handler_add(
self.draw, (), 'WINDOW', 'POST_VIEW')
# Bind the callback
self._timer = bpy.app.timers.register(
self.clear, first_interval=duration)
if duration:
self._timer = bpy.app.timers.register(
self.clear, first_interval=duration)
def draw(self):
self.shader.bind()