From 8a071f18b3e104c4ef64c393b5b7f8cc1672f42a Mon Sep 17 00:00:00 2001 From: Brad Hefta-Gaub Date: Thu, 20 Oct 2016 11:18:20 -0700 Subject: [PATCH] more work --- .../src/scripting/HMDScriptingInterface.cpp | 16 ++++++++++++++++ interface/src/scripting/HMDScriptingInterface.h | 6 +++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/interface/src/scripting/HMDScriptingInterface.cpp b/interface/src/scripting/HMDScriptingInterface.cpp index 2c769c37d4..abeae690f0 100644 --- a/interface/src/scripting/HMDScriptingInterface.cpp +++ b/interface/src/scripting/HMDScriptingInterface.cpp @@ -130,6 +130,22 @@ bool HMDScriptingInterface::setHandLasers(int hands, bool enabled, const glm::ve color, direction); } +bool HMDScriptingInterface::setExtraLaser(const vec3& worldStart, bool enabled, const vec4& color, const vec3& direction) const { + auto offscreenUi = DependencyManager::get(); + offscreenUi->executeOnUiThread([offscreenUi, enabled] { + offscreenUi->getDesktop()->setProperty("hmdHandMouseActive", enabled); + }); + + mat4 extraLaserPose; + return qApp->getActiveDisplayPlugin()->setExtraLaser(extraLaserPose, + enabled ? DisplayPlugin::HandLaserMode::Overlay : DisplayPlugin::HandLaserMode::None, + color, direction); +} + +void HMDScriptingInterface::disableExtraLaser() const { + setExtraLaser(vec3(0), false, vec4(0), vec3(0)); +} + void HMDScriptingInterface::disableHandLasers(int hands) const { setHandLasers(hands, false, vec4(0), vec3(0)); } diff --git a/interface/src/scripting/HMDScriptingInterface.h b/interface/src/scripting/HMDScriptingInterface.h index 4148b1cb4a..101c7f6445 100644 --- a/interface/src/scripting/HMDScriptingInterface.h +++ b/interface/src/scripting/HMDScriptingInterface.h @@ -42,8 +42,12 @@ public: Q_INVOKABLE bool isHandControllerAvailable(); Q_INVOKABLE bool setHandLasers(int hands, bool enabled, const glm::vec4& color, const glm::vec3& direction) const; - Q_INVOKABLE void disableHandLasers(int hands) const; + + Q_INVOKABLE bool setExtraLaser(const vec3& worldStart, bool enabled, const vec4& color, const vec3& direction) const; + Q_INVOKABLE void disableExtraLaser() const; + + /// Suppress the activation of any on-screen keyboard so that a script operation will /// not be interrupted by a keyboard popup /// Returns false if there is already an active keyboard displayed.