History

set up sixense/vive menu items with correct event forwarding

SamGondelman committed 11 years ago

Commit 505ef4c1 parent e3bc4b37 files · +31 −14Browse files

Showing the changes to libraries/input-plugins/src/input-plugins/ViveControllerManager.cpp (1 of 7 files). Show all

Unified · Split

libraries/input-plugins/src/input-plugins/ViveControllerManager.cpp+18−2
@@ -17,8 +17,9 @@ · 16 unmodified lines
17#include <gpu/Batch.h>17#include <gpu/Batch.h>
18#include <gpu/Context.h>18#include <gpu/Context.h>
19#include <DeferredLightingEffect.h>19#include <DeferredLightingEffect.h>
20#include <display-plugins\openvr\OpenVrHelpers.h>20#include <display-plugins/openvr/OpenVrHelpers.h>
21#include "NumericalConstants.h"21#include "NumericalConstants.h"
22#include <plugins/PluginContainer.h>
22#include "UserActivityLogger.h"23#include "UserActivityLogger.h"
23 24
24extern vr::IVRSystem* _hmd;25extern vr::IVRSystem* _hmd;
@@ -44,12 +45,18 @@ const QString CONTROLLER_MODEL_STRING = "vr_controller_05_wireless_b"; · 19 unmodified lines
44 45
45const QString ViveControllerManager::NAME = "OpenVR";46const QString ViveControllerManager::NAME = "OpenVR";
46 47
48const QString MENU_PARENT = "Avatar";
49const QString MENU_NAME = "Vive Controllers";
50const QString MENU_PATH = MENU_PARENT + ">" + MENU_NAME;
51const QString RENDER_CONTROLLERS = "Render Hand Controllers";
52
47ViveControllerManager::ViveControllerManager() :53ViveControllerManager::ViveControllerManager() :
48 InputDevice("SteamVR Controller"),54 InputDevice("SteamVR Controller"),
49 _trackedControllers(0),55 _trackedControllers(0),
50 _modelLoaded(false),56 _modelLoaded(false),
51 _leftHandRenderID(0),57 _leftHandRenderID(0),
52 _rightHandRenderID(0)58 _rightHandRenderID(0),
59 _renderControllers(false)
53{60{
54 61
55}62}
@@ -59,6 +66,11 @@ bool ViveControllerManager::isSupported() const { · 3 unmodified lines
59}66}
60 67
61void ViveControllerManager::activate(PluginContainer* container) {68void ViveControllerManager::activate(PluginContainer* container) {
69 container->addMenu(MENU_PATH);
70 container->addMenuItem(MENU_PATH, RENDER_CONTROLLERS,
71 [this, &container] (bool clicked) { this->setRenderControllers(clicked); },
72 true, true);
73
62 hmdRefCount++;74 hmdRefCount++;
63 if (!_hmd) {75 if (!_hmd) {
64 vr::HmdError eError = vr::HmdError_None;76 vr::HmdError eError = vr::HmdError_None;
@@ -111,10 +123,14 @@ void ViveControllerManager::activate(PluginContainer* container) { · 46 unmodified lines
111 _texture->autoGenerateMips(-1);123 _texture->autoGenerateMips(-1);
112 124
113 _modelLoaded = true;125 _modelLoaded = true;
126 _renderControllers = true;
114 }127 }
115}128}
116 129
117void ViveControllerManager::deactivate(PluginContainer* container) {130void ViveControllerManager::deactivate(PluginContainer* container) {
131 container->removeMenuItem(MENU_NAME, RENDER_CONTROLLERS);
132 container->removeMenu(MENU_PATH);
133
118 hmdRefCount--;134 hmdRefCount--;
119 135
120 if (hmdRefCount == 0 && _hmd) {136 if (hmdRefCount == 0 && _hmd) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t