[Bf-extensions-cvs] [26fb63e5] xr-controller-support: VR: Add toggles for controller profile extensions

Peter Kim noreply at git.blender.org
Fri Aug 13 00:29:25 CEST 2021


Commit: 26fb63e5636836de6c4df26edab9e39dcd2d46b6
Author: Peter Kim
Date:   Fri Aug 13 07:04:37 2021 +0900
Branches: xr-controller-support
https://developer.blender.org/rBA26fb63e5636836de6c4df26edab9e39dcd2d46b6

VR: Add toggles for controller profile extensions

Allows users to enable/disable controller bindings that require
OpenXR extensions (Reverb G2, Cosmos, Huawei). Extension
bindings are disabled by default since runtimes might not support
them, but the user can easily enable them now for compatible runtimes
instead of having to import separate action maps as was previously
necessary.

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

M	viewport_vr_preview/__init__.py
M	viewport_vr_preview/configs/default.py
M	viewport_vr_preview/defaults.py
M	viewport_vr_preview/main.py
M	viewport_vr_preview/versioning.py

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

diff --git a/viewport_vr_preview/__init__.py b/viewport_vr_preview/__init__.py
index a9511c82..cb2a4c74 100644
--- a/viewport_vr_preview/__init__.py
+++ b/viewport_vr_preview/__init__.py
@@ -36,10 +36,10 @@ bl_info = {
 
 if "bpy" in locals():
     import importlib
-    importlib.reload(main)
     importlib.reload(defaults)
+    importlib.reload(main)
 else:
-    from . import main, defaults
+    from . import defaults, main
 
 import bpy
 
@@ -52,6 +52,7 @@ classes = (
     main.VIEW3D_PT_vr_actions_actions,
     main.VIEW3D_PT_vr_actions_haptics,
     main.VIEW3D_PT_vr_actions_bindings,
+    main.VIEW3D_PT_vr_actions_extensions,
     main.VIEW3D_PT_vr_motion_capture,
     main.VIEW3D_PT_vr_viewport_feedback,
 
@@ -120,6 +121,18 @@ def register():
     bpy.types.Scene.vr_landmarks_active = bpy.props.IntProperty(
         update=main.vr_landmark_active_update,
     )
+    bpy.types.Scene.vr_actions_enable_cosmos = bpy.props.BoolProperty(
+        description="Enable bindings for the HTC Vive Cosmos controllers. Note that this may not be supported by all OpenXR runtimes",
+        default=False,
+    )
+    bpy.types.Scene.vr_actions_enable_huawei = bpy.props.BoolProperty(
+        description="Enable bindings for the Huawei controllers. Note that this may not be supported by all OpenXR runtimes",
+        default=False,
+    )
+    bpy.types.Scene.vr_actions_enable_reverb_g2 = bpy.props.BoolProperty(
+        description="Enable bindings for the HP Reverb G2 controllers. Note that this may not be supported by all OpenXR runtimes",
+        default=False,
+    )
     bpy.types.Scene.vr_headset_object = bpy.props.PointerProperty(
         name="Headset Object",
         type=bpy.types.Object,
@@ -164,6 +177,9 @@ def unregister():
     del bpy.types.Scene.vr_landmarks
     del bpy.types.Scene.vr_landmarks_selected
     del bpy.types.Scene.vr_landmarks_active
+    del bpy.types.Scene.vr_actions_enable_cosmos
+    del bpy.types.Scene.vr_actions_enable_huawei
+    del bpy.types.Scene.vr_actions_enable_reverb_g2
     del bpy.types.Scene.vr_headset_object
     del bpy.types.Scene.vr_controller0_object
     del bpy.types.Scene.vr_controller1_object
diff --git a/viewport_vr_preview/configs/default.py b/viewport_vr_preview/configs/default.py
index dd24dd54..9d72018f 100644
--- a/viewport_vr_preview/configs/default.py
+++ b/viewport_vr_preview/configs/default.py
@@ -1,24 +1,30 @@
-actionconfig_version = (3, 0, 15)
+actionconfig_version = (3, 0, 17)
 actionconfig_data = \
 [("blender_default",
   {"items":
    [("controller_grip", {"type": 'POSE', "user_path0": '/user/hand/left', "user_path1": '/user/hand/right', "pose_is_controller_grip": 'True', "pose_is_controller_aim": 'False'}, None,
      {"bindings":
-      [("simple", {"profile": '/interaction_profiles/khr/simple_controller', "component_path0": '/input/grip/pose', "component_path1": '/input/grip/pose', "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
+      [("cosmos", {"profile": '/interaction_profiles/htc/vive_cosmos_controller', "component_path0": '/input/grip/pose', "component_path1": '/input/grip/pose', "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
+       ("huawei", {"profile": '/interaction_profiles/huawei/controller', "component_path0": '/input/grip/pose', "component_path1": '/input/grip/pose', "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
+       ("index", {"profile": '/interaction_profiles/valve/index_controller', "component_path0": '/input/grip/pose', "component_path1": '/input/grip/pose', "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
        ("oculus", {"profile": '/interaction_profiles/oculus/touch_controller', "component_path0": '/input/grip/pose', "component_path1": '/input/grip/pose', "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
-       ("wmr", {"profile": '/interaction_profiles/microsoft/motion_controller', "component_path0": '/input/grip/pose', "component_path1": '/input/grip/pose', "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
+       ("reverb_g2", {"profile": '/interaction_profiles/hp/mixed_reality_controller', "component_path0": '/input/grip/pose', "component_path1": '/input/grip/pose', "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
+       ("simple", {"profile": '/interaction_profiles/khr/simple_controller', "component_path0": '/input/grip/pose', "component_path1": '/input/grip/pose', "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
        ("vive", {"profile": '/interaction_profiles/htc/vive_controller', "component_path0": '/input/grip/pose', "component_path1": '/input/grip/pose', "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
-       ("index", {"profile": '/interaction_profiles/valve/index_controller', "component_path0": '/input/grip/pose', "component_path1": '/input/grip/pose', "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
+       ("wmr", {"profile": '/interaction_profiles/microsoft/motion_controller', "component_path0": '/input/grip/pose', "component_path1": '/input/grip/pose', "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
        ],
       },
      ),
     ("controller_aim", {"type": 'POSE', "user_path0": '/user/hand/left', "user_path1": '/user/hand/right', "pose_is_controller_grip": 'False', "pose_is_controller_aim": 'True'}, None,
      {"bindings":
-      [("simple", {"profile": '/interaction_profiles/khr/simple_controller', "component_path0": '/input/aim/pose', "component_path1": '/input/aim/pose', "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
+      [("cosmos", {"profile": '/interaction_profiles/htc/vive_cosmos_controller', "component_path0": '/input/aim/pose', "component_path1": '/input/aim/pose', "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
+       ("huawei", {"profile": '/interaction_profiles/huawei/controller', "component_path0": '/input/aim/pose', "component_path1": '/input/aim/pose', "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
+       ("index", {"profile": '/interaction_profiles/valve/index_controller', "component_path0": '/input/aim/pose', "component_path1": '/input/aim/pose', "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
        ("oculus", {"profile": '/interaction_profiles/oculus/touch_controller', "component_path0": '/input/aim/pose', "component_path1": '/input/aim/pose', "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
-       ("wmr", {"profile": '/interaction_profiles/microsoft/motion_controller', "component_path0": '/input/aim/pose', "component_path1": '/input/aim/pose', "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
+       ("reverb_g2", {"profile": '/interaction_profiles/hp/mixed_reality_controller', "component_path0": '/input/aim/pose', "component_path1": '/input/aim/pose', "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
+       ("simple", {"profile": '/interaction_profiles/khr/simple_controller', "component_path0": '/input/aim/pose', "component_path1": '/input/aim/pose', "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
        ("vive", {"profile": '/interaction_profiles/htc/vive_controller', "component_path0": '/input/aim/pose', "component_path1": '/input/aim/pose', "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
-       ("index", {"profile": '/interaction_profiles/valve/index_controller', "component_path0": '/input/aim/pose', "component_path1": '/input/aim/pose', "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
+       ("wmr", {"profile": '/interaction_profiles/microsoft/motion_controller', "component_path0": '/input/aim/pose', "component_path1": '/input/aim/pose', "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
        ],
       },
      ),
@@ -30,11 +36,14 @@ actionconfig_data = \
        ],
       },     
      {"bindings":
-      [("simple", {"profile": '/interaction_profiles/khr/simple_controller', "component_path0": '/input/select/click', "component_path1": '', "threshold": '0.30000001192092896', "axis_region": 'ANY'}),
+      [("cosmos", {"profile": '/interaction_profiles/htc/vive_cosmos_controller', "component_path0": '/input/trigger/value', "component_path1": '', "threshold": '0.30000001192092896', "axis_region": 'ANY'}),
+       ("huawei", {"profile": '/interaction_profiles/huawei/controller', "component_path0": '/input/trigger/value', "component_path1": '', "threshold": '0.30000001192092896', "axis_region": 'ANY'}),
+       ("index", {"profile": '/interaction_profiles/valve/index_controller', "component_path0": '/input/trigger/value', "component_path1": '', "threshold": '0.30000001192092896', "axis_region": 'ANY'}),
        ("oculus", {"profile": '/interaction_profiles/oculus/touch_controller', "component_path0": '/input/trigger/value', "component_path1": '', "threshold": '0.30000001192092896', "axis_region": 'ANY'}),
-       ("wmr", {"profile": '/interaction_profiles/microsoft/motion_controller', "component_path0": '/input/trigger/value', "component_path1": '', "threshold": '0.30000001192092896', "axis_region": 'ANY'}),
+       ("reverb_g2", {"profile": '/interaction_profiles/hp/mixed_reality_controller', "component_path0": '/input/trigger/value', "component_path1": '', "threshold": '0.30000001192092896', "axis_region": 'ANY'}),
+       ("simple", {"profile": '/interaction_profiles/khr/simple_controller', "component_path0": '/input/select/click', "component_path1": '', "threshold": '0.30000001192092896', "axis_region": 'ANY'}),
        ("vive", {"profile": '/interaction_profiles/htc/vive_controller', "component_path0": '/input/trigger/value', "component_path1": '', "threshold": '0.30000001192092896', "axis_region": 'ANY'}),
-       ("index", {"profile": '/interaction_profiles/valve/index_controller', "component_path0": '/input/trigger/value', "component_path1": '', "threshold": '0.30000001192092896', "axis_region": 'ANY'}),
+       ("wmr", {"profile": '/

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list