From 176d69444f461cdb16d3d26b9ae0f06e17db0476 Mon Sep 17 00:00:00 2001
From: Dante Ruiz <danteruiz102@gmail.com>
Date: Fri, 4 May 2018 14:20:17 -0700
Subject: [PATCH 1/4] fix-another-highlighting-issue

---
 .../controllerModules/highlightNearbyEntities.js      | 11 ++++++++++-
 .../controllers/controllerModules/inEditMode.js       |  1 +
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/scripts/system/controllers/controllerModules/highlightNearbyEntities.js b/scripts/system/controllers/controllerModules/highlightNearbyEntities.js
index 32e1b4300d..bc09ebee7a 100644
--- a/scripts/system/controllers/controllerModules/highlightNearbyEntities.js
+++ b/scripts/system/controllers/controllerModules/highlightNearbyEntities.js
@@ -56,6 +56,12 @@
             return canGrabEntity;
         };
 
+        this.clearAll = function() {
+            this.highlightedEntities.forEach(function(entity) {
+                dispatcherUtils.unhighlightTargetEntity(entity);
+            });
+        };
+
         this.hasHyperLink = function(props) {
             return (props.href !== "" && props.href !== undefined);
         };
@@ -121,7 +127,6 @@
             if (channel === 'Hifi-unhighlight-entity') {
                 try {
                     data = JSON.parse(message);
-
                     var hand = data.hand;
                     if (hand === dispatcherUtils.LEFT_HAND) {
                         leftHighlightNearbyEntities.removeEntityFromHighlightList(data.entityID);
@@ -131,6 +136,9 @@
                 } catch (e) {
                     print("Failed to parse message");
                 }
+            } else if (channel === 'Hifi-unhighlight-all') {
+                leftHighlightNearbyEntities.clearAll();
+                rightHighlightNearbyEntities.clearAll();
             }
         }
     };
@@ -145,6 +153,7 @@
         dispatcherUtils.disableDispatcherModule("RightHighlightNearbyEntities");
     }
     Messages.subscribe('Hifi-unhighlight-entity');
+    Messages.subscribe('Hifi-unhighlight-all');
     Messages.messageReceived.connect(handleMessage);
     Script.scriptEnding.connect(cleanup);
 }());
diff --git a/scripts/system/controllers/controllerModules/inEditMode.js b/scripts/system/controllers/controllerModules/inEditMode.js
index f7e86f9042..3ad7902d71 100644
--- a/scripts/system/controllers/controllerModules/inEditMode.js
+++ b/scripts/system/controllers/controllerModules/inEditMode.js
@@ -78,6 +78,7 @@ Script.include("/~/system/libraries/utils.js");
                 if (controllerData.triggerValues[this.hand] < TRIGGER_ON_VALUE) {
                     this.triggerClicked = false;
                 }
+                Messages.sendLocalMessage('Hifi-unhighlight-all', '');
                 return makeRunningValues(true, [], []);
             }
             this.triggerClicked = false;

From 4ebed7605c979eed603a1d7738730537708e3359 Mon Sep 17 00:00:00 2001
From: Zach Fox <fox@highfidelity.io>
Date: Fri, 4 May 2018 10:10:48 -0700
Subject: [PATCH 2/4] MS14758: Fix avatar reset when gifting worn avatar

---
 interface/resources/qml/hifi/commerce/purchases/Purchases.qml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/interface/resources/qml/hifi/commerce/purchases/Purchases.qml b/interface/resources/qml/hifi/commerce/purchases/Purchases.qml
index 08e3e7a552..b54a931c51 100644
--- a/interface/resources/qml/hifi/commerce/purchases/Purchases.qml
+++ b/interface/resources/qml/hifi/commerce/purchases/Purchases.qml
@@ -582,7 +582,7 @@ Rectangle {
                                 }
                                 lightboxPopup.button2text = "CONFIRM";
                                 lightboxPopup.button2method = function() {
-                                    MyAvatar.skeletonModelURL = '';
+                                    MyAvatar.useFullAvatarURL('');
                                     root.activeView = "giftAsset";
                                     lightboxPopup.visible = false;
                                 };

From 8480bb962b99bdcf2a5b3e457d9cd36106889b68 Mon Sep 17 00:00:00 2001
From: "Anthony J. Thibault" <tony@highfidelity.io>
Date: Thu, 3 May 2018 13:51:50 -0700
Subject: [PATCH 3/4] Fix for crash deep in QML after useFullAvatarURL

Here we avoid calling FSTReader::downloadMapping() from within MyAvatar::useFullAvatarURL().
This prevents the error case where a QEventLoop is entered during QML execution.
---
 interface/src/avatar/MyAvatar.cpp              | 18 +++++++++++-------
 .../src/model-networking/ModelCache.cpp        | 14 +++++++++-----
 .../src/model-networking/ModelCache.h          |  2 ++
 3 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp
index 249a765d92..3eef1dac3c 100755
--- a/interface/src/avatar/MyAvatar.cpp
+++ b/interface/src/avatar/MyAvatar.cpp
@@ -1473,6 +1473,15 @@ void MyAvatar::setSkeletonModelURL(const QUrl& skeletonModelURL) {
     std::shared_ptr<QMetaObject::Connection> skeletonConnection = std::make_shared<QMetaObject::Connection>();
     *skeletonConnection = QObject::connect(_skeletonModel.get(), &SkeletonModel::skeletonLoaded, [this, skeletonModelChangeCount, skeletonConnection]() {
        if (skeletonModelChangeCount == _skeletonModelChangeCount) {
+
+           if (_fullAvatarModelName.isEmpty()) {
+               // Store the FST file name into preferences
+               const auto& mapping = _skeletonModel->getGeometry()->getMapping();
+               if (mapping.value("name").isValid()) {
+                   _fullAvatarModelName = mapping.value("name").toString();
+               }
+           }
+
            initHeadBones();
            _skeletonModel->setCauterizeBoneSet(_headBoneSet);
            _fstAnimGraphOverrideUrl = _skeletonModel->getGeometry()->getAnimGraphOverrideUrl();
@@ -1535,12 +1544,7 @@ void MyAvatar::useFullAvatarURL(const QUrl& fullAvatarURL, const QString& modelN
 
     if (_fullAvatarURLFromPreferences != fullAvatarURL) {
         _fullAvatarURLFromPreferences = fullAvatarURL;
-        if (modelName.isEmpty()) {
-            QVariantHash fullAvatarFST = FSTReader::downloadMapping(_fullAvatarURLFromPreferences.toString());
-            _fullAvatarModelName = fullAvatarFST["name"].toString();
-        } else {
-            _fullAvatarModelName = modelName;
-        }
+        _fullAvatarModelName = modelName;
     }
 
     const QString& urlString = fullAvatarURL.toString();
@@ -1548,8 +1552,8 @@ void MyAvatar::useFullAvatarURL(const QUrl& fullAvatarURL, const QString& modelN
         setSkeletonModelURL(fullAvatarURL);
         UserActivityLogger::getInstance().changedModel("skeleton", urlString);
     }
+
     markIdentityDataChanged();
-    
 }
 
 void MyAvatar::setAttachmentData(const QVector<AttachmentData>& attachmentData) {
diff --git a/libraries/model-networking/src/model-networking/ModelCache.cpp b/libraries/model-networking/src/model-networking/ModelCache.cpp
index f17cdbb7e8..939168f1b1 100644
--- a/libraries/model-networking/src/model-networking/ModelCache.cpp
+++ b/libraries/model-networking/src/model-networking/ModelCache.cpp
@@ -63,16 +63,18 @@ void GeometryMappingResource::downloadFinished(const QByteArray& data) {
     PROFILE_ASYNC_BEGIN(resource_parse_geometry, "GeometryMappingResource::downloadFinished", _url.toString(),
                          { { "url", _url.toString() } });
 
-    auto mapping = FSTReader::readMapping(data);
+    // store parsed contents of FST file
+    _mapping = FSTReader::readMapping(data);
+
+    QString filename = _mapping.value("filename").toString();
 
-    QString filename = mapping.value("filename").toString();
     if (filename.isNull()) {
         qCDebug(modelnetworking) << "Mapping file" << _url << "has no \"filename\" field";
         finishedLoading(false);
     } else {
         QUrl url = _url.resolved(filename);
 
-        QString texdir = mapping.value(TEXDIR_FIELD).toString();
+        QString texdir = _mapping.value(TEXDIR_FIELD).toString();
         if (!texdir.isNull()) {
             if (!texdir.endsWith('/')) {
                 texdir += '/';
@@ -82,7 +84,8 @@ void GeometryMappingResource::downloadFinished(const QByteArray& data) {
             _textureBaseUrl = url.resolved(QUrl("."));
         }
 
-        auto animGraphVariant = mapping.value("animGraphUrl");
+        auto animGraphVariant = _mapping.value("animGraphUrl");
+
         if (animGraphVariant.isValid()) {
             QUrl fstUrl(animGraphVariant.toString());
             if (fstUrl.isValid()) {
@@ -95,7 +98,7 @@ void GeometryMappingResource::downloadFinished(const QByteArray& data) {
         }
 
         auto modelCache = DependencyManager::get<ModelCache>();
-        GeometryExtra extra{ mapping, _textureBaseUrl, false };
+        GeometryExtra extra{ _mapping, _textureBaseUrl, false };
 
         // Get the raw GeometryResource
         _geometryResource = modelCache->getResource(url, QUrl(), &extra).staticCast<GeometryResource>();
@@ -362,6 +365,7 @@ Geometry::Geometry(const Geometry& geometry) {
     }
 
     _animGraphOverrideUrl = geometry._animGraphOverrideUrl;
+    _mapping = geometry._mapping;
 }
 
 void Geometry::setTextures(const QVariantMap& textureMap) {
diff --git a/libraries/model-networking/src/model-networking/ModelCache.h b/libraries/model-networking/src/model-networking/ModelCache.h
index 9532f39ce0..6978e0077e 100644
--- a/libraries/model-networking/src/model-networking/ModelCache.h
+++ b/libraries/model-networking/src/model-networking/ModelCache.h
@@ -55,6 +55,7 @@ public:
 
     virtual bool areTexturesLoaded() const;
     const QUrl& getAnimGraphOverrideUrl() const { return _animGraphOverrideUrl; }
+    const QVariantHash& getMapping() const { return _mapping; }
 
 protected:
     friend class GeometryMappingResource;
@@ -68,6 +69,7 @@ protected:
     NetworkMaterials _materials;
 
     QUrl _animGraphOverrideUrl;
+    QVariantHash _mapping;  // parsed contents of FST file.
 
 private:
     mutable bool _areTexturesLoaded { false };

From b4cfea2fbc4793bc9f3fddcf8949ab67cf826c19 Mon Sep 17 00:00:00 2001
From: Alexander Ivash <elderorb@gmail.com>
Date: Sun, 6 May 2018 17:17:06 +0300
Subject: [PATCH 4/4] FB14818 Login page for steam is blank

---
 interface/resources/qml/LoginDialog/SignInBody.qml | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/interface/resources/qml/LoginDialog/SignInBody.qml b/interface/resources/qml/LoginDialog/SignInBody.qml
index c4b6c2aee1..9cb1add704 100644
--- a/interface/resources/qml/LoginDialog/SignInBody.qml
+++ b/interface/resources/qml/LoginDialog/SignInBody.qml
@@ -84,11 +84,9 @@ Item {
             height: undefined // invalidate so that the image's size sets the height
             focus: true
 
-            style: OriginalStyles.ButtonStyle {
-                background: Image {
-                    id: buttonImage
-                    source: "../../images/steam-sign-in.png"
-                }
+            background: Image {
+                id: buttonImage
+                source: "../../images/steam-sign-in.png"
             }
             onClicked: signInBody.login()
         }