[Bf-extensions-cvs] [78874b08] xr-controller-support: VR: Refactor controller poses

Peter Kim noreply at git.blender.org
Thu Jul 22 08:53:27 CEST 2021


Commit: 78874b0816be42ad2ce8a2e4df2c60ea92ce9112
Author: Peter Kim
Date:   Thu Jul 22 01:04:15 2021 +0900
Branches: xr-controller-support
https://developer.blender.org/rBA78874b0816be42ad2ce8a2e4df2c60ea92ce9112

VR: Refactor controller poses

Update with API changes, add controller grip/aim default actions.

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

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/configs/default.py b/viewport_vr_preview/configs/default.py
index 44b16960..9611259d 100644
--- a/viewport_vr_preview/configs/default.py
+++ b/viewport_vr_preview/configs/default.py
@@ -1,9 +1,10 @@
-actionconfig_version = (3, 0, 7)
+actionconfig_version = (3, 0, 8)
 actionconfig_data = \
 [("blender_oculus",
   {"profile": '/interaction_profiles/oculus/touch_controller'},
   {"items":
-   [("controller_pose", {"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": 'True', "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(-0.8726646304130554, 0.0, 0.0)'}, None),
+   [("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":
@@ -99,7 +100,8 @@ actionconfig_data = \
  ("blender_wmr",
   {"profile": '/interaction_profiles/microsoft/motion_controller'},
   {"items":
-   [("controller_pose", {"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": 'True', "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(-0.8726646304130554, 0.0, 0.0)'}, None),
+   [("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":
@@ -195,7 +197,8 @@ actionconfig_data = \
  ("blender_vive",
   {"profile": '/interaction_profiles/htc/vive_controller'},
   {"items":
-   [("controller_pose", {"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": 'True', "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}, None),
+   [("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":
@@ -290,7 +293,8 @@ actionconfig_data = \
  ("blender_index",
   {"profile": '/interaction_profiles/valve/index_controller'},
   {"items":
-   [("controller_pose", {"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": 'True', "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}, None),
+   [("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":
diff --git a/viewport_vr_preview/defaults.py b/viewport_vr_preview/defaults.py
index 1a3629eb..0eef628d 100644
--- a/viewport_vr_preview/defaults.py
+++ b/viewport_vr_preview/defaults.py
@@ -41,7 +41,8 @@ class VRDefaultActionmaps(Enum):
 
 # Default actions.
 class VRDefaultActions(Enum):
-    CONTROLLER_POSE = "controller_pose"
+    CONTROLLER_GRIP = "controller_grip"
+    CONTROLLER_AIM = "controller_aim"
     TELEPORT = "teleport"
     NAV_GRAB = "nav_grab"
     FLY = "fly"
@@ -86,9 +87,9 @@ def vr_defaults_actionmap_item_add(am,
                                    bimanual,
                                    haptic_name,
                                    haptic_match_user_paths,
-                                   haptic_amplitude,
                                    haptic_duration,
                                    haptic_frequency,
+                                   haptic_amplitude,
                                    haptic_flag):
 
 
@@ -121,7 +122,8 @@ def vr_defaults_pose_actionmap_item_add(am,
                                         component_path0,
                                         user_path1,
                                         component_path1,
-                                        is_controller,
+                                        is_controller_grip,
+                                        is_controller_aim,
                                         location,
                                         rotation):
     ami = am.actionmap_items.new(name, True)
@@ -131,7 +133,8 @@ def vr_defaults_pose_actionmap_item_add(am,
         ami.component_path0 = component_path0
         ami.user_path1 = user_path1
         ami.component_path1 = component_path1
-        ami.pose_is_controller = is_controller
+        ami.pose_is_controller_grip = is_controller_grip
+        ami.pose_is_controller_aim = is_controller_aim
         ami.pose_location = location
         ami.pose_rotation = rotation
 
@@ -163,14 +166,25 @@ def vr_defaults_create_oculus(ac):
         return
 
     vr_defaults_pose_actionmap_item_add(am,
-                                        VRDefaultActions.CONTROLLER_POSE.value,
+                                        VRDefaultActions.CONTROLLER_GRIP.value,
                                         "/user/hand/left",
                                         "/input/grip/pose",
                                         "/user/hand/right",
                                         "/input/grip/pose",
                                         True,
+                                        False,
+                                        (0, 0, 0),
+                                        (0, 0, 0))
+    vr_defaults_pose_actionmap_item_add(am,
+                                        VRDefaultActions.CONTROLLER_AIM.value,
+                                        "/user/hand/left",
+                                        "/input/aim/pose",
+                                        "/user/hand/right",
+                                        "/input/aim/pose",
+                                        False,
+                                        True,
                                         (0, 0, 0),
-                                        (math.radians(-50), 0, 0))
+                                        (0, 0, 0))
     vr_defaults_actionmap_item_add(am,
                                    VRDefaultActions.TELEPORT.value,
                                    "/user/hand/left",
@@ -457,14 +471,25 @@ def vr_defaults_create_wmr(ac):
         return
 
     vr_defaults_pose_actionmap_item_add(am

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list