Skip to content
ui.py 1.38 KiB
Newer Older
Dalai Felinto's avatar
Dalai Felinto committed
import bpy

Dalai Felinto's avatar
Dalai Felinto committed

Dalai Felinto's avatar
Dalai Felinto committed
# ############################################################
# User Interface
# ############################################################

class VirtualRealityPanel(bpy.types.Panel):
    bl_label = "Head Mounted Display"
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'TOOLS'
    bl_category = 'Virtual Reality'

    @staticmethod
    def draw(self, context):
        layout = self.layout
Dalai Felinto's avatar
Dalai Felinto committed
        wm = context.window_manager
        vr = wm.virtual_reality
Dalai Felinto's avatar
Dalai Felinto committed

        col = layout.column()
Dalai Felinto's avatar
Dalai Felinto committed
        if not vr.is_enabled:
            col.operator("view3d.virtual_reality_display", text="Virtual Reality", icon="PLAY").action='ENABLE'
        else:
Dalai Felinto's avatar
Dalai Felinto committed
            col.operator("view3d.virtual_reality_display", text="Virtual Reality", icon="X").action='DISABLE'
Dalai Felinto's avatar
Dalai Felinto committed
            col.separator()
            # col.prop(vr, "preview_scale", text="Preview")
            col.label(text=vr.error_message)

            col.separator()
            col.operator("view3d.virtual_reality_display", text="Re-Center").action='RECENTER'

            col.separator()
            col.row().prop(vr, "tracking_mode", expand=True)

Dalai Felinto's avatar
Dalai Felinto committed

# ############################################################
# Un/Registration
# ############################################################

def register():
    bpy.utils.register_class(VirtualRealityPanel)


def unregister():
    bpy.utils.unregister_class(VirtualRealityPanel)