Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Dalai Felinto
virtual_reality_viewport
Commits
2a4568ff
Commit
2a4568ff
authored
Sep 28, 2015
by
Dalai Felinto
Browse files
Run the preview for the original viewport only
parent
af32ea8b
Changes
1
Hide whitespace changes
Inline
Side-by-side
space_view3d_virtual_reality/operator.py
View file @
2a4568ff
...
...
@@ -28,6 +28,7 @@ class VirtualRealityDisplayOperator(bpy.types.Operator):
_handle
=
None
_width
=
1920
_height
=
1080
_area_hash
=
-
1
action
=
bpy
.
props
.
EnumProperty
(
description
=
""
,
...
...
@@ -45,17 +46,23 @@ class VirtualRealityDisplayOperator(bpy.types.Operator):
def
modal
(
self
,
context
,
event
):
wm
=
context
.
window_manager
vr
=
wm
.
virtual_reality
area
=
context
.
area
if
not
area
:
self
.
quit
(
context
)
self
.
_quit
(
context
)
return
{
'FINISHED'
}
if
not
vr
.
is_enabled
:
self
.
_quit
(
context
)
context
.
area
.
tag_redraw
()
area
.
tag_redraw
()
return
{
'FINISHED'
}
if
event
.
type
==
'TIMER'
:
self
.
loop
()
if
vr
.
preview_scale
:
context
.
area
.
tag_redraw
()
if
vr
.
preview_scale
and
context
.
area
:
area
.
tag_redraw
()
return
{
'PASS_THROUGH'
}
...
...
@@ -110,7 +117,8 @@ class VirtualRealityDisplayOperator(bpy.types.Operator):
self
.
_preview
.
quit
()
# cleanup viewport
context
.
area
.
tag_redraw
()
if
context
.
area
:
context
.
area
.
tag_redraw
()
def
init
(
self
,
context
):
"""
...
...
@@ -135,6 +143,7 @@ class VirtualRealityDisplayOperator(bpy.types.Operator):
texture
=
self
.
_hmd
.
texture
self
.
_preview
.
init
(
texture
,
width
,
height
)
self
.
_area_hash
=
hash
(
context
.
area
)
# setup modal
self
.
_timer
=
wm
.
event_timer_add
(
1.0
/
75.0
,
context
.
window
)
# 75 Hz
...
...
@@ -164,10 +173,11 @@ class VirtualRealityDisplayOperator(bpy.types.Operator):
def
_draw_callback_px
(
self
,
context
):
"""callback function, run every time the viewport is refreshed"""
wm
=
context
.
window_manager
vr
=
wm
.
virtual_reality
self
.
_preview
.
loop
(
vr
.
preview_scale
)
if
self
.
_area_hash
==
hash
(
context
.
area
):
wm
=
context
.
window_manager
vr
=
wm
.
virtual_reality
self
.
_preview
.
loop
(
vr
.
preview_scale
)
# ############################################################
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment