[Bf-extensions-cvs] [5506779b] soc-2019-openxr: Change icon and text for VR session toggle button based on session state

Julian Eisel noreply at git.blender.org
Thu Dec 12 18:41:03 CET 2019


Commit: 5506779be634b6208aa2360ee446375b8341cdcd
Author: Julian Eisel
Date:   Thu Dec 12 18:38:40 2019 +0100
Branches: soc-2019-openxr
https://developer.blender.org/rBA5506779be634b6208aa2360ee446375b8341cdcd

Change icon and text for VR session toggle button based on session state

===================================================================

M	viewport_vr_preview.py

===================================================================

diff --git a/viewport_vr_preview.py b/viewport_vr_preview.py
index 419c1a22..2f367e4a 100644
--- a/viewport_vr_preview.py
+++ b/viewport_vr_preview.py
@@ -48,9 +48,13 @@ class VIEW3D_PT_vr_session(bpy.types.Panel):
         layout.use_property_split = True
         layout.use_property_decorate = False  # No animation.
 
-        self.layout.operator("wm.xr_session_toggle")
+        is_session_running = bpy.types.XrSessionState.is_running(context)
 
-        self.layout.separator()
+        # Using SNAP_FACE because it looks like a stop icon -- I shouldn't have commit rights...
+        toggle_info = ("Start VR Session", 'PLAY') if not is_session_running else ("Stop VR Session", 'SNAP_FACE')
+        layout.operator("wm.xr_session_toggle", text=toggle_info[0], icon=toggle_info[1])
+
+        layout.separator()
 
         layout.prop(session_settings, "shading_type", text="Shading")
         layout.prop(session_settings, "show_floor", text="Floor")



More information about the Bf-extensions-cvs mailing list