diff options
author | Peter Kim <pk15950@gmail.com> | 2021-08-31 12:00:22 +0300 |
---|---|---|
committer | Peter Kim <pk15950@gmail.com> | 2021-08-31 12:00:22 +0300 |
commit | 1bbddad89934a1e18e8d22da75a78838af9e16b3 (patch) | |
tree | 8a08cbd7edc56763b3f41513f4a7c4ace112e210 | |
parent | dcdbf833dad7cbb8ac6cc7a65a55574a22be5c1c (diff) |
VR: Add reset navigation, toggle matview defaults
-rw-r--r-- | viewport_vr_preview/configs/default.py | 76 | ||||
-rw-r--r-- | viewport_vr_preview/defaults.py | 277 |
2 files changed, 251 insertions, 102 deletions
diff --git a/viewport_vr_preview/configs/default.py b/viewport_vr_preview/configs/default.py index 9d72018f..33d2ac7c 100644 --- a/viewport_vr_preview/configs/default.py +++ b/viewport_vr_preview/configs/default.py @@ -1,4 +1,4 @@ -actionconfig_version = (3, 0, 17) +actionconfig_version = (3, 0, 18) actionconfig_data = \ [("blender_default", {"items": @@ -64,16 +64,6 @@ actionconfig_data = \ ], }, ), - ("fly", {"type": 'FLOAT', "user_path0": '/user/hand/left', "user_path1": '/user/hand/right', "op": 'wm.xr_navigation_fly', "op_mode": 'MODAL', "bimanual": 'False', "haptic_name": '', "haptic_match_user_paths": 'False', "haptic_duration": '0.0', "haptic_frequency": '0.0', "haptic_amplitude": '0.0', "haptic_mode": 'PRESS'}, None, - {"bindings": - [("cosmos", {"profile": '/interaction_profiles/htc/vive_cosmos_controller', "component_path0": '/input/thumbstick/click', "component_path1": '/input/thumbstick/click', "threshold": '0.30000001192092896', "axis_region": 'ANY'}), - ("index", {"profile": '/interaction_profiles/valve/index_controller', "component_path0": '/input/thumbstick/click', "component_path1": '/input/thumbstick/click', "threshold": '0.30000001192092896', "axis_region": 'ANY'}), - ("oculus", {"profile": '/interaction_profiles/oculus/touch_controller', "component_path0": '/input/thumbstick/click', "component_path1": '/input/thumbstick/click', "threshold": '0.30000001192092896', "axis_region": 'ANY'}), - ("reverb_g2", {"profile": '/interaction_profiles/hp/mixed_reality_controller', "component_path0": '/input/thumbstick/click', "component_path1": '/input/thumbstick/click', "threshold": '0.30000001192092896', "axis_region": 'ANY'}), - ("wmr", {"profile": '/interaction_profiles/microsoft/motion_controller', "component_path0": '/input/thumbstick/click', "component_path1": '/input/thumbstick/click', "threshold": '0.30000001192092896', "axis_region": 'ANY'}), - ], - }, - ), ("fly_forward", {"type": 'FLOAT', "user_path0": '/user/hand/left', "user_path1": '', "op": 'wm.xr_navigation_fly', "op_mode": 'MODAL', "bimanual": 'False', "haptic_name": '', "haptic_match_user_paths": 'False', "haptic_duration": '0.0', "haptic_frequency": '0.0', "haptic_amplitude": '0.0', "haptic_mode": 'PRESS'}, {"op_properties": @@ -222,6 +212,42 @@ actionconfig_data = \ ], }, ), + ("nav_reset", + {"type": 'FLOAT', "user_path0": '/user/hand/right', "user_path1": '', "op": 'wm.xr_navigation_reset', "op_mode": 'PRESS', "bimanual": 'False', "haptic_name": 'haptic', "haptic_match_user_paths": 'True', "haptic_duration": '0.30000001192092896', "haptic_frequency": '3000.0', "haptic_amplitude": '0.5', "haptic_mode": 'PRESS'}, + {"op_properties": + [("location", False), + ("rotation", False), + ("scale", True), + ], + }, + {"bindings": + [("cosmos", {"profile": '/interaction_profiles/htc/vive_cosmos_controller', "component_path0": '/input/thumbstick/click', "component_path1": '', "threshold": '0.30000001192092896', "axis_region": 'ANY'}), + ("huawei", {"profile": '/interaction_profiles/huawei/controller', "component_path0": '/input/trackpad/click', "component_path1": '', "threshold": '0.30000001192092896', "axis_region": 'ANY'}), + ("index", {"profile": '/interaction_profiles/valve/index_controller', "component_path0": '/input/thumbstick/click', "component_path1": '', "threshold": '0.30000001192092896', "axis_region": 'ANY'}), + ("oculus", {"profile": '/interaction_profiles/oculus/touch_controller', "component_path0": '/input/thumbstick/click', "component_path1": '', "threshold": '0.30000001192092896', "axis_region": 'ANY'}), + ("reverb_g2", {"profile": '/interaction_profiles/hp/mixed_reality_controller', "component_path0": '/input/thumbstick/click', "component_path1": '', "threshold": '0.30000001192092896', "axis_region": 'ANY'}), + ("vive", {"profile": '/interaction_profiles/htc/vive_controller', "component_path0": '/input/trackpad/click', "component_path1": '', "threshold": '0.30000001192092896', "axis_region": 'ANY'}), + ("wmr", {"profile": '/interaction_profiles/microsoft/motion_controller', "component_path0": '/input/thumbstick/click', "component_path1": '', "threshold": '0.30000001192092896', "axis_region": 'ANY'}), + ], + }, + ), + ("toggle_matview", + {"type": 'FLOAT', "user_path0": '/user/hand/left', "user_path1": '', "op": 'view3d.toggle_shading', "op_mode": 'PRESS', "bimanual": 'False', "haptic_name": 'haptic', "haptic_match_user_paths": 'True', "haptic_duration": '0.30000001192092896', "haptic_frequency": '3000.0', "haptic_amplitude": '0.5', "haptic_mode": 'PRESS'}, + {"op_properties": + [("type", 'MATERIAL'), + ], + }, + {"bindings": + [("cosmos", {"profile": '/interaction_profiles/htc/vive_cosmos_controller', "component_path0": '/input/thumbstick/click', "component_path1": '', "threshold": '0.30000001192092896', "axis_region": 'ANY'}), + ("huawei", {"profile": '/interaction_profiles/huawei/controller', "component_path0": '/input/trackpad/click', "component_path1": '', "threshold": '0.30000001192092896', "axis_region": 'ANY'}), + ("index", {"profile": '/interaction_profiles/valve/index_controller', "component_path0": '/input/thumbstick/click', "component_path1": '', "threshold": '0.30000001192092896', "axis_region": 'ANY'}), + ("oculus", {"profile": '/interaction_profiles/oculus/touch_controller', "component_path0": '/input/thumbstick/click', "component_path1": '', "threshold": '0.30000001192092896', "axis_region": 'ANY'}), + ("reverb_g2", {"profile": '/interaction_profiles/hp/mixed_reality_controller', "component_path0": '/input/thumbstick/click', "component_path1": '', "threshold": '0.30000001192092896', "axis_region": 'ANY'}), + ("vive", {"profile": '/interaction_profiles/htc/vive_controller', "component_path0": '/input/trackpad/click', "component_path1": '', "threshold": '0.30000001192092896', "axis_region": 'ANY'}), + ("wmr", {"profile": '/interaction_profiles/microsoft/motion_controller', "component_path0": '/input/thumbstick/click', "component_path1": '', "threshold": '0.30000001192092896', "axis_region": 'ANY'}), + ], + }, + ), ("raycast_select", {"type": 'FLOAT', "user_path0": '/user/hand/right', "user_path1": '', "op": 'wm.xr_select_raycast', "op_mode": 'MODAL', "bimanual": 'False', "haptic_name": '', "haptic_match_user_paths": 'False', "haptic_duration": '0.0', "haptic_frequency": '0.0', "haptic_amplitude": '0.0', "haptic_mode": 'PRESS'}, None, {"bindings": [("cosmos", {"profile": '/interaction_profiles/htc/vive_cosmos_controller', "component_path0": '/input/trigger/value', "component_path1": '', "threshold": '0.30000001192092896', "axis_region": 'ANY'}), @@ -251,11 +277,9 @@ actionconfig_data = \ ("undo", {"type": 'FLOAT', "user_path0": '/user/hand/left', "user_path1": '', "op": 'ed.undo', "op_mode": 'PRESS', "bimanual": 'False', "haptic_name": 'haptic', "haptic_match_user_paths": 'True', "haptic_duration": '0.30000001192092896', "haptic_frequency": '3000.0', "haptic_amplitude": '0.5', "haptic_mode": 'PRESS'}, None, {"bindings": [("cosmos", {"profile": '/interaction_profiles/htc/vive_cosmos_controller', "component_path0": '/input/y/click', "component_path1": '', "threshold": '0.30000001192092896', "axis_region": 'ANY'}), - ("huawei", {"profile": '/interaction_profiles/huawei/controller', "component_path0": '/input/trackpad/click', "component_path1": '', "threshold": '0.30000001192092896', "axis_region": 'ANY'}), ("index", {"profile": '/interaction_profiles/valve/index_controller', "component_path0": '/input/b/click', "component_path1": '', "threshold": '0.30000001192092896', "axis_region": 'ANY'}), ("oculus", {"profile": '/interaction_profiles/oculus/touch_controller', "component_path0": '/input/y/click', "component_path1": '', "threshold": '0.30000001192092896', "axis_region": 'ANY'}), ("reverb_g2", {"profile": '/interaction_profiles/hp/mixed_reality_controller', "component_path0": '/input/y/click', "component_path1": '', "threshold": '0.30000001192092896', "axis_region": 'ANY'}), - ("vive", {"profile": '/interaction_profiles/htc/vive_controller', "component_path0": '/input/trackpad/click', "component_path1": '', "threshold": '0.30000001192092896', "axis_region": 'ANY'}), ("wmr", {"profile": '/interaction_profiles/microsoft/motion_controller', "component_path0": '/input/trackpad/click', "component_path1": '', "threshold": '0.30000001192092896', "axis_region": 'ANY'}), ], }, @@ -263,11 +287,9 @@ actionconfig_data = \ ("redo", {"type": 'FLOAT', "user_path0": '/user/hand/right', "user_path1": '', "op": 'ed.redo', "op_mode": 'PRESS', "bimanual": 'False', "haptic_name": 'haptic', "haptic_match_user_paths": 'True', "haptic_duration": '0.30000001192092896', "haptic_frequency": '3000.0', "haptic_amplitude": '0.5', "haptic_mode": 'PRESS'}, None, {"bindings": [("cosmos", {"profile": '/interaction_profiles/htc/vive_cosmos_controller', "component_path0": '/input/b/click', "component_path1": '', "threshold": '0.30000001192092896', "axis_region": 'ANY'}), - ("huawei", {"profile": '/interaction_profiles/huawei/controller', "component_path0": '/input/trackpad/click', "component_path1": '', "threshold": '0.30000001192092896', "axis_region": 'ANY'}), ("index", {"profile": '/interaction_profiles/valve/index_controller', "component_path0": '/input/b/click', "component_path1": '', "threshold": '0.30000001192092896', "axis_region": 'ANY'}), ("oculus", {"profile": '/interaction_profiles/oculus/touch_controller', "component_path0": '/input/b/click', "component_path1": '', "threshold": '0.30000001192092896', "axis_region": 'ANY'}), ("reverb_g2", {"profile": '/interaction_profiles/hp/mixed_reality_controller', "component_path0": '/input/b/click', "component_path1": '', "threshold": '0.30000001192092896', "axis_region": 'ANY'}), - ("vive", {"profile": '/interaction_profiles/htc/vive_controller', "component_path0": '/input/trackpad/click', "component_path1": '', "threshold": '0.30000001192092896', "axis_region": 'ANY'}), ("wmr", {"profile": '/interaction_profiles/microsoft/motion_controller', "component_path0": '/input/trackpad/click', "component_path1": '', "threshold": '0.30000001192092896', "axis_region": 'ANY'}), ], }, @@ -409,6 +431,30 @@ actionconfig_data = \ ], }, ), + ("nav_reset", + {"type": 'FLOAT', "user_path0": '/user/gamepad', "user_path1": '', "op": 'wm.xr_navigation_reset', "op_mode": 'PRESS', "bimanual": 'False', "haptic_name": 'haptic_right', "haptic_match_user_paths": 'True', "haptic_duration": '0.30000001192092896', "haptic_frequency": '3000.0', "haptic_amplitude": '0.5', "haptic_mode": 'PRESS'}, + {"op_properties": + [("location", False), + ("rotation", False), + ("scale", True), + ], + }, + {"bindings": + [("gamepad", {"profile": '/interaction_profiles/microsoft/xbox_controller', "component_path0": '/input/shoulder_right/click', "component_path1": '', "threshold": '0.30000001192092896', "axis_region": 'ANY'}), + ], + }, + ), + ("toggle_matview", + {"type": 'FLOAT', "user_path0": '/user/gamepad', "user_path1": '', "op": 'view3d.toggle_shading', "op_mode": 'PRESS', "bimanual": 'False', "haptic_name": 'haptic_left', "haptic_match_user_paths": 'True', "haptic_duration": '0.30000001192092896', "haptic_frequency": '3000.0', "haptic_amplitude": '0.5', "haptic_mode": 'PRESS'}, + {"op_properties": + [("type", 'MATERIAL'), + ], + }, + {"bindings": + [("gamepad", {"profile": '/interaction_profiles/microsoft/xbox_controller', "component_path0": '/input/shoulder_left/click', "component_path1": '', "threshold": '0.30000001192092896', "axis_region": 'ANY'}), + ], + }, + ), ("raycast_select", {"type": 'FLOAT', "user_path0": '/user/gamepad', "user_path1": '', "op": 'wm.xr_select_raycast', "op_mode": 'MODAL', "bimanual": 'False', "haptic_name": '', "haptic_match_user_paths": 'False', "haptic_duration": '0.0', "haptic_frequency": '0.0', "haptic_amplitude": '0.0', "haptic_mode": 'PRESS'}, {"op_properties": diff --git a/viewport_vr_preview/defaults.py b/viewport_vr_preview/defaults.py index 50b581c3..f28ea9cc 100644 --- a/viewport_vr_preview/defaults.py +++ b/viewport_vr_preview/defaults.py @@ -51,6 +51,8 @@ class VRDefaultActions(Enum): FLY_DOWN = "fly_down" FLY_TURNLEFT = "fly_turnleft" FLY_TURNRIGHT = "fly_turnright" + NAV_RESET = "nav_reset" + TOGGLE_MATVIEW = "toggle_matview" RAYCAST_SELECT = "raycast_select" GRAB = "grab" UNDO = "undo" @@ -491,61 +493,6 @@ def vr_defaults_create_default(ac): 0.3, 'ANY', 'ANY') - - ami = vr_defaults_action_add(am, - VRDefaultActions.FLY.value, - "/user/hand/left", - "/user/hand/right", - "wm.xr_navigation_fly", - 'MODAL', - False, - "", - False, - 0.0, - 0.0, - 0.0, - 'PRESS') - if ami: - vr_defaults_actionbinding_add(ami, - VRDefaultActionbindings.COSMOS.value, - VRDefaultActionprofiles.COSMOS.value, - "/input/thumbstick/click", - "/input/thumbstick/click", - 0.3, - 'ANY', - 'ANY') - vr_defaults_actionbinding_add(ami, - VRDefaultActionbindings.INDEX.value, - VRDefaultActionprofiles.INDEX.value, - "/input/thumbstick/click", - "/input/thumbstick/click", - 0.3, - 'ANY', - 'ANY') - vr_defaults_actionbinding_add(ami, - VRDefaultActionbindings.OCULUS.value, - VRDefaultActionprofiles.OCULUS.value, - "/input/thumbstick/click", - "/input/thumbstick/click", - 0.3, - 'ANY', - 'ANY') - vr_defaults_actionbinding_add(ami, - VRDefaultActionbindings.REVERB_G2.value, - VRDefaultActionprofiles.REVERB_G2.value, - "/input/thumbstick/click", - "/input/thumbstick/click", - 0.3, - 'ANY', - 'ANY') - vr_defaults_actionbinding_add(ami, - VRDefaultActionbindings.WMR.value, - VRDefaultActionprofiles.WMR.value, - "/input/thumbstick/click", - "/input/thumbstick/click", - 0.3, - 'ANY', - 'ANY') ami = vr_defaults_action_add(am, VRDefaultActions.FLY_FORWARD.value, @@ -1116,6 +1063,148 @@ def vr_defaults_create_default(ac): 'ANY') ami = vr_defaults_action_add(am, + VRDefaultActions.NAV_RESET.value, + "/user/hand/right", + "", + "wm.xr_navigation_reset", + 'PRESS', + False, + "haptic", + True, + 0.3, + 3000.0, + 0.5, + 'PRESS') + if ami: + vr_defaults_actionbinding_add(ami, + VRDefaultActionbindings.COSMOS.value, + VRDefaultActionprofiles.COSMOS.value, + "/input/thumbstick/click", + "", + 0.3, + 'ANY', + 'ANY') + vr_defaults_actionbinding_add(ami, + VRDefaultActionbindings.HUAWEI.value, + VRDefaultActionprofiles.HUAWEI.value, + "/input/trackpad/click", + "", + 0.3, + 'ANY', + 'ANY') + vr_defaults_actionbinding_add(ami, + VRDefaultActionbindings.INDEX.value, + VRDefaultActionprofiles.INDEX.value, + "/input/thumbstick/click", + "", + 0.3, + 'ANY', + 'ANY') + vr_defaults_actionbinding_add(ami, + VRDefaultActionbindings.OCULUS.value, + VRDefaultActionprofiles.OCULUS.value, + "/input/thumbstick/click", + "", + 0.3, + 'ANY', + 'ANY') + vr_defaults_actionbinding_add(ami, + VRDefaultActionbindings.REVERB_G2.value, + VRDefaultActionprofiles.REVERB_G2.value, + "/input/thumbstick/click", + "", + 0.3, + 'ANY', + 'ANY') + vr_defaults_actionbinding_add(ami, + VRDefaultActionbindings.VIVE.value, + VRDefaultActionprofiles.VIVE.value, + "/input/trackpad/click", + "", + 0.3, + 'ANY', + 'ANY') + vr_defaults_actionbinding_add(ami, + VRDefaultActionbindings.WMR.value, + VRDefaultActionprofiles.WMR.value, + "/input/thumbstick/click", + "", + 0.3, + 'ANY', + 'ANY') + + ami = vr_defaults_action_add(am, + VRDefaultActions.TOGGLE_MATVIEW.value, + "/user/hand/left", + "", + "view3d.toggle_shading", + 'PRESS', + False, + "haptic", + True, + 0.3, + 3000.0, + 0.5, + 'PRESS') + if ami: + vr_defaults_actionbinding_add(ami, + VRDefaultActionbindings.COSMOS.value, + VRDefaultActionprofiles.COSMOS.value, + "/input/thumbstick/click", + "", + 0.3, + 'ANY', + 'ANY') + vr_defaults_actionbinding_add(ami, + VRDefaultActionbindings.HUAWEI.value, + VRDefaultActionprofiles.HUAWEI.value, + "/input/trackpad/click", + "", + 0.3, + 'ANY', + 'ANY') + vr_defaults_actionbinding_add(ami, + VRDefaultActionbindings.INDEX.value, + VRDefaultActionprofiles.INDEX.value, + "/input/thumbstick/click", + "", + 0.3, + 'ANY', + 'ANY') + vr_defaults_actionbinding_add(ami, + VRDefaultActionbindings.OCULUS.value, + VRDefaultActionprofiles.OCULUS.value, + "/input/thumbstick/click", + "", + 0.3, + 'ANY', + 'ANY') + vr_defaults_actionbinding_add(ami, + VRDefaultActionbindings.REVERB_G2.value, + VRDefaultActionprofiles.REVERB_G2.value, + "/input/thumbstick/click", + "", + 0.3, + 'ANY', + 'ANY') + vr_defaults_actionbinding_add(ami, + VRDefaultActionbindings.VIVE.value, + VRDefaultActionprofiles.VIVE.value, + "/input/trackpad/click", + "", + 0.3, + 'ANY', + 'ANY') + vr_defaults_actionbinding_add(ami, + VRDefaultActionbindings.WMR.value, + VRDefaultActionprofiles.WMR.value, + "/input/thumbstick/click", + "", + 0.3, + 'ANY', + 'ANY') + + ami = vr_defaults_action_add(am, VRDefaultActions.RAYCAST_SELECT.value, "/user/hand/right", "", @@ -1296,14 +1385,6 @@ def vr_defaults_create_default(ac): 'ANY', 'ANY') vr_defaults_actionbinding_add(ami, - VRDefaultActionbindings.HUAWEI.value, - VRDefaultActionprofiles.HUAWEI.value, - "/input/trackpad/click", - "", - 0.3, - 'ANY', - 'ANY') - vr_defaults_actionbinding_add(ami, VRDefaultActionbindings.INDEX.value, VRDefaultActionprofiles.INDEX.value, "/input/b/click", @@ -1328,14 +1409,6 @@ def vr_defaults_create_default(ac): 'ANY', 'ANY') vr_defaults_actionbinding_add(ami, - VRDefaultActionbindings.VIVE.value, - VRDefaultActionprofiles.VIVE.value, - "/input/trackpad/click", - "", - 0.3, - 'ANY', - 'ANY') - vr_defaults_actionbinding_add(ami, VRDefaultActionbindings.WMR.value, VRDefaultActionprofiles.WMR.value, "/input/trackpad/click", @@ -1367,14 +1440,6 @@ def vr_defaults_create_default(ac): 'ANY', 'ANY') vr_defaults_actionbinding_add(ami, - VRDefaultActionbindings.HUAWEI.value, - VRDefaultActionprofiles.HUAWEI.value, - "/input/trackpad/click", - "", - 0.3, - 'ANY', - 'ANY') - vr_defaults_actionbinding_add(ami, VRDefaultActionbindings.INDEX.value, VRDefaultActionprofiles.INDEX.value, "/input/b/click", @@ -1399,14 +1464,6 @@ def vr_defaults_create_default(ac): 'ANY', 'ANY') vr_defaults_actionbinding_add(ami, - VRDefaultActionbindings.VIVE.value, - VRDefaultActionprofiles.VIVE.value, - "/input/trackpad/click", - "", - 0.3, - 'ANY', - 'ANY') - vr_defaults_actionbinding_add(ami, VRDefaultActionbindings.WMR.value, VRDefaultActionprofiles.WMR.value, "/input/trackpad/click", @@ -1697,6 +1754,52 @@ def vr_defaults_create_default_gamepad(ac): 'ANY') ami = vr_defaults_action_add(am, + VRDefaultActions.NAV_RESET.value, + "/user/gamepad", + "", + "wm.xr_navigation_reset", + 'PRESS', + False, + "haptic_right", + True, + 0.3, + 3000.0, + 0.5, + 'PRESS') + if ami: + vr_defaults_actionbinding_add(ami, + VRDefaultActionbindings.GAMEPAD.value, + VRDefaultActionprofiles.GAMEPAD.value, + "/input/shoulder_right/click", + "", + 0.3, + 'ANY', + 'ANY') + + ami = vr_defaults_action_add(am, + VRDefaultActions.TOGGLE_MATVIEW.value, + "/user/gamepad", + "", + "view3d.toggle_shading", + 'PRESS', + False, + "haptic_left", + True, + 0.3, + 3000.0, + 0.5, + 'PRESS') + if ami: + vr_defaults_actionbinding_add(ami, + VRDefaultActionbindings.GAMEPAD.value, + VRDefaultActionprofiles.GAMEPAD.value, + "/input/shoulder_left/click", + "", + 0.3, + 'ANY', + 'ANY') + + ami = vr_defaults_action_add(am, VRDefaultActions.RAYCAST_SELECT.value, "/user/gamepad", "", |