Skip to content

Commit

Permalink
Support Vive Trackers
Browse files Browse the repository at this point in the history
Add default bindings
Add new T actions
Add new source input handles
  • Loading branch information
BOLL7708 committed Apr 11, 2021
1 parent b93158e commit 8a5e171
Show file tree
Hide file tree
Showing 14 changed files with 312 additions and 7 deletions.
16 changes: 12 additions & 4 deletions OpenVR2Key/MainController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class MainController
// Other
private string _currentApplicationId = "";
private ulong _inputSourceHandleLeft = 0, _inputSourceHandleRight = 0;
private ulong[] _inputSourceHandles = new ulong[10];
private ulong _notificationOverlayHandle = 0;
private string[] _actionKeys = new string[0];

Expand Down Expand Up @@ -184,10 +185,7 @@ private void WorkerThread()
}
else
{
_ovr.UpdateActionStates(new ulong[] {
_inputSourceHandleLeft,
_inputSourceHandleRight
});
_ovr.UpdateActionStates(_inputSourceHandles);

_ovr.UpdateEvents();

Expand All @@ -214,6 +212,16 @@ private void UpdateInputSourceHandles()
{
_inputSourceHandleLeft = _ovr.GetInputSourceHandle(EasyOpenVRSingleton.InputSource.LeftHand);
_inputSourceHandleRight = _ovr.GetInputSourceHandle(EasyOpenVRSingleton.InputSource.RightHand);
_inputSourceHandles[0] = _inputSourceHandleLeft;
_inputSourceHandles[1] = _inputSourceHandleRight;
_inputSourceHandles[2] = _ovr.GetInputSourceHandle(EasyOpenVRSingleton.InputSource.Chest);
_inputSourceHandles[3] = _ovr.GetInputSourceHandle(EasyOpenVRSingleton.InputSource.LeftElbow);
_inputSourceHandles[4] = _ovr.GetInputSourceHandle(EasyOpenVRSingleton.InputSource.LeftKnee);
_inputSourceHandles[5] = _ovr.GetInputSourceHandle(EasyOpenVRSingleton.InputSource.LeftFoot);
_inputSourceHandles[6] = _ovr.GetInputSourceHandle(EasyOpenVRSingleton.InputSource.RightElbow);
_inputSourceHandles[7] = _ovr.GetInputSourceHandle(EasyOpenVRSingleton.InputSource.RightKnee);
_inputSourceHandles[8] = _ovr.GetInputSourceHandle(EasyOpenVRSingleton.InputSource.RightFoot);
_inputSourceHandles[9] = _ovr.GetInputSourceHandle(EasyOpenVRSingleton.InputSource.Waist);
}

// New app is running, distribute new app ID
Expand Down
1 change: 1 addition & 0 deletions OpenVR2Key/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ private string[] InitList(Dictionary<string, Key[]> config = null)
actionKeys.AddRange(GenerateActionKeyRange(16, 'L')); // Left
actionKeys.AddRange(GenerateActionKeyRange(16, 'R')); // Right
actionKeys.AddRange(GenerateActionKeyRange(8, 'C')); // Chord
actionKeys.AddRange(GenerateActionKeyRange(8, 'T')); // Tracker
string[] GenerateActionKeyRange(int count, char type)
{
var keys = new List<string>();
Expand Down
24 changes: 24 additions & 0 deletions OpenVR2Key/OpenVR2Key.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,30 @@
<None Include="bindings_vive_controller.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="bindings_vive_tracker_chest.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="bindings_vive_tracker_left_elbow.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="bindings_vive_tracker_left_foot.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="bindings_vive_tracker_left_knee.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="bindings_vive_tracker_right_elbow.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="bindings_vive_tracker_right_foot.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="bindings_vive_tracker_right_knee.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="bindings_vive_tracker_waist.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="EasyOpenVR\README.md" />
<None Include="FodyWeavers.xsd">
<SubType>Designer</SubType>
Expand Down
2 changes: 1 addition & 1 deletion OpenVR2Key/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion OpenVR2Key/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,6 @@
<value>..\resources\logo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Version" xml:space="preserve">
<value>v0.54</value>
<value>v0.55</value>
</data>
</root>
82 changes: 81 additions & 1 deletion OpenVR2Key/actions.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,38 @@
{
"controller_type": "oculus_touch",
"binding_url": "bindings_oculus_touch.json"
},
{
"controller_type": "vive_tracker_chest",
"binding_url": "bindings_vive_tracker_chest.json"
},
{
"controller_type": "vive_tracker_left_elbow",
"binding_url": "bindings_vive_tracker_left_elbow.json"
},
{
"controller_type": "vive_tracker_right_elbow",
"binding_url": "bindings_vive_tracker_right_elbow.json"
},
{
"controller_type": "vive_tracker_waist",
"binding_url": "bindings_vive_tracker_waist.json"
},
{
"controller_type": "vive_tracker_left_knee",
"binding_url": "bindings_vive_tracker_left_knee.json"
},
{
"controller_type": "vive_tracker_right_knee",
"binding_url": "bindings_vive_tracker_right_knee.json"
},
{
"controller_type": "vive_tracker_left_foot",
"binding_url": "bindings_vive_tracker_left_foot.json"
},
{
"controller_type": "vive_tracker_right_foot",
"binding_url": "bindings_vive_tracker_right_foot.json"
}
],
"actions": [
Expand Down Expand Up @@ -213,6 +245,46 @@
"name": "/actions/keys/in/KeyC8",
"requirement": "optional",
"type": "boolean"
},
{
"name": "/actions/keys/in/KeyT1",
"requirement": "optional",
"type": "boolean"
},
{
"name": "/actions/keys/in/KeyT2",
"requirement": "optional",
"type": "boolean"
},
{
"name": "/actions/keys/in/KeyT3",
"requirement": "optional",
"type": "boolean"
},
{
"name": "/actions/keys/in/KeyT4",
"requirement": "optional",
"type": "boolean"
},
{
"name": "/actions/keys/in/KeyT5",
"requirement": "optional",
"type": "boolean"
},
{
"name": "/actions/keys/in/KeyT6",
"requirement": "optional",
"type": "boolean"
},
{
"name": "/actions/keys/in/KeyT7",
"requirement": "optional",
"type": "boolean"
},
{
"name": "/actions/keys/in/KeyT8",
"requirement": "optional",
"type": "boolean"
}
],
"action_sets": [
Expand Down Expand Up @@ -264,7 +336,15 @@
"/actions/keys/in/KeyC5": "Key Chord 5",
"/actions/keys/in/KeyC6": "Key Chord 6",
"/actions/keys/in/KeyC7": "Key Chord 7",
"/actions/keys/in/KeyC8": "Key Chord 8"
"/actions/keys/in/KeyC8": "Key Chord 8",
"/actions/keys/in/KeyT1": "Key Tracker 1",
"/actions/keys/in/KeyT2": "Key Tracker 2",
"/actions/keys/in/KeyT3": "Key Tracker 3",
"/actions/keys/in/KeyT4": "Key Tracker 4",
"/actions/keys/in/KeyT5": "Key Tracker 5",
"/actions/keys/in/KeyT6": "Key Tracker 6",
"/actions/keys/in/KeyT7": "Key Tracker 7",
"/actions/keys/in/KeyT8": "Key Tracker 8"
}
]
}
24 changes: 24 additions & 0 deletions OpenVR2Key/bindings_vive_tracker_chest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"bindings" : {
"/actions/keys" : {
"chords" : [],
"haptics" : [],
"poses" : [],
"skeleton" : [],
"sources" : [
{
"path": "/user/chest/input/power",
"mode": "button",
"inputs": {
"click": {
"output": "/actions/keys/in/keyt1"
}
}
}
]
}
},
"controller_type" : "vive_tracker_chest",
"description" : "Default OpenVR2Key input configuration for Vive Tracker Chest",
"name" : "Chest Tracker"
}
24 changes: 24 additions & 0 deletions OpenVR2Key/bindings_vive_tracker_left_elbow.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"bindings" : {
"/actions/keys" : {
"chords" : [],
"haptics" : [],
"poses" : [],
"skeleton" : [],
"sources" : [
{
"path": "/user/elbow/left/input/power",
"mode": "button",
"inputs": {
"click": {
"output": "/actions/keys/in/keyt2"
}
}
}
]
}
},
"controller_type" : "vive_tracker_left_elbow",
"description" : "Default OpenVR2Key input configuration for Vive Tracker Left Elbow",
"name" : "Left Elbow Tracker"
}
24 changes: 24 additions & 0 deletions OpenVR2Key/bindings_vive_tracker_left_foot.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"bindings" : {
"/actions/keys" : {
"chords" : [],
"haptics" : [],
"poses" : [],
"skeleton" : [],
"sources" : [
{
"path": "/user/foot/left/input/power",
"mode": "button",
"inputs": {
"click": {
"output": "/actions/keys/in/keyt3"
}
}
}
]
}
},
"controller_type" : "vive_tracker_left_foot",
"description" : "Default OpenVR2Key input configuration for Vive Tracker Left Foot",
"name" : "Left Foot Tracker"
}
24 changes: 24 additions & 0 deletions OpenVR2Key/bindings_vive_tracker_left_knee.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"bindings" : {
"/actions/keys" : {
"chords" : [],
"haptics" : [],
"poses" : [],
"skeleton" : [],
"sources" : [
{
"path": "/user/knee/left/input/power",
"mode": "button",
"inputs": {
"click": {
"output": "/actions/keys/in/keyt4"
}
}
}
]
}
},
"controller_type" : "vive_tracker_left_knee",
"description" : "Default OpenVR2Key input configuration for Vive Tracker Left Knee",
"name" : "Left Knee Tracker"
}
24 changes: 24 additions & 0 deletions OpenVR2Key/bindings_vive_tracker_right_elbow.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"bindings" : {
"/actions/keys" : {
"chords" : [],
"haptics" : [],
"poses" : [],
"skeleton" : [],
"sources" : [
{
"path": "/user/elbow/right/input/power",
"mode": "button",
"inputs": {
"click": {
"output": "/actions/keys/in/keyt5"
}
}
}
]
}
},
"controller_type" : "vive_tracker_right_elbow",
"description" : "Default OpenVR2Key input configuration for Vive Tracker Right Elbow",
"name" : "Right Elbow Tracker"
}
24 changes: 24 additions & 0 deletions OpenVR2Key/bindings_vive_tracker_right_foot.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"bindings" : {
"/actions/keys" : {
"chords" : [],
"haptics" : [],
"poses" : [],
"skeleton" : [],
"sources" : [
{
"path": "/user/foot/right/input/power",
"mode": "button",
"inputs": {
"click": {
"output": "/actions/keys/in/keyt6"
}
}
}
]
}
},
"controller_type" : "vive_tracker_right_foot",
"description" : "Default OpenVR2Key input configuration for Vive Tracker Right Foot",
"name" : "Right Foot Tracker"
}
24 changes: 24 additions & 0 deletions OpenVR2Key/bindings_vive_tracker_right_knee.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"bindings" : {
"/actions/keys" : {
"chords" : [],
"haptics" : [],
"poses" : [],
"skeleton" : [],
"sources" : [
{
"path": "/user/knee/right/input/power",
"mode": "button",
"inputs": {
"click": {
"output": "/actions/keys/in/keyt7"
}
}
}
]
}
},
"controller_type" : "vive_tracker_right_knee",
"description" : "Default OpenVR2Key input configuration for Vive Tracker Right Knee",
"name" : "Right Knee Tracker"
}
24 changes: 24 additions & 0 deletions OpenVR2Key/bindings_vive_tracker_waist.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"bindings" : {
"/actions/keys" : {
"chords" : [],
"haptics" : [],
"poses" : [],
"skeleton" : [],
"sources" : [
{
"path": "/user/waist/input/power",
"mode": "button",
"inputs": {
"click": {
"output": "/actions/keys/in/keyt8"
}
}
}
]
}
},
"controller_type" : "vive_tracker_waist",
"description" : "Default OpenVR2Key input configuration for Vive Tracker Waist",
"name" : "Waist Tracker"
}

0 comments on commit 8a5e171

Please sign in to comment.