From 0f33d696d21841213f19143b82e077f2c714a74c Mon Sep 17 00:00:00 2001 From: SamGondelman Date: Fri, 15 Feb 2019 15:04:42 -0800 Subject: [PATCH 1/5] trying to fix pal colors --- interface/src/ui/overlays/Overlays.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/interface/src/ui/overlays/Overlays.cpp b/interface/src/ui/overlays/Overlays.cpp index e1708c14fe..6028f29ffa 100644 --- a/interface/src/ui/overlays/Overlays.cpp +++ b/interface/src/ui/overlays/Overlays.cpp @@ -358,6 +358,17 @@ EntityItemProperties Overlays::convertOverlayToEntityProperties(QVariantMap& ove return "none"; }); + RENAME_PROP_CONVERT(textures, textures, [](const QVariant& v) { + auto map = v.toMap(); + if (!map.isEmpty()) { + auto json = QJsonDocument::fromVariant(map); + if (!json.isNull()) { + return QVariant(QString(json.toJson())); + } + } + return v; + }); + if (type == "Shape" || type == "Box" || type == "Sphere" || type == "Gizmo") { RENAME_PROP(solid, isSolid); RENAME_PROP(isFilled, isSolid); From b00746c096a1098ded35b06944d233db9af82f78 Mon Sep 17 00:00:00 2001 From: danteruiz Date: Thu, 14 Feb 2019 09:46:41 -0800 Subject: [PATCH 2/5] Trim picks in use during quest: --- .../src/raypick/PickScriptingInterface.cpp | 12 ++++ .../src/raypick/PointerScriptingInterface.cpp | 11 ++++ libraries/pointers/src/PickCacheOptimizer.h | 2 + libraries/pointers/src/PickManager.cpp | 26 +++++++-- libraries/shared/src/Profile.cpp | 1 + libraries/shared/src/Profile.h | 1 + .../controllerScripts.js | 58 +++++++++++++++++++ .../controllers/controllerDispatcher.js | 1 + 8 files changed, 108 insertions(+), 4 deletions(-) create mode 100644 scripts/system/controllers/+android_questInterface/controllerScripts.js diff --git a/interface/src/raypick/PickScriptingInterface.cpp b/interface/src/raypick/PickScriptingInterface.cpp index ce01db3a56..cf7680bb6c 100644 --- a/interface/src/raypick/PickScriptingInterface.cpp +++ b/interface/src/raypick/PickScriptingInterface.cpp @@ -71,6 +71,18 @@ PickFilter getPickFilter(unsigned int filter) { unsigned int PickScriptingInterface::createRayPick(const QVariant& properties) { QVariantMap propMap = properties.toMap(); + +#if defined (Q_OS_ANDROID) + QString jointName { "" }; + if (propMap["joint"].isValid()) { + QString jointName = propMap["joint"].toString(); + QString mouseJoint { "Mouse" }; + if (jointName == mouseJoint) { + return PointerEvent::INVALID_POINTER_ID; + } + } +#endif + bool enabled = false; if (propMap["enabled"].isValid()) { enabled = propMap["enabled"].toBool(); diff --git a/interface/src/raypick/PointerScriptingInterface.cpp b/interface/src/raypick/PointerScriptingInterface.cpp index 19c20f0c06..10761e0696 100644 --- a/interface/src/raypick/PointerScriptingInterface.cpp +++ b/interface/src/raypick/PointerScriptingInterface.cpp @@ -150,6 +150,17 @@ unsigned int PointerScriptingInterface::createStylus(const QVariant& properties) unsigned int PointerScriptingInterface::createLaserPointer(const QVariant& properties) const { QVariantMap propertyMap = properties.toMap(); +#if defined (Q_OS_ANDROID) + QString jointName { "" }; + if (propertyMap["joint"].isValid()) { + QString jointName = propertyMap["joint"].toString(); + QString mouseJoint { "Mouse" }; + if (jointName == mouseJoint) { + return PointerEvent::INVALID_POINTER_ID; + } + } +#endif + bool faceAvatar = false; if (propertyMap["faceAvatar"].isValid()) { faceAvatar = propertyMap["faceAvatar"].toBool(); diff --git a/libraries/pointers/src/PickCacheOptimizer.h b/libraries/pointers/src/PickCacheOptimizer.h index 0bbdfea8e4..6aa343480b 100644 --- a/libraries/pointers/src/PickCacheOptimizer.h +++ b/libraries/pointers/src/PickCacheOptimizer.h @@ -11,6 +11,8 @@ #include #include "Pick.h" +#include "PerfStat.h" +#include "Profile.h" typedef struct PickCacheKey { PickFilter::Flags mask; diff --git a/libraries/pointers/src/PickManager.cpp b/libraries/pointers/src/PickManager.cpp index d3326ea8b4..0cf5f90e3d 100644 --- a/libraries/pointers/src/PickManager.cpp +++ b/libraries/pointers/src/PickManager.cpp @@ -6,6 +6,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // #include "PickManager.h" +#include "PerfStat.h" +#include "Profile.h" PickManager::PickManager() { setShouldPickHUDOperator([]() { return false; }); @@ -119,10 +121,26 @@ void PickManager::update() { bool shouldPickHUD = _shouldPickHUDOperator(); // FIXME: give each type its own expiry // Each type will update at least one pick, regardless of the expiry - _updatedPickCounts[PickQuery::Stylus] = _stylusPickCacheOptimizer.update(cachedPicks[PickQuery::Stylus], _nextPickToUpdate[PickQuery::Stylus], expiry, false); - _updatedPickCounts[PickQuery::Ray] = _rayPickCacheOptimizer.update(cachedPicks[PickQuery::Ray], _nextPickToUpdate[PickQuery::Ray], expiry, shouldPickHUD); - _updatedPickCounts[PickQuery::Parabola] = _parabolaPickCacheOptimizer.update(cachedPicks[PickQuery::Parabola], _nextPickToUpdate[PickQuery::Parabola], expiry, shouldPickHUD); - _updatedPickCounts[PickQuery::Collision] = _collisionPickCacheOptimizer.update(cachedPicks[PickQuery::Collision], _nextPickToUpdate[PickQuery::Collision], expiry, false); + { + PROFILE_RANGE(picks, "StylusPicks"); + PerformanceTimer perfTimer("StylusPicks"); + _updatedPickCounts[PickQuery::Stylus] = _stylusPickCacheOptimizer.update(cachedPicks[PickQuery::Stylus], _nextPickToUpdate[PickQuery::Stylus], expiry, false); + } + { + PROFILE_RANGE(picks, "RayPicks"); + PerformanceTimer perfTimer("RayPicks"); + _updatedPickCounts[PickQuery::Ray] = _rayPickCacheOptimizer.update(cachedPicks[PickQuery::Ray], _nextPickToUpdate[PickQuery::Ray], expiry, shouldPickHUD); + } + { + PROFILE_RANGE(picks, "ParabolaPick"); + PerformanceTimer perfTimer("ParabolaPick"); + _updatedPickCounts[PickQuery::Parabola] = _parabolaPickCacheOptimizer.update(cachedPicks[PickQuery::Parabola], _nextPickToUpdate[PickQuery::Parabola], expiry, shouldPickHUD); + } + { + PROFILE_RANGE(picks, "CollisoinPicks"); + PerformanceTimer perfTimer("CollisionPicks"); + _updatedPickCounts[PickQuery::Collision] = _collisionPickCacheOptimizer.update(cachedPicks[PickQuery::Collision], _nextPickToUpdate[PickQuery::Collision], expiry, false); + } } bool PickManager::isLeftHand(unsigned int uid) { diff --git a/libraries/shared/src/Profile.cpp b/libraries/shared/src/Profile.cpp index 778b39aca5..272538e26d 100644 --- a/libraries/shared/src/Profile.cpp +++ b/libraries/shared/src/Profile.cpp @@ -12,6 +12,7 @@ Q_LOGGING_CATEGORY(trace_app, "trace.app") Q_LOGGING_CATEGORY(trace_app_detail, "trace.app.detail") Q_LOGGING_CATEGORY(trace_metadata, "trace.metadata") Q_LOGGING_CATEGORY(trace_network, "trace.network") +Q_LOGGING_CATEGORY(trace_picks, "trace.picks") Q_LOGGING_CATEGORY(trace_parse, "trace.parse") Q_LOGGING_CATEGORY(trace_render, "trace.render") Q_LOGGING_CATEGORY(trace_render_detail, "trace.render.detail") diff --git a/libraries/shared/src/Profile.h b/libraries/shared/src/Profile.h index 01d86f8f2e..dc2ed6e754 100644 --- a/libraries/shared/src/Profile.h +++ b/libraries/shared/src/Profile.h @@ -18,6 +18,7 @@ Q_DECLARE_LOGGING_CATEGORY(trace_app) Q_DECLARE_LOGGING_CATEGORY(trace_app_detail) Q_DECLARE_LOGGING_CATEGORY(trace_metadata) Q_DECLARE_LOGGING_CATEGORY(trace_network) +Q_DECLARE_LOGGING_CATEGORY(trace_picks) Q_DECLARE_LOGGING_CATEGORY(trace_render) Q_DECLARE_LOGGING_CATEGORY(trace_render_detail) Q_DECLARE_LOGGING_CATEGORY(trace_render_gpu) diff --git a/scripts/system/controllers/+android_questInterface/controllerScripts.js b/scripts/system/controllers/+android_questInterface/controllerScripts.js new file mode 100644 index 0000000000..d313efaca1 --- /dev/null +++ b/scripts/system/controllers/+android_questInterface/controllerScripts.js @@ -0,0 +1,58 @@ +"use strict"; + +// controllerScripts.js +// +// Created by David Rowe on 15 Mar 2017. +// Copyright 2017 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +/* global Script, Menu */ + +var CONTOLLER_SCRIPTS = [ + "squeezeHands.js", + "controllerDisplayManager.js", + "toggleAdvancedMovementForHandControllers.js", + "controllerDispatcher.js", + "controllerModules/nearParentGrabOverlay.js", + "controllerModules/stylusInput.js", + "controllerModules/equipEntity.js", + "controllerModules/nearTrigger.js", + "controllerModules/webSurfaceLaserInput.js", + "controllerModules/inVREditMode.js", + "controllerModules/disableOtherModule.js", + "controllerModules/farTrigger.js", + "controllerModules/teleport.js", + "controllerModules/hudOverlayPointer.js", + "controllerModules/scaleEntity.js", + "controllerModules/nearGrabHyperLinkEntity.js", + "controllerModules/nearTabletHighlight.js", + "controllerModules/nearGrabEntity.js", + "controllerModules/farGrabEntity.js" +]; + +var DEBUG_MENU_ITEM = "Debug defaultScripts.js"; + +function runDefaultsTogether() { + for (var j in CONTOLLER_SCRIPTS) { + if (CONTOLLER_SCRIPTS.hasOwnProperty(j)) { + Script.include(CONTOLLER_SCRIPTS[j]); + } + } +} + +function runDefaultsSeparately() { + for (var i in CONTOLLER_SCRIPTS) { + if (CONTOLLER_SCRIPTS.hasOwnProperty(i)) { + Script.load(CONTOLLER_SCRIPTS[i]); + } + } +} + +if (Menu.isOptionChecked(DEBUG_MENU_ITEM)) { + runDefaultsSeparately(); +} else { + runDefaultsTogether(); +} diff --git a/scripts/system/controllers/controllerDispatcher.js b/scripts/system/controllers/controllerDispatcher.js index 2a5cf5a727..28c3e2a299 100644 --- a/scripts/system/controllers/controllerDispatcher.js +++ b/scripts/system/controllers/controllerDispatcher.js @@ -497,6 +497,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js"); distanceScaleEnd: true, hand: RIGHT_HAND }); + this.mouseRayPick = Pointers.createPointer(PickType.Ray, { joint: "Mouse", filter: Picks.PICK_OVERLAYS | Picks.PICK_ENTITIES | Picks.PICK_INCLUDE_NONCOLLIDABLE, From 4bbae1230d74a0784f2391480bdf6b5aeb657e18 Mon Sep 17 00:00:00 2001 From: danteruiz Date: Tue, 19 Feb 2019 10:07:36 -0800 Subject: [PATCH 3/5] making requested chantges --- interface/src/raypick/PickScriptingInterface.cpp | 4 ++-- interface/src/raypick/PointerScriptingInterface.cpp | 4 ++-- libraries/pointers/src/PickCacheOptimizer.h | 2 -- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/interface/src/raypick/PickScriptingInterface.cpp b/interface/src/raypick/PickScriptingInterface.cpp index cf7680bb6c..09f4b68cb9 100644 --- a/interface/src/raypick/PickScriptingInterface.cpp +++ b/interface/src/raypick/PickScriptingInterface.cpp @@ -76,8 +76,8 @@ unsigned int PickScriptingInterface::createRayPick(const QVariant& properties) { QString jointName { "" }; if (propMap["joint"].isValid()) { QString jointName = propMap["joint"].toString(); - QString mouseJoint { "Mouse" }; - if (jointName == mouseJoint) { + const QString MOUSE_JOINT = "Mouse"; + if (jointName == MOUSE_JOINT) { return PointerEvent::INVALID_POINTER_ID; } } diff --git a/interface/src/raypick/PointerScriptingInterface.cpp b/interface/src/raypick/PointerScriptingInterface.cpp index 10761e0696..1c80caff88 100644 --- a/interface/src/raypick/PointerScriptingInterface.cpp +++ b/interface/src/raypick/PointerScriptingInterface.cpp @@ -154,8 +154,8 @@ unsigned int PointerScriptingInterface::createLaserPointer(const QVariant& prope QString jointName { "" }; if (propertyMap["joint"].isValid()) { QString jointName = propertyMap["joint"].toString(); - QString mouseJoint { "Mouse" }; - if (jointName == mouseJoint) { + const QString MOUSE_JOINT = "Mouse"; + if (jointName == MOUSE_JOINT) { return PointerEvent::INVALID_POINTER_ID; } } diff --git a/libraries/pointers/src/PickCacheOptimizer.h b/libraries/pointers/src/PickCacheOptimizer.h index 6aa343480b..0bbdfea8e4 100644 --- a/libraries/pointers/src/PickCacheOptimizer.h +++ b/libraries/pointers/src/PickCacheOptimizer.h @@ -11,8 +11,6 @@ #include #include "Pick.h" -#include "PerfStat.h" -#include "Profile.h" typedef struct PickCacheKey { PickFilter::Flags mask; From d1c46e1cdc790618341fb155a7d4d0856a284ee5 Mon Sep 17 00:00:00 2001 From: danteruiz Date: Tue, 19 Feb 2019 14:48:17 -0800 Subject: [PATCH 4/5] fixing tablet pointer issues --- interface/src/ui/overlays/Overlays.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/interface/src/ui/overlays/Overlays.cpp b/interface/src/ui/overlays/Overlays.cpp index 2dd8008281..3b313b2237 100644 --- a/interface/src/ui/overlays/Overlays.cpp +++ b/interface/src/ui/overlays/Overlays.cpp @@ -79,7 +79,16 @@ void Overlays::cleanupAllOverlays() { cleanupOverlaysToDelete(); } -void Overlays::init() {} +void Overlays::init() { + auto entityScriptingInterface = DependencyManager::get().data(); + auto pointerManager = DependencyManager::get(); + connect(pointerManager.data(), &PointerManager::hoverBeginOverlay, entityScriptingInterface , &EntityScriptingInterface::hoverEnterEntity); + connect(pointerManager.data(), &PointerManager::hoverContinueOverlay, entityScriptingInterface, &EntityScriptingInterface::hoverOverEntity); + connect(pointerManager.data(), &PointerManager::hoverEndOverlay, entityScriptingInterface, &EntityScriptingInterface::hoverLeaveEntity); + connect(pointerManager.data(), &PointerManager::triggerBeginOverlay, entityScriptingInterface, &EntityScriptingInterface::mousePressOnEntity); + connect(pointerManager.data(), &PointerManager::triggerContinueOverlay, entityScriptingInterface, &EntityScriptingInterface::mouseMoveOnEntity); + connect(pointerManager.data(), &PointerManager::triggerEndOverlay, entityScriptingInterface, &EntityScriptingInterface::mouseReleaseOnEntity); +} void Overlays::update(float deltatime) { cleanupOverlaysToDelete(); From 44e70db4cdec308439ff387c884968f276647b25 Mon Sep 17 00:00:00 2001 From: SamGondelman Date: Tue, 19 Feb 2019 15:02:36 -0800 Subject: [PATCH 5/5] WE DID IT FOLKS --- .../src/material-networking/TextureCache.cpp | 31 +++++++++++++------ .../src/material-networking/TextureCache.h | 4 +-- .../src/model-networking/ModelCache.cpp | 4 +-- libraries/networking/src/ResourceCache.cpp | 4 +-- libraries/networking/src/ResourceCache.h | 2 +- libraries/shared/src/RegisteredMetaTypes.cpp | 9 +++++- .../shared/src/VariantMapToScriptValue.cpp | 4 +-- 7 files changed, 39 insertions(+), 19 deletions(-) diff --git a/libraries/material-networking/src/material-networking/TextureCache.cpp b/libraries/material-networking/src/material-networking/TextureCache.cpp index 9a9720c87d..43f467266a 100644 --- a/libraries/material-networking/src/material-networking/TextureCache.cpp +++ b/libraries/material-networking/src/material-networking/TextureCache.cpp @@ -354,7 +354,8 @@ NetworkTexture::NetworkTexture(const NetworkTexture& other) : _originalHeight(other._originalHeight), _width(other._width), _height(other._height), - _maxNumPixels(other._maxNumPixels) + _maxNumPixels(other._maxNumPixels), + _content(other._content) { if (_width == 0 || _height == 0 || other._currentlyLoadingResourceType == ResourceType::META || @@ -368,17 +369,30 @@ static bool isLocalUrl(const QUrl& url) { return (scheme == HIFI_URL_SCHEME_FILE || scheme == URL_SCHEME_QRC || scheme == RESOURCE_SCHEME); } -void NetworkTexture::setExtra(void* extra, bool isNewExtra) { +void NetworkTexture::setExtra(void* extra) { const TextureExtra* textureExtra = static_cast(extra); - _type = textureExtra ? textureExtra->type : image::TextureUsage::DEFAULT_TEXTURE; _maxNumPixels = textureExtra ? textureExtra->maxNumPixels : ABSOLUTE_MAX_TEXTURE_NUM_PIXELS; - _sourceChannel = textureExtra ? textureExtra->sourceChannel : image::ColorChannel::NONE; - if (isNewExtra && !_loaded) { + bool needsNewTextureSource = false; + auto type = textureExtra ? textureExtra->type : image::TextureUsage::DEFAULT_TEXTURE; + auto sourceChannel = textureExtra ? textureExtra->sourceChannel : image::ColorChannel::NONE; + if (type != _type || sourceChannel != _sourceChannel) { + needsNewTextureSource = true; + } + _type = type; + _sourceChannel = sourceChannel; + + auto content = textureExtra ? textureExtra->content : QByteArray(); + if (_content.isEmpty() && !content.isEmpty()) { + _content = content; + needsNewTextureSource = true; + } + + if (needsNewTextureSource) { _startedLoading = false; } - if (!_textureSource || isNewExtra) { + if (!_textureSource || needsNewTextureSource) { _textureSource = std::make_shared(_url, (int)_type); } _lowestRequestedMipLevel = 0; @@ -405,10 +419,9 @@ void NetworkTexture::setExtra(void* extra, bool isNewExtra) { } // if we have content, load it after we have our self pointer - auto content = textureExtra ? textureExtra->content : QByteArray(); - if (!content.isEmpty()) { + if (!_content.isEmpty()) { _startedLoading = true; - QMetaObject::invokeMethod(this, "downloadFinished", Qt::QueuedConnection, Q_ARG(const QByteArray&, content)); + QMetaObject::invokeMethod(this, "downloadFinished", Qt::QueuedConnection, Q_ARG(const QByteArray&, _content)); } } diff --git a/libraries/material-networking/src/material-networking/TextureCache.h b/libraries/material-networking/src/material-networking/TextureCache.h index a8b152c40e..dcab527e4a 100644 --- a/libraries/material-networking/src/material-networking/TextureCache.h +++ b/libraries/material-networking/src/material-networking/TextureCache.h @@ -64,7 +64,7 @@ public: Q_INVOKABLE void setOriginalDescriptor(ktx::KTXDescriptor* descriptor) { _originalKtxDescriptor.reset(descriptor); } - void setExtra(void* extra, bool isNewExtra) override; + void setExtra(void* extra) override; signals: void networkTextureCreated(const QWeakPointer& self); @@ -136,12 +136,12 @@ private: // mip offsets to change. ktx::KTXDescriptorPointer _originalKtxDescriptor; - int _originalWidth { 0 }; int _originalHeight { 0 }; int _width { 0 }; int _height { 0 }; int _maxNumPixels { ABSOLUTE_MAX_TEXTURE_NUM_PIXELS }; + QByteArray _content; friend class TextureCache; }; diff --git a/libraries/model-networking/src/model-networking/ModelCache.cpp b/libraries/model-networking/src/model-networking/ModelCache.cpp index b2645d20c8..581196b2cc 100644 --- a/libraries/model-networking/src/model-networking/ModelCache.cpp +++ b/libraries/model-networking/src/model-networking/ModelCache.cpp @@ -309,7 +309,7 @@ public: virtual void downloadFinished(const QByteArray& data) override; - void setExtra(void* extra, bool isNewExtra) override; + void setExtra(void* extra) override; protected: Q_INVOKABLE void setGeometryDefinition(HFMModel::Pointer hfmModel, QVariantHash mapping); @@ -320,7 +320,7 @@ private: bool _combineParts; }; -void GeometryDefinitionResource::setExtra(void* extra, bool isNewExtra) { +void GeometryDefinitionResource::setExtra(void* extra) { const GeometryExtra* geometryExtra = static_cast(extra); _mapping = geometryExtra ? geometryExtra->mapping : QVariantHash(); _textureBaseUrl = geometryExtra ? resolveTextureBaseUrl(_url, geometryExtra->textureBaseUrl) : QUrl(); diff --git a/libraries/networking/src/ResourceCache.cpp b/libraries/networking/src/ResourceCache.cpp index 8ad1b41020..7345081380 100644 --- a/libraries/networking/src/ResourceCache.cpp +++ b/libraries/networking/src/ResourceCache.cpp @@ -355,7 +355,7 @@ QSharedPointer ResourceCache::getResource(const QUrl& url, const QUrl& } else if (resourcesWithExtraHash.size() > 0.0f) { // We haven't seen this extra info before, but we've already downloaded the resource. We need a new copy of this object (with any old hash). resource = createResourceCopy(resourcesWithExtraHash.begin().value().lock()); - resource->setExtra(extra, true); + resource->setExtra(extra); resource->setExtraHash(extraHash); resource->setSelf(resource); resource->setCache(this); @@ -375,7 +375,7 @@ QSharedPointer ResourceCache::getResource(const QUrl& url, const QUrl& if (!resource) { resource = createResource(url); - resource->setExtra(extra, false); + resource->setExtra(extra); resource->setExtraHash(extraHash); resource->setSelf(resource); resource->setCache(this); diff --git a/libraries/networking/src/ResourceCache.h b/libraries/networking/src/ResourceCache.h index 62800a6ac2..2096213273 100644 --- a/libraries/networking/src/ResourceCache.h +++ b/libraries/networking/src/ResourceCache.h @@ -417,7 +417,7 @@ public: unsigned int getDownloadAttempts() { return _attempts; } unsigned int getDownloadAttemptsRemaining() { return _attemptsRemaining; } - virtual void setExtra(void* extra, bool isNewExtra) {}; + virtual void setExtra(void* extra) {}; void setExtraHash(size_t extraHash) { _extraHash = extraHash; } size_t getExtraHash() const { return _extraHash; } diff --git a/libraries/shared/src/RegisteredMetaTypes.cpp b/libraries/shared/src/RegisteredMetaTypes.cpp index ec1126c92f..47549b639a 100644 --- a/libraries/shared/src/RegisteredMetaTypes.cpp +++ b/libraries/shared/src/RegisteredMetaTypes.cpp @@ -1269,7 +1269,14 @@ QVariantMap parseTexturesToMap(QString newTextures, const QVariantMap& defaultTe QVariantMap newTexturesMap = newTexturesJson.toVariant().toMap(); QVariantMap toReturn = defaultTextures; for (auto& texture : newTexturesMap.keys()) { - toReturn[texture] = newTexturesMap[texture]; + auto newURL = newTexturesMap[texture]; + if (newURL.canConvert()) { + toReturn[texture] = newURL.toUrl(); + } else if (newURL.canConvert()) { + toReturn[texture] = QUrl(newURL.toString()); + } else { + toReturn[texture] = newURL; + } } return toReturn; diff --git a/libraries/shared/src/VariantMapToScriptValue.cpp b/libraries/shared/src/VariantMapToScriptValue.cpp index 1a747a4e5b..437f60a2ed 100644 --- a/libraries/shared/src/VariantMapToScriptValue.cpp +++ b/libraries/shared/src/VariantMapToScriptValue.cpp @@ -26,10 +26,10 @@ QScriptValue variantToScriptValue(QVariant& qValue, QScriptEngine& scriptEngine) case QVariant::Double: return qValue.toDouble(); break; - case QVariant::String: { + case QVariant::String: + case QVariant::Url: return scriptEngine.newVariant(qValue); break; - } case QVariant::Map: { QVariantMap childMap = qValue.toMap(); return variantMapToScriptValue(childMap, scriptEngine);