Showing the changes to interface/src/scripting/HMDScriptingInterface.cpp (1 of 26 files). Show all
Unified · Split
| @@ -82,6 +82,22 @@ bool HMDScriptingInterface::shouldShowHandControllers() const { · 81 unmodified lines | ||
| 82 | 82 | return _showHandControllersCount > 0; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | +void HMDScriptingInterface::activateHMDHandMouse() { | |
| 86 | + QWriteLocker lock(&_hmdHandMouseLock); | |
| 87 | + auto offscreenUi = DependencyManager::get<OffscreenUi>(); | |
| 88 | + offscreenUi->getDesktop()->setProperty("hmdHandMouseActive", true); | |
| 89 | + _hmdHandMouseCount++; | |
| 90 | +} | |
| 91 | + | |
| 92 | +void HMDScriptingInterface::deactivateHMDHandMouse() { | |
| 93 | + QWriteLocker lock(&_hmdHandMouseLock); | |
| 94 | + _hmdHandMouseCount = std::max(--_hmdHandMouseCount, 0); | |
| 95 | + if (_hmdHandMouseCount == 0) { | |
| 96 | + auto offscreenUi = DependencyManager::get<OffscreenUi>(); | |
| 97 | + offscreenUi->getDesktop()->setProperty("hmdHandMouseActive", false); | |
| 98 | + } | |
| 99 | +} | |
| 100 | + | |
| 85 | 101 | void HMDScriptingInterface::closeTablet() { |
| 86 | 102 | _showTablet = false; |
| 87 | 103 | } |
| @@ -153,50 +169,6 @@ QString HMDScriptingInterface::preferredAudioOutput() const { · 65 unmodified lines | ||
| 153 | 169 | return qApp->getActiveDisplayPlugin()->getPreferredAudioOutDevice(); |
| 154 | 170 | } |
| 155 | 171 | |
| 156 | −bool HMDScriptingInterface::setHandLasers(int hands, bool enabled, const glm::vec4& color, const glm::vec3& direction) { | |
| 157 | − if (QThread::currentThread() != thread()) { | |
| 158 | − bool result; | |
| 159 | − BLOCKING_INVOKE_METHOD(this, "setHandLasers", Q_RETURN_ARG(bool, result), | |
| 160 | − Q_ARG(int, hands), Q_ARG(bool, enabled), Q_ARG(glm::vec4, color), Q_ARG(glm::vec3, direction)); | |
| 161 | − return result; | |
| 162 | − } | |
| 163 | − | |
| 164 | − auto offscreenUi = DependencyManager::get<OffscreenUi>(); | |
| 165 | − offscreenUi->getDesktop()->setProperty("hmdHandMouseActive", enabled); | |
| 166 | − return qApp->getActiveDisplayPlugin()->setHandLaser(hands, | |
| 167 | − enabled ? DisplayPlugin::HandLaserMode::Overlay : DisplayPlugin::HandLaserMode::None, | |
| 168 | − color, direction); | |
| 169 | −} | |
| 170 | − | |
| 171 | −bool HMDScriptingInterface::setExtraLaser(const glm::vec3& worldStart, bool enabled, const glm::vec4& color, const glm::vec3& direction) { | |
| 172 | − if (QThread::currentThread() != thread()) { | |
| 173 | − bool result; | |
| 174 | − BLOCKING_INVOKE_METHOD(this, "setExtraLaser", Q_RETURN_ARG(bool, result), | |
| 175 | − Q_ARG(glm::vec3, worldStart), Q_ARG(bool, enabled), Q_ARG(glm::vec4, color), Q_ARG(glm::vec3, direction)); | |
| 176 | − return result; | |
| 177 | − } | |
| 178 | − | |
| 179 | − auto offscreenUi = DependencyManager::get<OffscreenUi>(); | |
| 180 | − offscreenUi->getDesktop()->setProperty("hmdHandMouseActive", enabled); | |
| 181 | − | |
| 182 | − auto myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar(); | |
| 183 | − auto sensorToWorld = myAvatar->getSensorToWorldMatrix(); | |
| 184 | − auto worldToSensor = glm::inverse(sensorToWorld); | |
| 185 | − auto sensorStart = ::transformPoint(worldToSensor, worldStart); | |
| 186 | − auto sensorDirection = ::transformVectorFast(worldToSensor, direction); | |
| 187 | − | |
| 188 | − return qApp->getActiveDisplayPlugin()->setExtraLaser(enabled ? DisplayPlugin::HandLaserMode::Overlay : DisplayPlugin::HandLaserMode::None, | |
| 189 | − color, sensorStart, sensorDirection); | |
| 190 | −} | |
| 191 | − | |
| 192 | −void HMDScriptingInterface::disableExtraLaser() { | |
| 193 | − setExtraLaser(vec3(0), false, vec4(0), vec3(0)); | |
| 194 | −} | |
| 195 | − | |
| 196 | −void HMDScriptingInterface::disableHandLasers(int hands) { | |
| 197 | − setHandLasers(hands, false, vec4(0), vec3(0)); | |
| 198 | −} | |
| 199 | − | |
| 200 | 172 | bool HMDScriptingInterface::suppressKeyboard() { |
| 201 | 173 | return qApp->getActiveDisplayPlugin()->suppressKeyboard(); |
| 202 | 174 | } |