Showing the changes to libraries/input-plugins/src/input-plugins/ViveControllerManager.cpp (1 of 6 files). Show all
Unified · Split
| @@ -133,6 +133,11 @@ void ViveControllerManager::activate() { · 132 unmodified lines | |||
| 133 | _renderControllers = true; | 133 | _renderControllers = true; |
| 134 | } | 134 | } |
| 135 | #endif | 135 | #endif |
| 136 | |||
| 137 | // unregister with UserInputMapper | ||
| 138 | auto userInputMapper = DependencyManager::get<controller::UserInputMapper>(); | ||
| 139 | userInputMapper->registerDevice(this); | ||
| 140 | _registeredWithInputMapper = true; | ||
| 136 | } | 141 | } |
| 137 | 142 | ||
| 138 | void ViveControllerManager::deactivate() { | 143 | void ViveControllerManager::deactivate() { |
| @@ -150,6 +155,11 @@ void ViveControllerManager::deactivate() { · 11 unmodified lines | |||
| 150 | } | 155 | } |
| 151 | _poseStateMap.clear(); | 156 | _poseStateMap.clear(); |
| 152 | #endif | 157 | #endif |
| 158 | |||
| 159 | // unregister with UserInputMapper | ||
| 160 | auto userInputMapper = DependencyManager::get<controller::UserInputMapper>(); | ||
| 161 | userInputMapper->removeDevice(_deviceID); | ||
| 162 | _registeredWithInputMapper = false; | ||
| 153 | } | 163 | } |
| 154 | 164 | ||
| 155 | void ViveControllerManager::updateRendering(RenderArgs* args, render::ScenePointer scene, render::PendingChanges pendingChanges) { | 165 | void ViveControllerManager::updateRendering(RenderArgs* args, render::ScenePointer scene, render::PendingChanges pendingChanges) { |
| @@ -270,15 +280,16 @@ void ViveControllerManager::update(float deltaTime, bool jointsCaptured) { · 114 unmodified lines | |||
| 270 | auto userInputMapper = DependencyManager::get<controller::UserInputMapper>(); | 280 | auto userInputMapper = DependencyManager::get<controller::UserInputMapper>(); |
| 271 | 281 | ||
| 272 | if (numTrackedControllers == 0) { | 282 | if (numTrackedControllers == 0) { |
| 273 | if (_deviceID != 0) { | 283 | if (_registeredWithInputMapper) { |
| 274 | userInputMapper->removeDevice(_deviceID); | 284 | userInputMapper->removeDevice(_deviceID); |
| 275 | _deviceID = 0; | 285 | _registeredWithInputMapper = false; |
| 276 | _poseStateMap.clear(); | 286 | _poseStateMap.clear(); |
| 277 | } | 287 | } |
| 278 | } | 288 | } |
| 279 | 289 | ||
| 280 | if (_trackedControllers == 0 && numTrackedControllers > 0) { | 290 | if (_trackedControllers == 0 && numTrackedControllers > 0) { |
| 281 | userInputMapper->registerDevice(this); | 291 | userInputMapper->registerDevice(this); |
| 292 | _registeredWithInputMapper = true; | ||
| 282 | UserActivityLogger::getInstance().connectedDevice("spatial_controller", "steamVR"); | 293 | UserActivityLogger::getInstance().connectedDevice("spatial_controller", "steamVR"); |
| 283 | } | 294 | } |
| 284 | 295 | ||