Skip to content

Commit 2518ca5

Browse files
committed
WIP working on inputs
1 parent b851cdc commit 2518ca5

File tree

6 files changed

+84
-34
lines changed

6 files changed

+84
-34
lines changed

driver/slimevr/resources/input/slimevr_controller_bindings.json

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,44 +15,43 @@
1515
"input_source": {
1616
"/pose/raw" : {
1717
"type" : "pose",
18-
"binding_image_point" : [50,50]
18+
"binding_image_point" : [80,80]
1919
},
2020
"/output/haptic": {
2121
"type": "vibration",
22-
"binding_image_point": [50,50]
23-
},
24-
"/input/tap": {
25-
"type": "button",
26-
"click": true,
27-
"touch" : false,
28-
"binding_image_point": [50,50],
29-
"order" : 1
22+
"binding_image_point": [80,80]
3023
},
3124
"/input/double_tap": {
3225
"type": "button",
3326
"click": true,
3427
"touch" : false,
35-
"binding_image_point": [50,50],
36-
"order" : 2
28+
"binding_image_point": [80,80],
29+
"order" : 1
3730
},
3831
"/input/triple_tap": {
3932
"type": "button",
4033
"click": true,
4134
"touch" : false,
42-
"binding_image_point": [50,50],
43-
"order" : 3
35+
"binding_image_point": [80,80],
36+
"order" : 2
4437
},
4538
"/input/skeleton/left" : {
4639
"type" : "skeleton",
4740
"skeleton": "/skeleton/hand/left",
4841
"side" : "left",
49-
"binding_image_point" : [50,50]
42+
"binding_image_point" : [80,80]
5043
},
5144
"/input/skeleton/right" : {
5245
"type" : "skeleton",
5346
"skeleton": "/skeleton/hand/right",
5447
"side" : "right",
55-
"binding_image_point" : [50,50]
48+
"binding_image_point" : [80,80]
49+
}
50+
},
51+
"default_bindings": [
52+
{
53+
"app_key": "openvr.component.vrcompositor",
54+
"binding_url": "vrcompositor_bindings_slimevr.json"
5655
}
57-
}
56+
]
5857
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{
2+
"action_manifest_version": 0,
3+
"alias_info": {},
4+
"app_key": "openvr.component.vrcompositor",
5+
"bindings": {
6+
"/actions/lasermouse": {
7+
"sources": [
8+
{
9+
"inputs": {
10+
"click": {
11+
"output": "/actions/lasermouse/in/LeftClick"
12+
}
13+
},
14+
"mode": "button",
15+
"parameters": {},
16+
"path": "/user/hand/left/input/double_tap"
17+
},
18+
{
19+
"inputs": {
20+
"click": {
21+
"output": "/actions/lasermouse/in/LeftClick"
22+
}
23+
},
24+
"mode": "button",
25+
"parameters": {},
26+
"path": "/user/hand/right/input/double_tap"
27+
}
28+
]
29+
},
30+
"/actions/system": {
31+
"sources": [
32+
{
33+
"inputs": {
34+
"click": {
35+
"output": "/actions/system/in/ToggleDashboard"
36+
}
37+
},
38+
"mode": "button",
39+
"parameters": {},
40+
"path": "/user/hand/left/input/triple_tap"
41+
},
42+
{
43+
"inputs": {
44+
"click": {
45+
"output": "/actions/system/in/ToggleDashboard"
46+
}
47+
},
48+
"mode": "button",
49+
"parameters": {},
50+
"path": "/user/hand/right/input/triple_tap"
51+
}
52+
]
53+
}
54+
},
55+
"category": "steamvr_input",
56+
"controller_type": "slimevr_virtual_controller",
57+
"description": "Triple tap to toggle the dashboard. Double tap to click with the laser mouse.",
58+
"interaction_profile": "",
59+
"name": "Default SteamVR Dashboard bindings for SlimeVR",
60+
"options": {},
61+
"simulated_actions": []
62+
}

driver/slimevr/resources/localization/localization.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
[
22
{
33
"language_tag": "en_US",
4-
"slimevr": "SlimeVR",
54
"slimevr_virtual_controller": "SlimeVR Virtual Controller",
6-
"/input/tap": "Single tap",
75
"/input/double_tap": "Double tap",
86
"/input/triple_tap": "Triple tap"
97
}

src/TrackerDevice.cpp

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,23 +75,18 @@ void SlimeVRDriver::TrackerDevice::PositionMessage(messages::Position &position)
7575
}
7676

7777
if (is_controller_) {
78-
bool tap = false;
78+
// Get inputs from protobuf
7979
bool double_tap = false;
8080
bool triple_tap = false;
81-
82-
// Get inputs from protobuf
8381
for (int i = 0; i < position.input_size(); ++i) {
84-
if (position.input(i).type() == messages::Input_InputType_TAP) {
85-
tap = true;
86-
} else if (position.input(i).type() == messages::Input_InputType_DOUBLE_TAP) {
82+
if (position.input(i).type() == messages::Input_InputType_DOUBLE_TAP) {
8783
double_tap = true;
8884
} else if (position.input(i).type() == messages::Input_InputType_TRIPLE_TAP) {
8985
triple_tap = true;
9086
}
9187
}
9288

9389
// Set inputs
94-
GetDriver()->GetInput()->UpdateBooleanComponent(this->tap_component_, tap, 0);
9590
GetDriver()->GetInput()->UpdateBooleanComponent(this->double_tap_component_, double_tap, 0);
9691
GetDriver()->GetInput()->UpdateBooleanComponent(this->triple_tap_component_, triple_tap, 0);
9792
}
@@ -243,11 +238,10 @@ vr::EVRInitError SlimeVRDriver::TrackerDevice::Activate(uint32_t unObjectId) {
243238

244239
// Set inputs
245240
if (is_controller_) {
246-
GetDriver()->GetInput()->CreateBooleanComponent(props, "/input/tap", &this->tap_component_);
247-
GetDriver()->GetInput()->CreateBooleanComponent(props, "/input/double_tap", &this->double_tap_component_);
248-
GetDriver()->GetInput()->CreateBooleanComponent(props, "/input/triple_tap", &this->triple_tap_component_);
249-
250241
GetDriver()->GetProperties()->SetStringProperty(props, vr::Prop_InputProfilePath_String, "{slimevr}/input/slimevr_controller_bindings.json");
242+
243+
GetDriver()->GetInput()->CreateBooleanComponent(props, "/input/double_tap/click", &this->double_tap_component_);
244+
GetDriver()->GetInput()->CreateBooleanComponent(props, "/input/triple_tap/click", &this->triple_tap_component_);
251245
}
252246

253247
// Automatically select vive tracker roles and set hints for games that need it (Beat Saber avatar mod, for example)

src/TrackerDevice.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ namespace SlimeVRDriver {
5858
float vibrate_anim_state_ = 0.f;
5959

6060
vr::VRInputComponentHandle_t haptic_component_ = 0;
61-
vr::VRInputComponentHandle_t tap_component_ = 0;
6261
vr::VRInputComponentHandle_t double_tap_component_ = 0;
6362
vr::VRInputComponentHandle_t triple_tap_component_ = 0;
6463

src/bridge/ProtobufMessages.proto

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,8 @@ message FingerBoneRotation {
8585

8686
message Input {
8787
enum InputType {
88-
TAP = 0;
89-
DOUBLE_TAP = 1;
90-
TRIPLE_TAP = 2;
88+
DOUBLE_TAP = 0;
89+
TRIPLE_TAP = 1;
9190
}
9291
InputType type = 1;
9392
}
@@ -110,7 +109,6 @@ message Position {
110109
optional DataSource data_source = 9;
111110
repeated FingerBoneRotation finger_bone_rotations = 10;
112111
repeated Input input = 11;
113-
114112
}
115113

116114
message UserAction {

0 commit comments

Comments
 (0)