[Bf-extensions-cvs] [45c234f9] xr-controller-support: VR: Refactor action maps, bindings

Peter Kim noreply at git.blender.org
Wed Jul 28 06:10:09 CEST 2021


Commit: 45c234f953f336b07e4dcd34aca30ba783c74591
Author: Peter Kim
Date:   Wed Jul 28 13:09:43 2021 +0900
Branches: xr-controller-support
https://developer.blender.org/rBA45c234f953f336b07e4dcd34aca30ba783c74591

VR: Refactor action maps, bindings

By allowing multiple interaction profiles per action map, there now
only needs to be one default action map (plus an additional one for
gamepad input).

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

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

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

diff --git a/viewport_vr_preview/__init__.py b/viewport_vr_preview/__init__.py
index 3d2c5ffd..a9511c82 100644
--- a/viewport_vr_preview/__init__.py
+++ b/viewport_vr_preview/__init__.py
@@ -51,6 +51,7 @@ classes = (
     main.VIEW3D_PT_vr_actions_actionmaps,
     main.VIEW3D_PT_vr_actions_actions,
     main.VIEW3D_PT_vr_actions_haptics,
+    main.VIEW3D_PT_vr_actions_bindings,
     main.VIEW3D_PT_vr_motion_capture,
     main.VIEW3D_PT_vr_viewport_feedback,
 
@@ -72,6 +73,8 @@ classes = (
     main.VIEW3D_MT_vr_actionmap_menu,
     main.VIEW3D_UL_vr_actions,
     main.VIEW3D_MT_vr_action_menu,
+    main.VIEW3D_UL_vr_actionbindings,
+    main.VIEW3D_MT_vr_actionbinding_menu,
 
     main.VIEW3D_OT_vr_actionmap_add,
     main.VIEW3D_OT_vr_actionmap_remove,
@@ -85,6 +88,10 @@ classes = (
     main.VIEW3D_OT_vr_action_remove,
     main.VIEW3D_OT_vr_action_copy,
     main.VIEW3D_OT_vr_actions_clear,
+    main.VIEW3D_OT_vr_actionbinding_add,
+    main.VIEW3D_OT_vr_actionbinding_remove,
+    main.VIEW3D_OT_vr_actionbinding_copy,
+    main.VIEW3D_OT_vr_actionbindings_clear,
 
     main.VIEW3D_GT_vr_camera_cone,
     main.VIEW3D_GT_vr_controller_grip,
diff --git a/viewport_vr_preview/configs/default.py b/viewport_vr_preview/configs/default.py
index 9611259d..b17dffd3 100644
--- a/viewport_vr_preview/configs/default.py
+++ b/viewport_vr_preview/configs/default.py
@@ -1,486 +1,408 @@
-actionconfig_version = (3, 0, 8)
+actionconfig_version = (3, 0, 13)
 actionconfig_data = \
-[("blender_oculus",
-  {"profile": '/interaction_profiles/oculus/touch_controller'},
+[("blender_default",
   {"items":
-   [("controller_grip", {"type": 'POSE', "user_path0": '/user/hand/left', "component_path0": '/input/grip/pose', "user_path1": '/user/hand/right', "component_path1": '/input/grip/pose', "pose_is_controller_grip": 'True', "pose_is_controller_aim": 'False', "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}, None),
-    ("controller_aim", {"type": 'POSE', "user_path0": '/user/hand/left', "component_path0": '/input/aim/pose', "user_path1": '/user/hand/right', "component_path1": '/input/aim/pose', "pose_is_controller_grip": 'False', "pose_is_controller_aim": 'True', "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}, None),
-    ("teleport",
-     {"type": 'BUTTON', "user_path0": '/user/hand/left', "component_path0": '/input/trigger/value', "user_path1": '', "component_path1": '', "threshold": '0.30000001192092896', "axis_flag": 'ANY', "op": 'wm.xr_navigation_teleport', "op_flag": 'MODAL', "bimanual": 'False', "haptic_name": '', "haptic_match_user_paths": 'False', "haptic_duration": '0.0', "haptic_frequency": '0.0', "haptic_amplitude": '0.0', "haptic_flag": 'PRESS'},
-     {"op_properties":
-      [("interpolation", 0.9),
-       ("color", (0.0, 1.0, 1.0, 1.0)),
-       ],
-      },
-     ),
-    ("nav_grab",
-     {"type": 'BUTTON', "user_path0": '/user/hand/left', "component_path0": '/input/squeeze/value', "user_path1": '/user/hand/right', "component_path1": '/input/squeeze/value', "threshold": '0.30000001192092896', "axis_flag": 'ANY', "op": 'wm.xr_navigation_grab', "op_flag": 'MODAL', "bimanual": 'True', "haptic_name": '', "haptic_match_user_paths": 'False', "haptic_duration": '0.0', "haptic_frequency": '0.0', "haptic_amplitude": '0.0', "haptic_flag": 'PRESS'},
-     {"op_properties":
-      [("lock_rotation", True),
-       ],
-      },
-     ),
-    ("fly", {"type": 'BUTTON', "user_path0": '/user/hand/left', "component_path0": '/input/thumbstick/click', "user_path1": '/user/hand/right', "component_path1": '/input/thumbstick/click', "threshold": '0.30000001192092896', "axis_flag": 'ANY', "op": 'wm.xr_navigation_fly', "op_flag": 'MODAL', "bimanual": 'False', "haptic_name": '', "haptic_match_user_paths": 'False', "haptic_duration": '0.0', "haptic_frequency": '0.0', "haptic_amplitude": '0.0', "haptic_flag": 'PRESS'}, None),
-    ("fly_forward",
-     {"type": 'BUTTON', "user_path0": '/user/hand/left', "component_path0": '/input/thumbstick/y', "user_path1": '', "component_path1": '', "threshold": '0.30000001192092896', "axis_flag": 'POSITIVE', "op": 'wm.xr_navigation_fly', "op_flag": 'MODAL', "bimanual": 'False', "haptic_name": '', "haptic_match_user_paths": 'False', "haptic_duration": '0.0', "haptic_frequency": '0.0', "haptic_amplitude": '0.0', "haptic_flag": 'PRESS'},
-     {"op_properties":
-      [("mode", 'VIEWER_FORWARD'),
-       ("lock_location_z", True),
-       ],
-      },
-     ),
-    ("fly_back",
-     {"type": 'BUTTON', "user_path0": '/user/hand/left', "component_path0": '/input/thumbstick/y', "user_path1": '', "component_path1": '', "threshold": '0.30000001192092896', "axis_flag": 'NEGATIVE', "op": 'wm.xr_navigation_fly', "op_flag": 'MODAL', "bimanual": 'False', "haptic_name": '', "haptic_match_user_paths": 'False', "haptic_duration": '0.0', "haptic_frequency": '0.0', "haptic_amplitude": '0.0', "haptic_flag": 'PRESS'},
-     {"op_properties":
-      [("mode", 'VIEWER_BACK'),
-       ("lock_location_z", True),
-       ],
-      },
-     ),
-    ("fly_left",
-     {"type": 'BUTTON', "user_path0": '/user/hand/left', "component_path0": '/input/thumbstick/x', "user_path1": '', "component_path1": '', "threshold": '0.30000001192092896', "axis_flag": 'NEGATIVE', "op": 'wm.xr_navigation_fly', "op_flag": 'MODAL', "bimanual": 'False', "haptic_name": '', "haptic_match_user_paths": 'False', "haptic_duration": '0.0', "haptic_frequency": '0.0', "haptic_amplitude": '0.0', "haptic_flag": 'PRESS'},
-     {"op_properties":
-      [("mode", 'VIEWER_LEFT'),
-       ("lock_location_z", True),
+   [("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)'}),
+       ("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)'}),
+       ("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)'}),
        ],
       },
      ),
-    ("fly_right",
-     {"type": 'BUTTON', "user_path0": '/user/hand/left', "component_path0": '/input/thumbstick/x', "user_path1": '', "component_path1": '', "threshold": '0.30000001192092896', "axis_flag": 'POSITIVE', "op": 'wm.xr_navigation_fly', "op_flag": 'MODAL', "bimanual": 'False', "haptic_name": '', "haptic_match_user_paths": 'False', "haptic_duration": '0.0', "haptic_frequency": '0.0', "haptic_amplitude": '0.0', "haptic_flag": 'PRESS'},
-     {"op_properties":
-      [("mode", 'VIEWER_RIGHT'),
-       ("lock_location_z", True),
+    ("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)'}),
+       ("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)'}),
+       ("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)'}),
        ],
       },
      ),
-    ("fly_up",
-     {"type": 'BUTTON', "user_path0": '/user/hand/right', "component_path0": '/input/thumbstick/y', "user_path1": '', "component_path1": '', "threshold": '0.30000001192092896', "axis_flag": 'POSITIVE', "op": 'wm.xr_navigation_fly', "op_flag": 'MODAL', "bimanual": 'False', "haptic_name": '', "haptic_match_user_paths": 'False', "haptic_duration": '0.0', "haptic_frequency": '0.0', "haptic_amplitude": '0.0', "haptic_flag": 'PRESS'},
-     {"op_properties":
-      [("mode", 'UP'),
-       ("speed_min", 0.014),
-       ("speed_max", 0.042),
-       ],
-      },
-     ),
-    ("fly_down",
-     {"type": 'BUTTON', "user_path0": '/user/hand/right', "component_path0": '/input/thumbstick/y', "user_path1": '', "component_path1": '', "threshold": '0.30000001192092896', "axis_flag": 'NEGATIVE', "op": 'wm.xr_navigation_fly', "op_flag": 'MODAL', "bimanual": 'False', "haptic_name": '', "haptic_match_user_paths": 'False', "haptic_duration": '0.0', "haptic_frequency": '0.0', "haptic_amplitude": '0.0', "haptic_flag": 'PRESS'},
-     {"op_properties":
-      [("mode", 'DOWN'),
-       ("speed_min", 0.014),
-       ("speed_max", 0.042),
-       ],
-      },
-     ),
-    ("fly_turnleft",
-     {"type": 'BUTTON', "user_path0": '/user/hand/right', "component_path0": '/input/thumbstick/x', "user_path1": '', "comp

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list