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
1717 #include <gpu/Batch.h>
1818 #include <gpu/Context.h>
1919 #include <DeferredLightingEffect.h>
20−#include <display-plugins\openvr\OpenVrHelpers.h>
20+#include <display-plugins/openvr/OpenVrHelpers.h>
2121 #include "NumericalConstants.h"
22+#include <plugins/PluginContainer.h>
2223 #include "UserActivityLogger.h"
2324
2425 extern vr::IVRSystem* _hmd;
@@ -44,12 +45,18 @@ const QString CONTROLLER_MODEL_STRING = "vr_controller_05_wireless_b"; · 19 unmodified lines
4445
4546 const QString ViveControllerManager::NAME = "OpenVR";
4647
48+const QString MENU_PARENT = "Avatar";
49+const QString MENU_NAME = "Vive Controllers";
50+const QString MENU_PATH = MENU_PARENT + ">" + MENU_NAME;
51+const QString RENDER_CONTROLLERS = "Render Hand Controllers";
52+
4753 ViveControllerManager::ViveControllerManager() :
4854 InputDevice("SteamVR Controller"),
4955 _trackedControllers(0),
5056 _modelLoaded(false),
5157 _leftHandRenderID(0),
52− _rightHandRenderID(0)
58+ _rightHandRenderID(0),
59+ _renderControllers(false)
5360 {
5461
5562 }
@@ -59,6 +66,11 @@ bool ViveControllerManager::isSupported() const { · 3 unmodified lines
5966 }
6067
6168 void 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+
6274 hmdRefCount++;
6375 if (!_hmd) {
6476 vr::HmdError eError = vr::HmdError_None;
@@ -111,10 +123,14 @@ void ViveControllerManager::activate(PluginContainer* container) { · 46 unmodified lines
111123 _texture->autoGenerateMips(-1);
112124
113125 _modelLoaded = true;
126+ _renderControllers = true;
114127 }
115128 }
116129
117130 void ViveControllerManager::deactivate(PluginContainer* container) {
131+ container->removeMenuItem(MENU_NAME, RENDER_CONTROLLERS);
132+ container->removeMenu(MENU_PATH);
133+
118134 hmdRefCount--;
119135
120136 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