Merge pull request #11655 from dback2/tabletcontextualmode

add a tablet contextual mode flag to HMDScriptingInterface used to keep tablet in place
This commit is contained in:
Ryan Downe Karpf 2017-10-30 08:56:26 -07:00 committed by GitHub
commit 28a99fe685
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 6 deletions

View file

@ -219,7 +219,7 @@ Item {
function setShown(value) {
if (value === true) {
HMD.openTablet()
HMD.openTablet(HMD.tabletContextualMode) // pass in current contextual mode flag to maintain flag (otherwise uses default false argument)
} else {
HMD.closeTablet()
}

View file

@ -100,10 +100,21 @@ void HMDScriptingInterface::deactivateHMDHandMouse() {
void HMDScriptingInterface::closeTablet() {
_showTablet = false;
_tabletContextualMode = false;
}
void HMDScriptingInterface::openTablet() {
void HMDScriptingInterface::openTablet(bool contextualMode) {
_showTablet = true;
_tabletContextualMode = contextualMode;
}
void HMDScriptingInterface::toggleShouldShowTablet() {
setShouldShowTablet(!getShouldShowTablet());
}
void HMDScriptingInterface::setShouldShowTablet(bool value) {
_showTablet = value;
_tabletContextualMode = false;
}
QScriptValue HMDScriptingInterface::getHUDLookAtPosition2D(QScriptContext* context, QScriptEngine* engine) {

View file

@ -30,6 +30,7 @@ class HMDScriptingInterface : public AbstractHMDScriptingInterface, public Depen
Q_PROPERTY(glm::quat orientation READ getOrientation)
Q_PROPERTY(bool mounted READ isMounted NOTIFY mountedChanged)
Q_PROPERTY(bool showTablet READ getShouldShowTablet)
Q_PROPERTY(bool tabletContextualMode READ getTabletContextualMode)
Q_PROPERTY(QUuid tabletID READ getCurrentTabletFrameID WRITE setCurrentTabletFrameID)
Q_PROPERTY(QUuid homeButtonID READ getCurrentHomeButtonID WRITE setCurrentHomeButtonID)
Q_PROPERTY(QUuid homeButtonHighlightID READ getCurrentHomeButtonHightlightID WRITE setCurrentHomeButtonHightlightID)
@ -75,7 +76,7 @@ public:
Q_INVOKABLE void closeTablet();
Q_INVOKABLE void openTablet();
Q_INVOKABLE void openTablet(bool contextualMode = false);
signals:
bool shouldShowHandControllersChanged();
@ -88,9 +89,10 @@ public:
bool isMounted() const;
void toggleShouldShowTablet() { _showTablet = !_showTablet; }
void setShouldShowTablet(bool value) { _showTablet = value; }
void toggleShouldShowTablet();
void setShouldShowTablet(bool value);
bool getShouldShowTablet() const { return _showTablet; }
bool getTabletContextualMode() const { return _tabletContextualMode; }
void setCurrentTabletFrameID(QUuid tabletID) { _tabletUIID = tabletID; }
QUuid getCurrentTabletFrameID() const { return _tabletUIID; }
@ -106,6 +108,7 @@ public:
private:
bool _showTablet { false };
bool _tabletContextualMode { false };
QUuid _tabletUIID; // this is the entityID of the tablet frame
QUuid _tabletScreenID; // this is the overlayID which is part of (a child of) the tablet-ui.
QUuid _homeButtonID;

View file

@ -124,7 +124,9 @@
print("TABLET in showTabletUI, already rezzed");
}
var tabletProperties = {};
UIWebTablet.calculateTabletAttachmentProperties(activeHand, true, tabletProperties);
if (!HMD.tabletContextualMode) { // contextual mode forces tablet in place -> don't update attachment
UIWebTablet.calculateTabletAttachmentProperties(activeHand, true, tabletProperties);
}
tabletProperties.visible = true;
Overlays.editOverlay(HMD.tabletID, tabletProperties);
Overlays.editOverlay(HMD.homeButtonID, { visible: true });