From 47b59ffae38c71a59082a455d64c445e0eb88cc4 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Thu, 19 Jan 2017 14:10:48 -0800 Subject: [PATCH] don't save tablet to Settings when logging out or switching domains --- interface/src/avatar/MyAvatar.cpp | 6 ++++++ scripts/system/libraries/WebTablet.js | 2 +- scripts/system/tablet-ui/tabletUI.js | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index 8a1b174188..0421d229c5 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -796,8 +796,14 @@ void MyAvatar::saveData() { settings.beginWriteArray("avatarEntityData"); int avatarEntityIndex = 0; + auto hmdInterface = DependencyManager::get(); _avatarEntitiesLock.withReadLock([&] { for (auto entityID : _avatarEntityData.keys()) { + if (hmdInterface->getCurrentTableUIID() == entityID) { + // don't persist the tablet between domains / sessions + continue; + } + settings.setArrayIndex(avatarEntityIndex); settings.setValue("id", entityID); settings.setValue("properties", _avatarEntityData.value(entityID)); diff --git a/scripts/system/libraries/WebTablet.js b/scripts/system/libraries/WebTablet.js index 31d3d91f54..a7800561de 100644 --- a/scripts/system/libraries/WebTablet.js +++ b/scripts/system/libraries/WebTablet.js @@ -136,7 +136,7 @@ WebTablet = function (url, width, dpi, hand, clientOnly) { this.state = "idle"; this.getRoot = function() { - return Entities.getWebViewRoot(_this.webEntityID); + return Entities.getWebViewRoot(_this.tabletEntityID); }; this.getLocation = function() { diff --git a/scripts/system/tablet-ui/tabletUI.js b/scripts/system/tablet-ui/tabletUI.js index b65eae153d..3fac3a1c05 100644 --- a/scripts/system/tablet-ui/tabletUI.js +++ b/scripts/system/tablet-ui/tabletUI.js @@ -26,7 +26,7 @@ print("show tablet-ui"); UIWebTablet = new WebTablet("qml/hifi/tablet/TabletRoot.qml", null, null, activeHand, true); UIWebTablet.register(); - HMD.tabletID = UIWebTablet.webEntityID; + HMD.tabletID = UIWebTablet.tabletEntityID; } function hideTabletUI() {