fixing login qml/using HMD position for overlay

This commit is contained in:
Wayne Chen 2018-11-07 14:05:06 -08:00
parent edf16b15e8
commit 8e075c2a7c
4 changed files with 22 additions and 8 deletions

View file

@ -13,7 +13,7 @@ import QtQuick 2.7
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4 as OriginalStyles
import controlsUit 1.0 as HiFiControlsUit
import controlsUit 1.0 as HifiControlsUit
import stylesUit 1.0 as HifiStylesUit
Item {

View file

@ -15,7 +15,7 @@ import QtGraphicalEffects 1.0
import "." as Windows
import stylesUit 1.0
import controlsUit 1.0 as HiFiControlsUit
import controlsUit 1.0 as HifiControlsUit
// FIXME how do I set the initial position of a window without
// overriding places where the a individual client of the window
@ -178,7 +178,7 @@ Windows.Window {
children: [ footer ]
}
HiFiControlsUit.Keyboard {
HifiControlsUit.Keyboard {
id: keyboard
enabled: !keyboardOverride
raised: keyboardEnabled && keyboardRaised

View file

@ -4383,7 +4383,7 @@ void Application::wheelEvent(QWheelEvent* event) const {
_controllerScriptingInterface->emitWheelEvent(event); // send events to any registered scripts
// if one of our scripts have asked to capture this event, then stop processing it
if (_controllerScriptingInterface->isWheelCaptured()) {
if (_controllerScriptingInterface->isWheelCaptured() || _loginDialogPoppedUp) {
return;
}
@ -8504,14 +8504,28 @@ void Application::checkReadyToCreateLoginDialogOverlay() {
void Application::createLoginDialogOverlay() {
auto avatarManager = DependencyManager::get<AvatarManager>();
auto HMD = DependencyManager::get<HMDScriptingInterface>();
auto myAvatar = avatarManager->getMyAvatar();
auto headInt = _controllerScriptingInterface->getActions()["Head"].toInt();
auto headPose = _controllerScriptingInterface->getPoseValue(headInt);
// reference vector for overlay to spawn.
glm::vec3 refOverlayVec;
if (headPose.isValid()) {
qDebug() << "controller head position = " << vec3toVariant(headPose.translation);
refOverlayVec = headPose.translation;
} else if (HMD->getPosition() != glm::vec3()) {
refOverlayVec = HMD->getPosition();
} else {
refOverlayVec = myAvatar->getHeadPosition();
}
Overlays& overlays = qApp->getOverlays();
// DEFAULT_DPI / tablet scale percentage
float overlayDpi = 31.0f / (75.0f / 100.0f);
QVariantMap overlayProperties {
{ "name", "LoginDialogOverlay" },
{ "url", OVERLAY_LOGIN_DIALOG_URL },
{ "position", vec3toVariant(myAvatar->getHeadPosition() - glm::vec3(0.0f, -0.1f, 1.0f)) },
{ "position", vec3toVariant(refOverlayVec - glm::vec3(0.0f, -0.1f, 1.0f)) },
{ "orientation", quatToVariant(myAvatar->getWorldOrientation()) },
{ "isSolid", true },
{ "grabbable", false },

View file

@ -391,6 +391,9 @@ public:
QVariant getPlayAreaRect();
QVector<glm::vec3> getSensorPositions();
// Get the position of the HMD
glm::vec3 getPosition() const;
private:
bool _showTablet { false };
bool _tabletContextualMode { false };
@ -403,9 +406,6 @@ private:
QUuid _miniTabletScreenID;
int _miniTabletHand { -1 };
// Get the position of the HMD
glm::vec3 getPosition() const;
// Get the orientation of the HMD
glm::quat getOrientation() const;