Commit e2c74429 authored by Dalai Felinto's avatar Dalai Felinto
Browse files

Remove timer and ignore the preview functionality for now

parent 4896ac0d
...@@ -57,11 +57,13 @@ class VirtualRealityDisplayOperator(bpy.types.Operator): ...@@ -57,11 +57,13 @@ class VirtualRealityDisplayOperator(bpy.types.Operator):
area.tag_redraw() area.tag_redraw()
return {'FINISHED'} return {'FINISHED'}
"""
if event.type == 'TIMER': if event.type == 'TIMER':
self.loop(context) self.loop(context)
if vr.preview_scale and context.area: if vr.preview_scale and context.area:
area.tag_redraw() area.tag_redraw()
"""
return {'PASS_THROUGH'} return {'PASS_THROUGH'}
...@@ -107,11 +109,6 @@ class VirtualRealityDisplayOperator(bpy.types.Operator): ...@@ -107,11 +109,6 @@ class VirtualRealityDisplayOperator(bpy.types.Operator):
def _quit(self, context): def _quit(self, context):
"""actual quit""" """actual quit"""
wm = context.window_manager
if self._timer:
wm.event_timer_remove(self._timer)
del self._timer
if self._handle: if self._handle:
bpy.types.SpaceView3D.draw_handler_remove(self._handle, 'WINDOW') bpy.types.SpaceView3D.draw_handler_remove(self._handle, 'WINDOW')
...@@ -154,13 +151,12 @@ class VirtualRealityDisplayOperator(bpy.types.Operator): ...@@ -154,13 +151,12 @@ class VirtualRealityDisplayOperator(bpy.types.Operator):
self._area_hash = hash(context.area) self._area_hash = hash(context.area)
# setup modal # setup modal
self._timer = wm.event_timer_add(1.0 / 75.0, context.window) # 75 Hz
self._handle = bpy.types.SpaceView3D.draw_handler_add(self._draw_callback_px, (context,), 'WINDOW', 'POST_PIXEL') self._handle = bpy.types.SpaceView3D.draw_handler_add(self._draw_callback_px, (context,), 'WINDOW', 'POST_PIXEL')
wm.modal_handler_add(self) wm.modal_handler_add(self)
return True return True
def loop(self, context): def _loop(self, context):
""" """
Get fresh tracking data and render into the FBO Get fresh tracking data and render into the FBO
""" """
...@@ -181,10 +177,18 @@ class VirtualRealityDisplayOperator(bpy.types.Operator): ...@@ -181,10 +177,18 @@ class VirtualRealityDisplayOperator(bpy.types.Operator):
def _draw_callback_px(self, context): def _draw_callback_px(self, context):
"""callback function, run every time the viewport is refreshed""" """callback function, run every time the viewport is refreshed"""
if self._area_hash == hash(context.area): area = context.area
wm = context.window_manager if not self._area_hash == hash(area):
vr = wm.virtual_reality return
self._preview.loop(vr.preview_scale)
self._loop(context)
area.tag_redraw()
"""
wm = context.window_manager
vr = wm.virtual_reality
self._preview.loop(vr.preview_scale)
"""
def _error_callback(self, message, is_fatal): def _error_callback(self, message, is_fatal):
""" """
......
...@@ -25,7 +25,7 @@ class VirtualRealityPanel(bpy.types.Panel): ...@@ -25,7 +25,7 @@ class VirtualRealityPanel(bpy.types.Panel):
col.operator("view3d.virtual_reality_display", text="Virtual Reality", icon="X").action='DISABLE' col.operator("view3d.virtual_reality_display", text="Virtual Reality", icon="X").action='DISABLE'
col.separator() col.separator()
col.prop(vr, "preview_scale", text="Preview") # col.prop(vr, "preview_scale", text="Preview")
col.label(text=vr.error_message) col.label(text=vr.error_message)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment