From 6528492f250ed1c9b030b480f55886667a55fdc4 Mon Sep 17 00:00:00 2001 From: Peter Kim Date: Mon, 4 Apr 2022 17:04:04 +0900 Subject: VR: Add dedicated handling for VR trackers Also refactor the "blender_default_tracker" action map to have separate pose actions for each tracker role (instead of a single pose action with subaction paths for each role) and add controller pose actions. --- viewport_vr_preview/action_map.py | 8 +- viewport_vr_preview/action_map_io.py | 2 + viewport_vr_preview/configs/default.py | 104 +++++++++- viewport_vr_preview/defaults.py | 367 ++++++++++++++++++++++++++++++--- viewport_vr_preview/gui.py | 1 + 5 files changed, 445 insertions(+), 37 deletions(-) diff --git a/viewport_vr_preview/action_map.py b/viewport_vr_preview/action_map.py index ce87873c..cbd16fc2 100644 --- a/viewport_vr_preview/action_map.py +++ b/viewport_vr_preview/action_map.py @@ -111,6 +111,7 @@ def vr_create_actions(context: bpy.context): controller_grip_name = "" controller_aim_name = "" + tracker_names = [] for ami in am.actionmap_items: if len(ami.bindings) < 1: @@ -125,6 +126,8 @@ def vr_create_actions(context: bpy.context): controller_grip_name = ami.name if ami.pose_is_controller_aim: controller_aim_name = ami.name + if ami.pose_is_tracker: + tracker_names.append(ami.name) for amb in ami.bindings: # Check for bindings that require OpenXR extensions. @@ -145,10 +148,13 @@ def vr_create_actions(context: bpy.context): if not ok: return - # Set controller pose actions. + # Set controller and tracker pose actions. if controller_grip_name and controller_aim_name: session_state.controller_pose_actions_set(context, am.name, controller_grip_name, controller_aim_name) + for tracker_name in tracker_names: + session_state.tracker_pose_action_add(context, am.name, tracker_name) + # Set active action set. vr_actionset_active_update(context) diff --git a/viewport_vr_preview/action_map_io.py b/viewport_vr_preview/action_map_io.py index 92b5b676..bd0e6d11 100644 --- a/viewport_vr_preview/action_map_io.py +++ b/viewport_vr_preview/action_map_io.py @@ -63,6 +63,7 @@ def ami_args_as_data(ami): elif ami.type == 'POSE': s.append(f"\"pose_is_controller_grip\": '{ami.pose_is_controller_grip}'") s.append(f"\"pose_is_controller_aim\": '{ami.pose_is_controller_aim}'") + s.append(f"\"pose_is_tracker\": '{ami.pose_is_tracker}'") return "{" + ", ".join(s) + "}" @@ -86,6 +87,7 @@ def ami_data_from_args(ami, args): elif ami.type == 'POSE': ami.pose_is_controller_grip = True if (args["pose_is_controller_grip"] == 'True') else False ami.pose_is_controller_aim = True if (args["pose_is_controller_aim"] == 'True') else False + ami.pose_is_tracker = True if (args["pose_is_tracker"] == 'True') else False def _ami_properties_to_lines_recursive(level, properties, lines): diff --git a/viewport_vr_preview/configs/default.py b/viewport_vr_preview/configs/default.py index 1b5ff7fe..fbd40c1d 100644 --- a/viewport_vr_preview/configs/default.py +++ b/viewport_vr_preview/configs/default.py @@ -1,10 +1,10 @@ # SPDX-License-Identifier: GPL-2.0-or-later -actionconfig_version = (3, 2, 3) +actionconfig_version = (3, 2, 8) actionconfig_data = \ [("blender_default", {"items": - [("controller_grip", {"type": 'POSE', "user_paths": ['/user/hand/left', '/user/hand/right'], "pose_is_controller_grip": 'True', "pose_is_controller_aim": 'False'}, None, + [("controller_grip", {"type": 'POSE', "user_paths": ['/user/hand/left', '/user/hand/right'], "pose_is_controller_grip": 'True', "pose_is_controller_aim": 'False', "pose_is_tracker": 'False'}, None, {"bindings": [("huawei", {"profile": '/interaction_profiles/huawei/controller', "component_paths": ['/input/grip/pose', '/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_paths": ['/input/grip/pose', '/input/grip/pose'], "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}), @@ -18,7 +18,7 @@ actionconfig_data = \ ], }, ), - ("controller_aim", {"type": 'POSE', "user_paths": ['/user/hand/left', '/user/hand/right'], "pose_is_controller_grip": 'False', "pose_is_controller_aim": 'True'}, None, + ("controller_aim", {"type": 'POSE', "user_paths": ['/user/hand/left', '/user/hand/right'], "pose_is_controller_grip": 'False', "pose_is_controller_aim": 'True', "pose_is_tracker": 'False'}, None, {"bindings": [("huawei", {"profile": '/interaction_profiles/huawei/controller', "component_paths": ['/input/aim/pose', '/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_paths": ['/input/aim/pose', '/input/aim/pose'], "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}), @@ -479,9 +479,103 @@ actionconfig_data = \ ), ("blender_default_tracker", {"items": - [("tracker_pose", {"type": 'POSE', "user_paths": ['/user/vive_tracker_htcx/role/left_foot', '/user/vive_tracker_htcx/role/right_foot', '/user/vive_tracker_htcx/role/left_shoulder', '/user/vive_tracker_htcx/role/right_shoulder', '/user/vive_tracker_htcx/role/left_elbow', '/user/vive_tracker_htcx/role/right_elbow', '/user/vive_tracker_htcx/role/left_knee', '/user/vive_tracker_htcx/role/right_knee', '/user/vive_tracker_htcx/role/waist', '/user/vive_tracker_htcx/role/chest', '/user/vive_tracker_htcx/role/camera', '/user/vive_tracker_htcx/role/keyboard'], "pose_is_controller_grip": 'True', "pose_is_controller_aim": 'True'}, None, + [("controller_grip", {"type": 'POSE', "user_paths": ['/user/hand/left', '/user/hand/right'], "pose_is_controller_grip": 'True', "pose_is_controller_aim": 'False', "pose_is_tracker": 'False'}, None, {"bindings": - [("vive_tracker", {"profile": '/interaction_profiles/htc/vive_tracker_htcx', "component_paths": ['/input/grip/pose', '/input/grip/pose', '/input/grip/pose', '/input/grip/pose', '/input/grip/pose', '/input/grip/pose', '/input/grip/pose', '/input/grip/pose', '/input/grip/pose', '/input/grip/pose', '/input/grip/pose', '/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_paths": ['/input/grip/pose', '/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_paths": ['/input/grip/pose', '/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_paths": ['/input/grip/pose', '/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_paths": ['/input/grip/pose', '/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_paths": ['/input/grip/pose', '/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_paths": ['/input/grip/pose', '/input/grip/pose'], "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}), + ("vive_cosmos", {"profile": '/interaction_profiles/htc/vive_cosmos_controller', "component_paths": ['/input/grip/pose', '/input/grip/pose'], "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}), + ("vive_focus", {"profile": '/interaction_profiles/htc/vive_focus3_controller', "component_paths": ['/input/grip/pose', '/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_paths": ['/input/grip/pose', '/input/grip/pose'], "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}), + ], + }, + ), + ("controller_aim", {"type": 'POSE', "user_paths": ['/user/hand/left', '/user/hand/right'], "pose_is_controller_grip": 'False', "pose_is_controller_aim": 'True', "pose_is_tracker": 'False'}, None, + {"bindings": + [("huawei", {"profile": '/interaction_profiles/huawei/controller', "component_paths": ['/input/aim/pose', '/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_paths": ['/input/aim/pose', '/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_paths": ['/input/aim/pose', '/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_paths": ['/input/aim/pose', '/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_paths": ['/input/aim/pose', '/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_paths": ['/input/aim/pose', '/input/aim/pose'], "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}), + ("vive_cosmos", {"profile": '/interaction_profiles/htc/vive_cosmos_controller', "component_paths": ['/input/aim/pose', '/input/aim/pose'], "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}), + ("vive_focus", {"profile": '/interaction_profiles/htc/vive_focus3_controller', "component_paths": ['/input/aim/pose', '/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_paths": ['/input/aim/pose', '/input/aim/pose'], "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}), + ], + }, + ), + ("left_foot", {"type": 'POSE', "user_paths": ['/user/vive_tracker_htcx/role/left_foot'], "pose_is_controller_grip": 'False', "pose_is_controller_aim": 'False', "pose_is_tracker": 'True'}, None, + {"bindings": + [("vive_tracker", {"profile": '/interaction_profiles/htc/vive_tracker_htcx', "component_paths": ['/input/grip/pose'], "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}), + ], + }, + ), + ("right_foot", {"type": 'POSE', "user_paths": ['/user/vive_tracker_htcx/role/right_foot'], "pose_is_controller_grip": 'False', "pose_is_controller_aim": 'False', "pose_is_tracker": 'True'}, None, + {"bindings": + [("vive_tracker", {"profile": '/interaction_profiles/htc/vive_tracker_htcx', "component_paths": ['/input/grip/pose'], "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}), + ], + }, + ), + ("left_shoulder", {"type": 'POSE', "user_paths": ['/user/vive_tracker_htcx/role/left_shoulder'], "pose_is_controller_grip": 'False', "pose_is_controller_aim": 'False', "pose_is_tracker": 'True'}, None, + {"bindings": + [("vive_tracker", {"profile": '/interaction_profiles/htc/vive_tracker_htcx', "component_paths": ['/input/grip/pose'], "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}), + ], + }, + ), + ("right_shoulder", {"type": 'POSE', "user_paths": ['/user/vive_tracker_htcx/role/right_shoulder'], "pose_is_controller_grip": 'False', "pose_is_controller_aim": 'False', "pose_is_tracker": 'True'}, None, + {"bindings": + [("vive_tracker", {"profile": '/interaction_profiles/htc/vive_tracker_htcx', "component_paths": ['/input/grip/pose'], "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}), + ], + }, + ), + ("left_elbow", {"type": 'POSE', "user_paths": ['/user/vive_tracker_htcx/role/left_elbow'], "pose_is_controller_grip": 'False', "pose_is_controller_aim": 'False', "pose_is_tracker": 'True'}, None, + {"bindings": + [("vive_tracker", {"profile": '/interaction_profiles/htc/vive_tracker_htcx', "component_paths": ['/input/grip/pose'], "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}), + ], + }, + ), + ("right_elbow", {"type": 'POSE', "user_paths": ['/user/vive_tracker_htcx/role/right_elbow'], "pose_is_controller_grip": 'False', "pose_is_controller_aim": 'False', "pose_is_tracker": 'True'}, None, + {"bindings": + [("vive_tracker", {"profile": '/interaction_profiles/htc/vive_tracker_htcx', "component_paths": ['/input/grip/pose'], "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}), + ], + }, + ), + ("left_knee", {"type": 'POSE', "user_paths": ['/user/vive_tracker_htcx/role/left_knee'], "pose_is_controller_grip": 'False', "pose_is_controller_aim": 'False', "pose_is_tracker": 'True'}, None, + {"bindings": + [("vive_tracker", {"profile": '/interaction_profiles/htc/vive_tracker_htcx', "component_paths": ['/input/grip/pose'], "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}), + ], + }, + ), + ("right_knee", {"type": 'POSE', "user_paths": ['/user/vive_tracker_htcx/role/right_knee'], "pose_is_controller_grip": 'False', "pose_is_controller_aim": 'False', "pose_is_tracker": 'True'}, None, + {"bindings": + [("vive_tracker", {"profile": '/interaction_profiles/htc/vive_tracker_htcx', "component_paths": ['/input/grip/pose'], "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}), + ], + }, + ), + ("waist", {"type": 'POSE', "user_paths": ['/user/vive_tracker_htcx/role/waist'], "pose_is_controller_grip": 'False', "pose_is_controller_aim": 'False', "pose_is_tracker": 'True'}, None, + {"bindings": + [("vive_tracker", {"profile": '/interaction_profiles/htc/vive_tracker_htcx', "component_paths": ['/input/grip/pose'], "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}), + ], + }, + ), + ("chest", {"type": 'POSE', "user_paths": ['/user/vive_tracker_htcx/role/chest'], "pose_is_controller_grip": 'False', "pose_is_controller_aim": 'False', "pose_is_tracker": 'True'}, None, + {"bindings": + [("vive_tracker", {"profile": '/interaction_profiles/htc/vive_tracker_htcx', "component_paths": ['/input/grip/pose'], "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}), + ], + }, + ), + ("camera", {"type": 'POSE', "user_paths": ['/user/vive_tracker_htcx/role/camera'], "pose_is_controller_grip": 'False', "pose_is_controller_aim": 'False', "pose_is_tracker": 'True'}, None, + {"bindings": + [("vive_tracker", {"profile": '/interaction_profiles/htc/vive_tracker_htcx', "component_paths": ['/input/grip/pose'], "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}), + ], + }, + ), + ("keyboard", {"type": 'POSE', "user_paths": ['/user/vive_tracker_htcx/role/keyboard'], "pose_is_controller_grip": 'False', "pose_is_controller_aim": 'False', "pose_is_tracker": 'True'}, None, + {"bindings": + [("vive_tracker", {"profile": '/interaction_profiles/htc/vive_tracker_htcx', "component_paths": ['/input/grip/pose'], "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}), ], }, ), diff --git a/viewport_vr_preview/defaults.py b/viewport_vr_preview/defaults.py index aa940c2d..33b263d0 100644 --- a/viewport_vr_preview/defaults.py +++ b/viewport_vr_preview/defaults.py @@ -20,12 +20,23 @@ class VRDefaultActionmaps(Enum): GAMEPAD = "blender_default_gamepad" TRACKER = "blender_default_tracker" - # Default actions. class VRDefaultActions(Enum): CONTROLLER_GRIP = "controller_grip" CONTROLLER_AIM = "controller_aim" - TRACKER_POSE = "tracker_pose" + TRACKER_HANDHELD_OBJECT = "handheld_object" + TRACKER_LEFT_FOOT = "left_foot" + TRACKER_RIGHT_FOOT = "right_foot" + TRACKER_LEFT_SHOULDER = "left_shoulder" + TRACKER_RIGHT_SHOULDER = "right_shoulder" + TRACKER_LEFT_ELBOW = "left_elbow" + TRACKER_RIGHT_ELBOW = "right_elbow" + TRACKER_LEFT_KNEE = "left_knee" + TRACKER_RIGHT_KNEE = "right_knee" + TRACKER_WAIST = "waist" + TRACKER_CHEST = "chest" + TRACKER_CAMERA = "camera" + TRACKER_KEYBOARD = "keyboard" TELEPORT = "teleport" NAV_GRAB = "nav_grab" FLY = "fly" @@ -120,7 +131,8 @@ def vr_defaults_pose_action_add(am, name, user_paths, is_controller_grip, - is_controller_aim): + is_controller_aim, + is_tracker): ami = am.actionmap_items.new(name, True) if ami: ami.type = 'POSE' @@ -128,6 +140,7 @@ def vr_defaults_pose_action_add(am, ami.user_paths.new(path) ami.pose_is_controller_grip = is_controller_grip ami.pose_is_controller_aim = is_controller_aim + ami.pose_is_tracker = is_tracker return ami @@ -204,6 +217,7 @@ def vr_defaults_create_default(session_settings): ["/user/hand/left", "/user/hand/right"], True, + False, False) if ami: vr_defaults_pose_actionbinding_add(ami, @@ -275,7 +289,8 @@ def vr_defaults_create_default(session_settings): ["/user/hand/left", "/user/hand/right"], False, - True) + True, + False) if ami: vr_defaults_pose_actionbinding_add(ami, VRDefaultActionbindings.HUAWEI.value, @@ -1820,39 +1835,329 @@ def vr_defaults_create_default_tracker(session_settings): return ami = vr_defaults_pose_action_add(am, - VRDefaultActions.TRACKER_POSE.value, - [#"/user/vive_tracker_htcx/role/handheld_object", # SteamVR (1.21) fails to assign interaction profile. - "/user/vive_tracker_htcx/role/left_foot", - "/user/vive_tracker_htcx/role/right_foot", - "/user/vive_tracker_htcx/role/left_shoulder", - "/user/vive_tracker_htcx/role/right_shoulder", - "/user/vive_tracker_htcx/role/left_elbow", - "/user/vive_tracker_htcx/role/right_elbow", - "/user/vive_tracker_htcx/role/left_knee", - "/user/vive_tracker_htcx/role/right_knee", - "/user/vive_tracker_htcx/role/waist", - "/user/vive_tracker_htcx/role/chest", - "/user/vive_tracker_htcx/role/camera", - "/user/vive_tracker_htcx/role/keyboard"], + VRDefaultActions.CONTROLLER_GRIP.value, + ["/user/hand/left", + "/user/hand/right"], True, + False, + False) + if ami: + vr_defaults_pose_actionbinding_add(ami, + VRDefaultActionbindings.HUAWEI.value, + VRDefaultActionprofiles.HUAWEI.value, + ["/input/grip/pose", + "/input/grip/pose"], + (0, 0, 0), + (0, 0, 0)) + vr_defaults_pose_actionbinding_add(ami, + VRDefaultActionbindings.INDEX.value, + VRDefaultActionprofiles.INDEX.value, + ["/input/grip/pose", + "/input/grip/pose"], + (0, 0, 0), + (0, 0, 0)) + vr_defaults_pose_actionbinding_add(ami, + VRDefaultActionbindings.OCULUS.value, + VRDefaultActionprofiles.OCULUS.value, + ["/input/grip/pose", + "/input/grip/pose"], + (0, 0, 0), + (0, 0, 0)) + vr_defaults_pose_actionbinding_add(ami, + VRDefaultActionbindings.REVERB_G2.value, + VRDefaultActionprofiles.REVERB_G2.value, + ["/input/grip/pose", + "/input/grip/pose"], + (0, 0, 0), + (0, 0, 0)) + vr_defaults_pose_actionbinding_add(ami, + VRDefaultActionbindings.SIMPLE.value, + VRDefaultActionprofiles.SIMPLE.value, + ["/input/grip/pose", + "/input/grip/pose"], + (0, 0, 0), + (0, 0, 0)) + vr_defaults_pose_actionbinding_add(ami, + VRDefaultActionbindings.VIVE.value, + VRDefaultActionprofiles.VIVE.value, + ["/input/grip/pose", + "/input/grip/pose"], + (0, 0, 0), + (0, 0, 0)) + vr_defaults_pose_actionbinding_add(ami, + VRDefaultActionbindings.VIVE_COSMOS.value, + VRDefaultActionprofiles.VIVE_COSMOS.value, + ["/input/grip/pose", + "/input/grip/pose"], + (0, 0, 0), + (0, 0, 0)) + vr_defaults_pose_actionbinding_add(ami, + VRDefaultActionbindings.VIVE_FOCUS.value, + VRDefaultActionprofiles.VIVE_FOCUS.value, + ["/input/grip/pose", + "/input/grip/pose"], + (0, 0, 0), + (0, 0, 0)) + vr_defaults_pose_actionbinding_add(ami, + VRDefaultActionbindings.WMR.value, + VRDefaultActionprofiles.WMR.value, + ["/input/grip/pose", + "/input/grip/pose"], + (0, 0, 0), + (0, 0, 0)) + + ami = vr_defaults_pose_action_add(am, + VRDefaultActions.CONTROLLER_AIM.value, + ["/user/hand/left", + "/user/hand/right"], + False, + True, + False) + if ami: + vr_defaults_pose_actionbinding_add(ami, + VRDefaultActionbindings.HUAWEI.value, + VRDefaultActionprofiles.HUAWEI.value, + ["/input/aim/pose", + "/input/aim/pose"], + (0, 0, 0), + (0, 0, 0)) + vr_defaults_pose_actionbinding_add(ami, + VRDefaultActionbindings.INDEX.value, + VRDefaultActionprofiles.INDEX.value, + ["/input/aim/pose", + "/input/aim/pose"], + (0, 0, 0), + (0, 0, 0)) + vr_defaults_pose_actionbinding_add(ami, + VRDefaultActionbindings.OCULUS.value, + VRDefaultActionprofiles.OCULUS.value, + ["/input/aim/pose", + "/input/aim/pose"], + (0, 0, 0), + (0, 0, 0)) + vr_defaults_pose_actionbinding_add(ami, + VRDefaultActionbindings.REVERB_G2.value, + VRDefaultActionprofiles.REVERB_G2.value, + ["/input/aim/pose", + "/input/aim/pose"], + (0, 0, 0), + (0, 0, 0)) + vr_defaults_pose_actionbinding_add(ami, + VRDefaultActionbindings.SIMPLE.value, + VRDefaultActionprofiles.SIMPLE.value, + ["/input/aim/pose", + "/input/aim/pose"], + (0, 0, 0), + (0, 0, 0)) + vr_defaults_pose_actionbinding_add(ami, + VRDefaultActionbindings.VIVE.value, + VRDefaultActionprofiles.VIVE.value, + ["/input/aim/pose", + "/input/aim/pose"], + (0, 0, 0), + (0, 0, 0)) + vr_defaults_pose_actionbinding_add(ami, + VRDefaultActionbindings.VIVE_COSMOS.value, + VRDefaultActionprofiles.VIVE_COSMOS.value, + ["/input/aim/pose", + "/input/aim/pose"], + (0, 0, 0), + (0, 0, 0)) + vr_defaults_pose_actionbinding_add(ami, + VRDefaultActionbindings.VIVE_FOCUS.value, + VRDefaultActionprofiles.VIVE_FOCUS.value, + ["/input/aim/pose", + "/input/aim/pose"], + (0, 0, 0), + (0, 0, 0)) + vr_defaults_pose_actionbinding_add(ami, + VRDefaultActionbindings.WMR.value, + VRDefaultActionprofiles.WMR.value, + ["/input/aim/pose", + "/input/aim/pose"], + (0, 0, 0), + (0, 0, 0)) + + # SteamVR (1.21) fails to assign interaction profile. +# ami = vr_defaults_pose_action_add(am, +# VRDefaultActions.TRACKER_HANDHELD_OBJECT.value, +# ["/user/vive_tracker_htcx/role/handheld_object"], +# False, +# False, +# True) +# if ami: +# vr_defaults_pose_actionbinding_add(ami, +# VRDefaultActionbindings.VIVE_TRACKER.value, +# VRDefaultActionprofiles.VIVE_TRACKER.value, +# ["/input/grip/pose"], +# (0, 0, 0), +# (0, 0, 0)) + + ami = vr_defaults_pose_action_add(am, + VRDefaultActions.TRACKER_LEFT_FOOT.value, + ["/user/vive_tracker_htcx/role/left_foot"], + False, + False, True) if ami: vr_defaults_pose_actionbinding_add(ami, VRDefaultActionbindings.VIVE_TRACKER.value, VRDefaultActionprofiles.VIVE_TRACKER.value, - [#"/input/grip/pose", - "/input/grip/pose", - "/input/grip/pose", - "/input/grip/pose", - "/input/grip/pose", - "/input/grip/pose", - "/input/grip/pose", - "/input/grip/pose", - "/input/grip/pose", - "/input/grip/pose", - "/input/grip/pose", - "/input/grip/pose", - "/input/grip/pose"], + ["/input/grip/pose"], + (0, 0, 0), + (0, 0, 0)) + + ami = vr_defaults_pose_action_add(am, + VRDefaultActions.TRACKER_RIGHT_FOOT.value, + ["/user/vive_tracker_htcx/role/right_foot"], + False, + False, + True) + if ami: + vr_defaults_pose_actionbinding_add(ami, + VRDefaultActionbindings.VIVE_TRACKER.value, + VRDefaultActionprofiles.VIVE_TRACKER.value, + ["/input/grip/pose"], + (0, 0, 0), + (0, 0, 0)) + + ami = vr_defaults_pose_action_add(am, + VRDefaultActions.TRACKER_LEFT_SHOULDER.value, + ["/user/vive_tracker_htcx/role/left_shoulder"], + False, + False, + True) + if ami: + vr_defaults_pose_actionbinding_add(ami, + VRDefaultActionbindings.VIVE_TRACKER.value, + VRDefaultActionprofiles.VIVE_TRACKER.value, + ["/input/grip/pose"], + (0, 0, 0), + (0, 0, 0)) + + ami = vr_defaults_pose_action_add(am, + VRDefaultActions.TRACKER_RIGHT_SHOULDER.value, + ["/user/vive_tracker_htcx/role/right_shoulder"], + False, + False, + True) + if ami: + vr_defaults_pose_actionbinding_add(ami, + VRDefaultActionbindings.VIVE_TRACKER.value, + VRDefaultActionprofiles.VIVE_TRACKER.value, + ["/input/grip/pose"], + (0, 0, 0), + (0, 0, 0)) + + ami = vr_defaults_pose_action_add(am, + VRDefaultActions.TRACKER_LEFT_ELBOW.value, + ["/user/vive_tracker_htcx/role/left_elbow"], + False, + False, + True) + if ami: + vr_defaults_pose_actionbinding_add(ami, + VRDefaultActionbindings.VIVE_TRACKER.value, + VRDefaultActionprofiles.VIVE_TRACKER.value, + ["/input/grip/pose"], + (0, 0, 0), + (0, 0, 0)) + + ami = vr_defaults_pose_action_add(am, + VRDefaultActions.TRACKER_RIGHT_ELBOW.value, + ["/user/vive_tracker_htcx/role/right_elbow"], + False, + False, + True) + if ami: + vr_defaults_pose_actionbinding_add(ami, + VRDefaultActionbindings.VIVE_TRACKER.value, + VRDefaultActionprofiles.VIVE_TRACKER.value, + ["/input/grip/pose"], + (0, 0, 0), + (0, 0, 0)) + + ami = vr_defaults_pose_action_add(am, + VRDefaultActions.TRACKER_LEFT_KNEE.value, + ["/user/vive_tracker_htcx/role/left_knee"], + False, + False, + True) + if ami: + vr_defaults_pose_actionbinding_add(ami, + VRDefaultActionbindings.VIVE_TRACKER.value, + VRDefaultActionprofiles.VIVE_TRACKER.value, + ["/input/grip/pose"], + (0, 0, 0), + (0, 0, 0)) + + ami = vr_defaults_pose_action_add(am, + VRDefaultActions.TRACKER_RIGHT_KNEE.value, + ["/user/vive_tracker_htcx/role/right_knee"], + False, + False, + True) + if ami: + vr_defaults_pose_actionbinding_add(ami, + VRDefaultActionbindings.VIVE_TRACKER.value, + VRDefaultActionprofiles.VIVE_TRACKER.value, + ["/input/grip/pose"], + (0, 0, 0), + (0, 0, 0)) + + ami = vr_defaults_pose_action_add(am, + VRDefaultActions.TRACKER_WAIST.value, + ["/user/vive_tracker_htcx/role/waist"], + False, + False, + True) + if ami: + vr_defaults_pose_actionbinding_add(ami, + VRDefaultActionbindings.VIVE_TRACKER.value, + VRDefaultActionprofiles.VIVE_TRACKER.value, + ["/input/grip/pose"], + (0, 0, 0), + (0, 0, 0)) + + ami = vr_defaults_pose_action_add(am, + VRDefaultActions.TRACKER_CHEST.value, + ["/user/vive_tracker_htcx/role/chest"], + False, + False, + True) + if ami: + vr_defaults_pose_actionbinding_add(ami, + VRDefaultActionbindings.VIVE_TRACKER.value, + VRDefaultActionprofiles.VIVE_TRACKER.value, + ["/input/grip/pose"], + (0, 0, 0), + (0, 0, 0)) + + ami = vr_defaults_pose_action_add(am, + VRDefaultActions.TRACKER_CAMERA.value, + ["/user/vive_tracker_htcx/role/camera"], + False, + False, + True) + if ami: + vr_defaults_pose_actionbinding_add(ami, + VRDefaultActionbindings.VIVE_TRACKER.value, + VRDefaultActionprofiles.VIVE_TRACKER.value, + ["/input/grip/pose"], + (0, 0, 0), + (0, 0, 0)) + + ami = vr_defaults_pose_action_add(am, + VRDefaultActions.TRACKER_KEYBOARD.value, + ["/user/vive_tracker_htcx/role/keyboard"], + False, + False, + True) + if ami: + vr_defaults_pose_actionbinding_add(ami, + VRDefaultActionbindings.VIVE_TRACKER.value, + VRDefaultActionprofiles.VIVE_TRACKER.value, + ["/input/grip/pose"], (0, 0, 0), (0, 0, 0)) diff --git a/viewport_vr_preview/gui.py b/viewport_vr_preview/gui.py index 1bfce725..931ddd09 100644 --- a/viewport_vr_preview/gui.py +++ b/viewport_vr_preview/gui.py @@ -390,6 +390,7 @@ class VIEW3D_PT_vr_actions_actions(VRActionsPanel, Panel): elif ami.type == 'POSE': col.prop(ami, "pose_is_controller_grip", text="Use for Controller Grips") col.prop(ami, "pose_is_controller_aim", text="Use for Controller Aims") + col.prop(ami, "pose_is_tracker", text="Tracker") class VIEW3D_PT_vr_actions_user_paths(VRActionsPanel, Panel): -- cgit v1.2.3