From 2a9bbfa8088767c066fef119f145d0040d2f05e2 Mon Sep 17 00:00:00 2001 From: vladest Date: Sun, 4 Mar 2018 13:19:56 +0100 Subject: [PATCH 01/24] Wrap text in query dialogs. Add right margins for input field and buttons --- interface/resources/qml/controls-uit/TextField.qml | 2 ++ interface/resources/qml/dialogs/TabletQueryDialog.qml | 8 +++++--- .../src/scripting/AssetMappingsScriptingInterface.cpp | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/interface/resources/qml/controls-uit/TextField.qml b/interface/resources/qml/controls-uit/TextField.qml index ee646b2575..729fcd44a6 100644 --- a/interface/resources/qml/controls-uit/TextField.qml +++ b/interface/resources/qml/controls-uit/TextField.qml @@ -165,8 +165,10 @@ TextField { text: textField.label colorScheme: textField.colorScheme anchors.left: parent.left + anchors.right: parent.right anchors.bottom: parent.top anchors.bottomMargin: 3 + wrapMode: Text.WordWrap visible: label != "" } } diff --git a/interface/resources/qml/dialogs/TabletQueryDialog.qml b/interface/resources/qml/dialogs/TabletQueryDialog.qml index e21677c12c..182cc12c9f 100644 --- a/interface/resources/qml/dialogs/TabletQueryDialog.qml +++ b/interface/resources/qml/dialogs/TabletQueryDialog.qml @@ -72,13 +72,13 @@ TabletModalWindow { QtObject { id: d - readonly property int minWidth: 470 - readonly property int maxWidth: 470 + readonly property int minWidth: modalWindowItem.width + readonly property int maxWidth: modalWindowItem.width readonly property int minHeight: 120 readonly property int maxHeight: 720 function resize() { - var targetWidth = Math.max(titleWidth, 470) + var targetWidth = Math.max(titleWidth, modalWindowItem.width) var targetHeight = (items ? comboBox.controlHeight : textResult.controlHeight) + 5 * hifi.dimensions.contentSpacing.y + buttons.height modalWindowItem.width = (targetWidth < d.minWidth) ? d.minWidth : ((targetWidth > d.maxWdith) ? d.maxWidth : targetWidth); modalWindowItem.height = ((targetHeight < d.minHeight) ? d.minHeight : ((targetHeight > d.maxHeight) ? d.maxHeight : targetHeight)) + ((keyboardEnabled && keyboardRaised) ? (keyboard.raisedHeight + 2 * hifi.dimensions.contentSpacing.y) : 0) + modalWindowItem.frameMarginTop @@ -106,6 +106,7 @@ TabletModalWindow { right: parent.right; bottom: parent.bottom leftMargin: 5 + rightMargin: 5 } } @@ -150,6 +151,7 @@ TabletModalWindow { bottom: parent.bottom right: parent.right margins: 0 + rightMargin: hifi.dimensions.borderRadius bottomMargin: hifi.dimensions.contentSpacing.y } Button { action: cancelAction } diff --git a/interface/src/scripting/AssetMappingsScriptingInterface.cpp b/interface/src/scripting/AssetMappingsScriptingInterface.cpp index dc227c21ba..ecaa5f2f6e 100644 --- a/interface/src/scripting/AssetMappingsScriptingInterface.cpp +++ b/interface/src/scripting/AssetMappingsScriptingInterface.cpp @@ -69,11 +69,11 @@ void AssetMappingsScriptingInterface::getMapping(QString path, QJSValue callback void AssetMappingsScriptingInterface::uploadFile(QString path, QString mapping, QJSValue startedCallback, QJSValue completedCallback, bool dropEvent) { static const QString helpText = - "Upload your asset to a specific folder by entering the full path. Specifying\n" + "Upload your asset to a specific folder by entering the full path. Specifying" "a new folder name will automatically create that folder for you."; static const QString dropHelpText = "This file will be added to your Asset Server.\n" - "Use the field below to place your file in a specific folder or to rename it.\n" + "Use the field below to place your file in a specific folder or to rename it. " "Specifying a new folder name will automatically create that folder for you."; auto offscreenUi = DependencyManager::get(); From 126f05f8bd1bb78a808661b361fe6b736d08a86a Mon Sep 17 00:00:00 2001 From: vladest Date: Sun, 4 Mar 2018 13:28:26 +0100 Subject: [PATCH 02/24] Added space --- interface/src/scripting/AssetMappingsScriptingInterface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/src/scripting/AssetMappingsScriptingInterface.cpp b/interface/src/scripting/AssetMappingsScriptingInterface.cpp index ecaa5f2f6e..e99cab8e96 100644 --- a/interface/src/scripting/AssetMappingsScriptingInterface.cpp +++ b/interface/src/scripting/AssetMappingsScriptingInterface.cpp @@ -69,7 +69,7 @@ void AssetMappingsScriptingInterface::getMapping(QString path, QJSValue callback void AssetMappingsScriptingInterface::uploadFile(QString path, QString mapping, QJSValue startedCallback, QJSValue completedCallback, bool dropEvent) { static const QString helpText = - "Upload your asset to a specific folder by entering the full path. Specifying" + "Upload your asset to a specific folder by entering the full path. Specifying " "a new folder name will automatically create that folder for you."; static const QString dropHelpText = "This file will be added to your Asset Server.\n" From 8723b317c907bbab98d6ca4ae61ed4afb713b8b0 Mon Sep 17 00:00:00 2001 From: vladest Date: Tue, 6 Mar 2018 13:09:08 +0100 Subject: [PATCH 03/24] Move Keyboard under input dialog makes sure it will no shift dialogs content --- .../qml/dialogs/TabletQueryDialog.qml | 39 ++++++++----------- 1 file changed, 16 insertions(+), 23 deletions(-) diff --git a/interface/resources/qml/dialogs/TabletQueryDialog.qml b/interface/resources/qml/dialogs/TabletQueryDialog.qml index 182cc12c9f..60dbc106dc 100644 --- a/interface/resources/qml/dialogs/TabletQueryDialog.qml +++ b/interface/resources/qml/dialogs/TabletQueryDialog.qml @@ -65,10 +65,7 @@ TabletModalWindow { id: modalWindowItem width: parent.width - 12 height: 240 - anchors { - verticalCenter: parent.verticalCenter - horizontalCenter: parent.horizontalCenter - } + anchors.horizontalCenter: parent.horizontalCenter QtObject { id: d @@ -81,18 +78,20 @@ TabletModalWindow { var targetWidth = Math.max(titleWidth, modalWindowItem.width) var targetHeight = (items ? comboBox.controlHeight : textResult.controlHeight) + 5 * hifi.dimensions.contentSpacing.y + buttons.height modalWindowItem.width = (targetWidth < d.minWidth) ? d.minWidth : ((targetWidth > d.maxWdith) ? d.maxWidth : targetWidth); - modalWindowItem.height = ((targetHeight < d.minHeight) ? d.minHeight : ((targetHeight > d.maxHeight) ? d.maxHeight : targetHeight)) + ((keyboardEnabled && keyboardRaised) ? (keyboard.raisedHeight + 2 * hifi.dimensions.contentSpacing.y) : 0) + modalWindowItem.frameMarginTop + modalWindowItem.height = ((targetHeight < d.minHeight) ? d.minHeight : ((targetHeight > d.maxHeight) ? d.maxHeight : targetHeight)) + modalWindowItem.frameMarginTop + modalWindowItem.y = (root.height - (modalWindowItem.height + ((keyboardEnabled && keyboardRaised) ? (keyboard.raisedHeight + 2 * hifi.dimensions.contentSpacing.y) : 0))) / 2 } } Item { anchors { top: parent.top - bottom: keyboard.top; + bottom: buttons.top; left: parent.left; right: parent.right; margins: 0 bottomMargin: 2 * hifi.dimensions.contentSpacing.y + topMargin: modalWindowItem.frameMarginTop } // FIXME make a text field type that can be bound to a history for autocompletion @@ -125,22 +124,6 @@ TabletModalWindow { } } - property alias keyboardOverride: root.keyboardOverride - property alias keyboardRaised: root.keyboardRaised - property alias punctuationMode: root.punctuationMode - - Keyboard { - id: keyboard - raised: keyboardEnabled && keyboardRaised - numeric: punctuationMode - anchors { - left: parent.left - right: parent.right - bottom: buttons.top - bottomMargin: raised ? 2 * hifi.dimensions.contentSpacing.y : 0 - } - } - Flow { id: buttons focus: true @@ -179,7 +162,17 @@ TabletModalWindow { } } - Keys.onPressed: { + Keyboard { + id: keyboard + raised: keyboardEnabled && keyboardRaised + numeric: punctuationMode + anchors { + left: parent.left + right: parent.right + top: modalWindowItem.bottom + } + } + Keys.onPressed: { if (!visible) { return } From 091dae730bcc9d11bcb03b9dc069ffb41bda7c39 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 15 Nov 2017 16:03:26 -0800 Subject: [PATCH 04/24] Add versioning to Asset Server --- assignment-client/src/assets/AssetServer.cpp | 135 ++++++++++++------ assignment-client/src/assets/AssetServer.h | 39 ++++- .../resources/web/settings/js/settings.js | 4 + libraries/baking/src/TextureBaker.cpp | 7 + libraries/baking/src/TextureBaker.h | 3 + 5 files changed, 140 insertions(+), 48 deletions(-) diff --git a/assignment-client/src/assets/AssetServer.cpp b/assignment-client/src/assets/AssetServer.cpp index 87827a27d9..cbddb2fe56 100644 --- a/assignment-client/src/assets/AssetServer.cpp +++ b/assignment-client/src/assets/AssetServer.cpp @@ -33,6 +33,10 @@ #include #include #include +void AssetServer::bakeAsset(const AssetUtils::AssetHash& assetHash, const AssetUtils::AssetPath& assetPath, const QString& filePath) { +void AssetServer::bakeAsset(const AssetUtils::AssetHash& assetHash, const AssetUtils::AssetPath& assetPath, const QString& filePath) { + +#include #include "AssetServerLogging.h" #include "BakeAssetTask.h" @@ -46,15 +50,75 @@ static const uint8_t CPU_AFFINITY_COUNT_LOW = 1; static const int INTERFACE_RUNNING_CHECK_FREQUENCY_MS = 1000; #endif -const QString ASSET_SERVER_LOGGING_TARGET_NAME = "asset-server"; - static const QStringList BAKEABLE_MODEL_EXTENSIONS = { "fbx" }; static QStringList BAKEABLE_TEXTURE_EXTENSIONS; static const QStringList BAKEABLE_SCRIPT_EXTENSIONS = {}; + static const QString BAKED_MODEL_SIMPLE_NAME = "asset.fbx"; static const QString BAKED_TEXTURE_SIMPLE_NAME = "texture.ktx"; static const QString BAKED_SCRIPT_SIMPLE_NAME = "asset.js"; +static const ModelBakeVersion CURRENT_MODEL_BAKE_VERSION = ModelBakeVersion::BetterModelBaking; +static const TextureBakeVersion CURRENT_TEXTURE_BAKE_VERSION = TextureBakeVersion::Initial; +static const ScriptBakeVersion CURRENT_SCRIPT_BAKE_VERSION = ScriptBakeVersion::Initial; + +BakedAssetType assetTypeForExtension(const QString& extension) { + auto extensionLower = extension.toLower(); + if (BAKEABLE_MODEL_EXTENSIONS.contains(extensionLower)) { + return Model; + } else if (BAKEABLE_TEXTURE_EXTENSIONS.contains(extensionLower.toLocal8Bit())) { + return Texture; + } else if (BAKEABLE_SCRIPT_EXTENSIONS.contains(extensionLower)) { + return Script; + } + return Undefined; +} + +BakedAssetType assetTypeForFilename(const QString& filename) { + auto dotIndex = filename.lastIndexOf("."); + if (dotIndex == -1) { + return BakedAssetType::Undefined; + } + + auto extension = filename.mid(dotIndex + 1); + return assetTypeForExtension(extension); +} + +QString bakedFilenameForAssetType(BakedAssetType type) { + switch (type) { + case Model: + return BAKED_MODEL_SIMPLE_NAME; + case Texture: + return BAKED_TEXTURE_SIMPLE_NAME; + case Script: + return BAKED_SCRIPT_SIMPLE_NAME; + default: + return ""; + } +} + +BakeVersion currentBakeVersionForAssetType(BakedAssetType type) { + switch (type) { + case Model: + return (BakeVersion)ModelBakeVersion::BetterModelBaking; + case Texture: + return (BakeVersion)TextureBakeVersion::Initial; + case Script: + return (BakeVersion)ScriptBakeVersion::FixEmptyScripts; + default: + return 0; + } +} + +QString toSlug(BakedAssetType type) { + switch (type) { + Model: return "model"; + Texture: return "texture"; + } +} + +const QString ASSET_SERVER_LOGGING_TARGET_NAME = "asset-server"; + void AssetServer::bakeAsset(const AssetUtils::AssetHash& assetHash, const AssetUtils::AssetPath& assetPath, const QString& filePath) { qDebug() << "Starting bake for: " << assetPath << assetHash; auto it = _pendingBakes.find(assetHash); @@ -167,36 +231,31 @@ bool AssetServer::needsToBeBaked(const AssetUtils::AssetPath& path, const AssetU return false; } - auto dotIndex = path.lastIndexOf("."); - if (dotIndex == -1) { + BakedAssetType type = assetTypeForFilename(path); + + if (type == Undefined) { return false; } - auto extension = path.mid(dotIndex + 1); - - QString bakedFilename; - bool loaded; AssetMeta meta; std::tie(loaded, meta) = readMetaFile(assetHash); - // TODO: Allow failed bakes that happened on old versions to be re-baked - if (loaded && meta.failedLastBake) { + if (type == Texture && !loaded) { return false; } - if (BAKEABLE_MODEL_EXTENSIONS.contains(extension)) { - bakedFilename = BAKED_MODEL_SIMPLE_NAME; - } else if (loaded && BAKEABLE_TEXTURE_EXTENSIONS.contains(extension.toLocal8Bit())) { - bakedFilename = BAKED_TEXTURE_SIMPLE_NAME; - } else if (BAKEABLE_SCRIPT_EXTENSIONS.contains(extension)) { - bakedFilename = BAKED_SCRIPT_SIMPLE_NAME; - } else { + auto currentVersion = currentBakeVersionForAssetType(type); + + if (loaded && (meta.failedLastBake && meta.bakeVersion >= currentVersion)) { return false; } + QString bakedFilename = bakedFilenameForAssetType(type); + auto bakedPath = HIDDEN_BAKED_CONTENT_FOLDER + assetHash + "/" + bakedFilename; auto bakedPath = AssetUtils::HIDDEN_BAKED_CONTENT_FOLDER + assetHash + "/" + bakedFilename; - return _fileMappings.find(bakedPath) == _fileMappings.end(); + bool bakedMappingExists = _fileMappings.find(bakedPath) == _fileMappings.end(); + return !bakedMappingExists || (meta.bakeVersion < currentVersion); } bool interfaceRunning() { @@ -598,15 +657,9 @@ void AssetServer::handleGetMappingOperation(ReceivedMessage& message, NLPacketLi // first, figure out from the mapping extension what type of file this is auto assetPathExtension = assetPath.mid(assetPath.lastIndexOf('.') + 1).toLower(); - QString bakedRootFile; - if (BAKEABLE_MODEL_EXTENSIONS.contains(assetPathExtension)) { - bakedRootFile = BAKED_MODEL_SIMPLE_NAME; - } else if (BAKEABLE_TEXTURE_EXTENSIONS.contains(assetPathExtension.toLocal8Bit())) { - bakedRootFile = BAKED_TEXTURE_SIMPLE_NAME; - } else if (BAKEABLE_SCRIPT_EXTENSIONS.contains(assetPathExtension)) { - bakedRootFile = BAKED_SCRIPT_SIMPLE_NAME; - } + auto type = assetTypeForFilename(assetPath); + QString bakedRootFile = bakedFilenameForAssetType(type); auto originalAssetHash = it->second; QString redirectedAssetHash; @@ -1284,6 +1337,7 @@ void AssetServer::handleFailedBake(QString originalAssetHash, QString assetPath, meta.failedLastBake = true; meta.lastBakeErrors = errors; + meta.bakeVersion = (BakeVersion)CURRENT_MODEL_BAKE_VERSION; writeMetaFile(originalAssetHash, meta); @@ -1381,6 +1435,7 @@ void AssetServer::handleCompletedBake(QString originalAssetHash, QString origina AssetMeta meta; meta.failedLastBake = true; meta.lastBakeErrors = errorReason; + meta.bakeVersion = (BakeVersion)ModelBakeVersion::BetterModelBaking; writeMetaFile(originalAssetHash, meta); } @@ -1447,7 +1502,7 @@ bool AssetServer::writeMetaFile(AssetUtils::AssetHash originalAssetHash, const A // construct the JSON that will be in the meta file QJsonObject metaFileObject; - metaFileObject[BAKE_VERSION_KEY] = meta.bakeVersion; + metaFileObject[BAKE_VERSION_KEY] = (int)meta.bakeVersion; metaFileObject[FAILED_LAST_BAKE_KEY] = meta.failedLastBake; metaFileObject[LAST_BAKE_ERRORS_KEY] = meta.lastBakeErrors; @@ -1479,27 +1534,13 @@ bool AssetServer::setBakingEnabled(const AssetUtils::AssetPathList& paths, bool for (const auto& path : paths) { auto it = _fileMappings.find(path); if (it != _fileMappings.end()) { + auto type = assetTypeForFilename(path); + if (type == Undefined) { + continue; + } + QString bakedFilename = bakedFilenameForAssetType(type); + auto hash = it->second; - - auto dotIndex = path.lastIndexOf("."); - if (dotIndex == -1) { - continue; - } - - auto extension = path.mid(dotIndex + 1); - - QString bakedFilename; - - if (BAKEABLE_MODEL_EXTENSIONS.contains(extension)) { - bakedFilename = BAKED_MODEL_SIMPLE_NAME; - } else if (BAKEABLE_TEXTURE_EXTENSIONS.contains(extension.toLocal8Bit()) && hasMetaFile(hash)) { - bakedFilename = BAKED_TEXTURE_SIMPLE_NAME; - } else if (BAKEABLE_SCRIPT_EXTENSIONS.contains(extension)) { - bakedFilename = BAKED_SCRIPT_SIMPLE_NAME; - } else { - continue; - } - auto bakedMapping = getBakeMapping(hash, bakedFilename); auto it = _fileMappings.find(bakedMapping); diff --git a/assignment-client/src/assets/AssetServer.h b/assignment-client/src/assets/AssetServer.h index 00ab27c74d..4d869b05f7 100644 --- a/assignment-client/src/assets/AssetServer.h +++ b/assignment-client/src/assets/AssetServer.h @@ -23,8 +23,45 @@ #include "RegisteredMetaTypes.h" +#include + +namespace std { + template <> + struct hash { + size_t operator()(const QString& v) const { return qHash(v); } + }; +} + +using BakeVersion = int; + +enum BakedAssetType : int { + Model = 0, + Texture, + Script, + + NUM_ASSET_TYPES, + Undefined +}; + +enum class ModelBakeVersion : BakeVersion { + Initial = 0, + BetterModelBaking, +}; + +enum class TextureBakeVersion : BakeVersion { + Initial = 0, +}; + +enum class ScriptBakeVersion : BakeVersion { + Initial = 0, + FixEmptyScripts = 1 +}; + struct AssetMeta { - int bakeVersion { 0 }; + AssetMeta() { + } + + BakeVersion bakeVersion; bool failedLastBake { false }; QString lastBakeErrors; }; diff --git a/domain-server/resources/web/settings/js/settings.js b/domain-server/resources/web/settings/js/settings.js index e67ea43158..0a675263ca 100644 --- a/domain-server/resources/web/settings/js/settings.js +++ b/domain-server/resources/web/settings/js/settings.js @@ -128,6 +128,10 @@ $(document).ready(function(){ createTemporaryDomain(); }); + $('#' + Settings.FORM_ID).on('change', 'select', function(){ + $("input[name='" + $(this).attr('data-hidden-input') + "']").val($(this).val()).change() + }); + $('#' + Settings.FORM_ID).on('click', '#' + Settings.DISCONNECT_ACCOUNT_BTN_ID, function(e){ $(this).blur(); disonnectHighFidelityAccount(); diff --git a/libraries/baking/src/TextureBaker.cpp b/libraries/baking/src/TextureBaker.cpp index b6edd07965..c10997462e 100644 --- a/libraries/baking/src/TextureBaker.cpp +++ b/libraries/baking/src/TextureBaker.cpp @@ -41,6 +41,13 @@ TextureBaker::TextureBaker(const QUrl& textureURL, image::TextureUsage::Type tex } } +TextureBaker::~TextureBaker() { + for (auto filepath : _temporaryFilesCreated) { + QFile f{filepath}; + f.remove(); + } +} + void TextureBaker::bake() { // once our texture is loaded, kick off a the processing connect(this, &TextureBaker::originalTextureLoaded, this, &TextureBaker::processTexture); diff --git a/libraries/baking/src/TextureBaker.h b/libraries/baking/src/TextureBaker.h index 90ecfe52f7..7d4d5c1f90 100644 --- a/libraries/baking/src/TextureBaker.h +++ b/libraries/baking/src/TextureBaker.h @@ -30,6 +30,7 @@ public: TextureBaker(const QUrl& textureURL, image::TextureUsage::Type textureType, const QDir& outputDirectory, const QString& bakedFilename = QString(), const QByteArray& textureContent = QByteArray()); + ~TextureBaker() override; const QByteArray& getOriginalTexture() const { return _originalTexture; } @@ -61,6 +62,8 @@ private: QDir _outputDirectory; QString _bakedTextureFileName; + std::vector _temporaryFilesCreated; + std::atomic _abortProcessing { false }; }; From 6ac8cdecd122b9465318e58fef7fe55319ac42b9 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Tue, 21 Nov 2017 15:13:05 -0800 Subject: [PATCH 05/24] Re-enable js baking --- assignment-client/src/assets/AssetServer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assignment-client/src/assets/AssetServer.cpp b/assignment-client/src/assets/AssetServer.cpp index cbddb2fe56..a9225fc200 100644 --- a/assignment-client/src/assets/AssetServer.cpp +++ b/assignment-client/src/assets/AssetServer.cpp @@ -52,7 +52,7 @@ static const int INTERFACE_RUNNING_CHECK_FREQUENCY_MS = 1000; static const QStringList BAKEABLE_MODEL_EXTENSIONS = { "fbx" }; static QStringList BAKEABLE_TEXTURE_EXTENSIONS; -static const QStringList BAKEABLE_SCRIPT_EXTENSIONS = {}; +static const QStringList BAKEABLE_SCRIPT_EXTENSIONS = { "js" }; static const QString BAKED_MODEL_SIMPLE_NAME = "asset.fbx"; static const QString BAKED_TEXTURE_SIMPLE_NAME = "texture.ktx"; From 6f3155db322dbfdac585e6214fb421277c988e4f Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Tue, 21 Nov 2017 16:54:07 -0800 Subject: [PATCH 06/24] Fix existing baked assets not being recognized --- assignment-client/src/assets/AssetServer.cpp | 85 +++++++++++++++----- assignment-client/src/assets/AssetServer.h | 11 +-- 2 files changed, 72 insertions(+), 24 deletions(-) diff --git a/assignment-client/src/assets/AssetServer.cpp b/assignment-client/src/assets/AssetServer.cpp index a9225fc200..a8e6ecddb7 100644 --- a/assignment-client/src/assets/AssetServer.cpp +++ b/assignment-client/src/assets/AssetServer.cpp @@ -100,7 +100,7 @@ QString bakedFilenameForAssetType(BakedAssetType type) { BakeVersion currentBakeVersionForAssetType(BakedAssetType type) { switch (type) { case Model: - return (BakeVersion)ModelBakeVersion::BetterModelBaking; + return (BakeVersion)ModelBakeVersion::Initial; case Texture: return (BakeVersion)TextureBakeVersion::Initial; case Script: @@ -110,12 +110,40 @@ BakeVersion currentBakeVersionForAssetType(BakedAssetType type) { } } -QString toSlug(BakedAssetType type) { - switch (type) { - Model: return "model"; - Texture: return "texture"; +struct BakedTypeInfo { + BakedAssetType type; + const char* slug; + BakeVersion currentVersion; + const char* bakedName; +}; + +constexpr std::array BAKED_TYPE_INFO { { + { + Model, + "model", + (BakeVersion)ModelBakeVersion::Initial, + "asset.fbx", + }, + { + Texture, + "texture", + (BakeVersion)TextureBakeVersion::Initial, + "texture.ktx", + }, + { + Script, + "script", + (BakeVersion)ScriptBakeVersion::FixEmptyScripts, + "asset.js", } -} +}}; + +static_assert(BAKED_TYPE_INFO[BakedAssetType::Model].type == BakedAssetType::Model, + "Model should be in correct index"); +static_assert(BAKED_TYPE_INFO[BakedAssetType::Texture].type == BakedAssetType::Texture, + "Texture should be in correct index"); +static_assert(BAKED_TYPE_INFO[BakedAssetType::Script].type == BakedAssetType::Script, + "Script should be in correct index"); const QString ASSET_SERVER_LOGGING_TARGET_NAME = "asset-server"; @@ -251,6 +279,10 @@ bool AssetServer::needsToBeBaked(const AssetUtils::AssetPath& path, const AssetU return false; } + if (meta.bakeVersion < currentVersion) { + return true; + } + QString bakedFilename = bakedFilenameForAssetType(type); auto bakedPath = HIDDEN_BAKED_CONTENT_FOLDER + assetHash + "/" + bakedFilename; auto bakedPath = AssetUtils::HIDDEN_BAKED_CONTENT_FOLDER + assetHash + "/" + bakedFilename; @@ -706,9 +738,19 @@ void AssetServer::handleGetMappingOperation(ReceivedMessage& message, NLPacketLi auto query = QUrlQuery(url.query()); bool isSkybox = query.hasQueryItem("skybox"); if (isSkybox) { - writeMetaFile(originalAssetHash); - if (!bakingDisabled) { - maybeBake(assetPath, originalAssetHash); + bool loaded; + AssetMeta meta; + std::tie(loaded, meta) = readMetaFile(originalAssetHash); + + if (!loaded) { + AssetMeta needsBakingMeta; + needsBakingMeta.bakeVersion = NEEDS_BAKING_BAKE_VERSION; + + writeMetaFile(originalAssetHash, needsBakingMeta); + if (!bakingDisabled) { + maybeBake(assetPath, originalAssetHash); + } + } } } @@ -1335,9 +1377,12 @@ void AssetServer::handleFailedBake(QString originalAssetHash, QString assetPath, std::tie(loaded, meta) = readMetaFile(originalAssetHash); + auto type = assetTypeForFilename(assetPath); + auto currentTypeVersion = currentBakeVersionForAssetType(type); + meta.failedLastBake = true; meta.lastBakeErrors = errors; - meta.bakeVersion = (BakeVersion)CURRENT_MODEL_BAKE_VERSION; + meta.bakeVersion = currentTypeVersion; writeMetaFile(originalAssetHash, meta); @@ -1427,18 +1472,20 @@ void AssetServer::handleCompletedBake(QString originalAssetHash, QString origina qWarning() << "Failed to remove temporary directory:" << bakedTempOutputDir; } - if (!errorCompletingBake) { - // create the meta file to store which version of the baking process we just completed - writeMetaFile(originalAssetHash); - } else { + auto type = assetTypeForFilename(originalAssetPath); + auto currentTypeVersion = currentBakeVersionForAssetType(type); + + AssetMeta meta; + meta.bakeVersion = currentTypeVersion; + meta.failedLastBake = errorCompletingBake; + + if (errorCompletingBake) { qWarning() << "Could not complete bake for" << originalAssetHash; - AssetMeta meta; - meta.failedLastBake = true; meta.lastBakeErrors = errorReason; - meta.bakeVersion = (BakeVersion)ModelBakeVersion::BetterModelBaking; - writeMetaFile(originalAssetHash, meta); } + writeMetaFile(originalAssetHash, meta); + _pendingBakes.remove(originalAssetHash); } @@ -1475,7 +1522,7 @@ std::pair AssetServer::readMetaFile(AssetUtils::AssetHash hash) if (error.error == QJsonParseError::NoError && doc.isObject()) { auto root = doc.object(); - auto bakeVersion = root[BAKE_VERSION_KEY].toInt(-1); + auto bakeVersion = root[BAKE_VERSION_KEY].toInt(INITIAL_BAKE_VERSION); auto failedLastBake = root[FAILED_LAST_BAKE_KEY]; auto lastBakeErrors = root[LAST_BAKE_ERRORS_KEY]; diff --git a/assignment-client/src/assets/AssetServer.h b/assignment-client/src/assets/AssetServer.h index 4d869b05f7..f9b876e7a4 100644 --- a/assignment-client/src/assets/AssetServer.h +++ b/assignment-client/src/assets/AssetServer.h @@ -33,6 +33,8 @@ namespace std { } using BakeVersion = int; +static const BakeVersion INITIAL_BAKE_VERSION = 0; +static const BakeVersion NEEDS_BAKING_BAKE_VERSION = -1; enum BakedAssetType : int { Model = 0, @@ -44,17 +46,16 @@ enum BakedAssetType : int { }; enum class ModelBakeVersion : BakeVersion { - Initial = 0, - BetterModelBaking, + Initial = INITIAL_BAKE_VERSION }; enum class TextureBakeVersion : BakeVersion { - Initial = 0, + Initial = INITIAL_BAKE_VERSION, }; enum class ScriptBakeVersion : BakeVersion { - Initial = 0, - FixEmptyScripts = 1 + Initial = INITIAL_BAKE_VERSION, + FixEmptyScripts, }; struct AssetMeta { From 8a89e8f9fb3db8d78ff3d706e922ef4262905bf8 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 22 Nov 2017 15:23:16 -0800 Subject: [PATCH 07/24] Remove BakedTypeInfo --- assignment-client/src/assets/AssetServer.cpp | 35 -------------------- 1 file changed, 35 deletions(-) diff --git a/assignment-client/src/assets/AssetServer.cpp b/assignment-client/src/assets/AssetServer.cpp index a8e6ecddb7..73f198c3d6 100644 --- a/assignment-client/src/assets/AssetServer.cpp +++ b/assignment-client/src/assets/AssetServer.cpp @@ -110,41 +110,6 @@ BakeVersion currentBakeVersionForAssetType(BakedAssetType type) { } } -struct BakedTypeInfo { - BakedAssetType type; - const char* slug; - BakeVersion currentVersion; - const char* bakedName; -}; - -constexpr std::array BAKED_TYPE_INFO { { - { - Model, - "model", - (BakeVersion)ModelBakeVersion::Initial, - "asset.fbx", - }, - { - Texture, - "texture", - (BakeVersion)TextureBakeVersion::Initial, - "texture.ktx", - }, - { - Script, - "script", - (BakeVersion)ScriptBakeVersion::FixEmptyScripts, - "asset.js", - } -}}; - -static_assert(BAKED_TYPE_INFO[BakedAssetType::Model].type == BakedAssetType::Model, - "Model should be in correct index"); -static_assert(BAKED_TYPE_INFO[BakedAssetType::Texture].type == BakedAssetType::Texture, - "Texture should be in correct index"); -static_assert(BAKED_TYPE_INFO[BakedAssetType::Script].type == BakedAssetType::Script, - "Script should be in correct index"); - const QString ASSET_SERVER_LOGGING_TARGET_NAME = "asset-server"; void AssetServer::bakeAsset(const AssetUtils::AssetHash& assetHash, const AssetUtils::AssetPath& assetPath, const QString& filePath) { From e38ef699cc7fe8d84b46bfc3b4c38a0c46466df9 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Mon, 27 Nov 2017 08:43:47 -0800 Subject: [PATCH 08/24] Remove BakingVersion.h --- assignment-client/src/assets/AssetServer.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/assignment-client/src/assets/AssetServer.cpp b/assignment-client/src/assets/AssetServer.cpp index 73f198c3d6..6a12984f01 100644 --- a/assignment-client/src/assets/AssetServer.cpp +++ b/assignment-client/src/assets/AssetServer.cpp @@ -36,8 +36,6 @@ void AssetServer::bakeAsset(const AssetUtils::AssetHash& assetHash, const AssetUtils::AssetPath& assetPath, const QString& filePath) { void AssetServer::bakeAsset(const AssetUtils::AssetHash& assetHash, const AssetUtils::AssetPath& assetPath, const QString& filePath) { -#include - #include "AssetServerLogging.h" #include "BakeAssetTask.h" #include "SendAssetTask.h" From 99c3e6cf783ee24615f9ae03b4e701390f709920 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Tue, 5 Dec 2017 16:19:13 -0800 Subject: [PATCH 09/24] Remove unused _temporaryFilesCreated from TextureBaker --- libraries/baking/src/TextureBaker.cpp | 7 ------- libraries/baking/src/TextureBaker.h | 3 --- 2 files changed, 10 deletions(-) diff --git a/libraries/baking/src/TextureBaker.cpp b/libraries/baking/src/TextureBaker.cpp index c10997462e..b6edd07965 100644 --- a/libraries/baking/src/TextureBaker.cpp +++ b/libraries/baking/src/TextureBaker.cpp @@ -41,13 +41,6 @@ TextureBaker::TextureBaker(const QUrl& textureURL, image::TextureUsage::Type tex } } -TextureBaker::~TextureBaker() { - for (auto filepath : _temporaryFilesCreated) { - QFile f{filepath}; - f.remove(); - } -} - void TextureBaker::bake() { // once our texture is loaded, kick off a the processing connect(this, &TextureBaker::originalTextureLoaded, this, &TextureBaker::processTexture); diff --git a/libraries/baking/src/TextureBaker.h b/libraries/baking/src/TextureBaker.h index 7d4d5c1f90..90ecfe52f7 100644 --- a/libraries/baking/src/TextureBaker.h +++ b/libraries/baking/src/TextureBaker.h @@ -30,7 +30,6 @@ public: TextureBaker(const QUrl& textureURL, image::TextureUsage::Type textureType, const QDir& outputDirectory, const QString& bakedFilename = QString(), const QByteArray& textureContent = QByteArray()); - ~TextureBaker() override; const QByteArray& getOriginalTexture() const { return _originalTexture; } @@ -62,8 +61,6 @@ private: QDir _outputDirectory; QString _bakedTextureFileName; - std::vector _temporaryFilesCreated; - std::atomic _abortProcessing { false }; }; From 0003a32701a3b25ccaf93e10d7f955c49fbe1b87 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 6 Dec 2017 14:04:44 -0800 Subject: [PATCH 10/24] Fix AssetServer not detecting missing bakeVersion --- assignment-client/src/assets/AssetServer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assignment-client/src/assets/AssetServer.cpp b/assignment-client/src/assets/AssetServer.cpp index 6a12984f01..a7a91800d1 100644 --- a/assignment-client/src/assets/AssetServer.cpp +++ b/assignment-client/src/assets/AssetServer.cpp @@ -1485,7 +1485,7 @@ std::pair AssetServer::readMetaFile(AssetUtils::AssetHash hash) if (error.error == QJsonParseError::NoError && doc.isObject()) { auto root = doc.object(); - auto bakeVersion = root[BAKE_VERSION_KEY].toInt(INITIAL_BAKE_VERSION); + auto bakeVersion = root[BAKE_VERSION_KEY].toInt(-1); auto failedLastBake = root[FAILED_LAST_BAKE_KEY]; auto lastBakeErrors = root[LAST_BAKE_ERRORS_KEY]; From 9a7497c9ec2176881e0c720903e80386f0ea28ab Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Fri, 8 Dec 2017 15:37:31 -0800 Subject: [PATCH 11/24] Update AssetServer to check for baking disabled on startup --- assignment-client/src/assets/AssetServer.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/assignment-client/src/assets/AssetServer.cpp b/assignment-client/src/assets/AssetServer.cpp index a7a91800d1..7b68057aa0 100644 --- a/assignment-client/src/assets/AssetServer.cpp +++ b/assignment-client/src/assets/AssetServer.cpp @@ -228,6 +228,17 @@ bool AssetServer::needsToBeBaked(const AssetUtils::AssetPath& path, const AssetU return false; } + QString bakedFilename = bakedFilenameForAssetType(type); + auto bakedPath = HIDDEN_BAKED_CONTENT_FOLDER + assetHash + "/" + bakedFilename; + auto mappingIt = _fileMappings.find(bakedPath); + bool bakedMappingExists = mappingIt != _fileMappings.end(); + + // If the path is mapped to the original file's hash, baking has been disabled for this + // asset + if (bakedMappingExists && mappingIt->second == assetHash) { + return false; + } + bool loaded; AssetMeta meta; std::tie(loaded, meta) = readMetaFile(assetHash); From df8a25cbdc02a1d99d757ec9b61d5afa12fe1562 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Fri, 8 Dec 2017 16:58:17 -0800 Subject: [PATCH 12/24] Add warning to AssetServer.h to update bake version in .cpp --- assignment-client/src/assets/AssetServer.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/assignment-client/src/assets/AssetServer.h b/assignment-client/src/assets/AssetServer.h index f9b876e7a4..55cad8ebd6 100644 --- a/assignment-client/src/assets/AssetServer.h +++ b/assignment-client/src/assets/AssetServer.h @@ -45,14 +45,18 @@ enum BakedAssetType : int { Undefined }; +// ATTENTION! If you change the current version for an asset type, you will also +// need to update the function currentBakeVersionForAssetType() inside of AssetServer.cpp. enum class ModelBakeVersion : BakeVersion { Initial = INITIAL_BAKE_VERSION }; +// ATTENTION! See above. enum class TextureBakeVersion : BakeVersion { Initial = INITIAL_BAKE_VERSION, }; +// ATTENTION! See above. enum class ScriptBakeVersion : BakeVersion { Initial = INITIAL_BAKE_VERSION, FixEmptyScripts, From 6ed89fb9cc23fe1da69f02048739c2c108954577 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Fri, 2 Mar 2018 11:41:44 -0800 Subject: [PATCH 13/24] Cleanup asset server versioning changes --- assignment-client/src/assets/AssetServer.cpp | 20 +++++++------------- assignment-client/src/assets/AssetServer.h | 17 +++++++---------- 2 files changed, 14 insertions(+), 23 deletions(-) diff --git a/assignment-client/src/assets/AssetServer.cpp b/assignment-client/src/assets/AssetServer.cpp index 7b68057aa0..9f2352d9f1 100644 --- a/assignment-client/src/assets/AssetServer.cpp +++ b/assignment-client/src/assets/AssetServer.cpp @@ -33,8 +33,6 @@ #include #include #include -void AssetServer::bakeAsset(const AssetUtils::AssetHash& assetHash, const AssetUtils::AssetPath& assetPath, const QString& filePath) { -void AssetServer::bakeAsset(const AssetUtils::AssetHash& assetHash, const AssetUtils::AssetPath& assetPath, const QString& filePath) { #include "AssetServerLogging.h" #include "BakeAssetTask.h" @@ -56,9 +54,9 @@ static const QString BAKED_MODEL_SIMPLE_NAME = "asset.fbx"; static const QString BAKED_TEXTURE_SIMPLE_NAME = "texture.ktx"; static const QString BAKED_SCRIPT_SIMPLE_NAME = "asset.js"; -static const ModelBakeVersion CURRENT_MODEL_BAKE_VERSION = ModelBakeVersion::BetterModelBaking; -static const TextureBakeVersion CURRENT_TEXTURE_BAKE_VERSION = TextureBakeVersion::Initial; -static const ScriptBakeVersion CURRENT_SCRIPT_BAKE_VERSION = ScriptBakeVersion::Initial; +static const ModelBakeVersion CURRENT_MODEL_BAKE_VERSION = (ModelBakeVersion)((BakeVersion)ModelBakeVersion::COUNT - 1); +static const TextureBakeVersion CURRENT_TEXTURE_BAKE_VERSION = (TextureBakeVersion)((BakeVersion)TextureBakeVersion::COUNT - 1); +static const ScriptBakeVersion CURRENT_SCRIPT_BAKE_VERSION = (ScriptBakeVersion)((BakeVersion)ScriptBakeVersion::COUNT - 1); BakedAssetType assetTypeForExtension(const QString& extension) { auto extensionLower = extension.toLower(); @@ -98,11 +96,11 @@ QString bakedFilenameForAssetType(BakedAssetType type) { BakeVersion currentBakeVersionForAssetType(BakedAssetType type) { switch (type) { case Model: - return (BakeVersion)ModelBakeVersion::Initial; + return (BakeVersion)CURRENT_MODEL_BAKE_VERSION; case Texture: - return (BakeVersion)TextureBakeVersion::Initial; + return (BakeVersion)CURRENT_TEXTURE_BAKE_VERSION; case Script: - return (BakeVersion)ScriptBakeVersion::FixEmptyScripts; + return (BakeVersion)CURRENT_SCRIPT_BAKE_VERSION; default: return 0; } @@ -229,7 +227,7 @@ bool AssetServer::needsToBeBaked(const AssetUtils::AssetPath& path, const AssetU } QString bakedFilename = bakedFilenameForAssetType(type); - auto bakedPath = HIDDEN_BAKED_CONTENT_FOLDER + assetHash + "/" + bakedFilename; + auto bakedPath = AssetUtils::HIDDEN_BAKED_CONTENT_FOLDER + assetHash + "/" + bakedFilename; auto mappingIt = _fileMappings.find(bakedPath); bool bakedMappingExists = mappingIt != _fileMappings.end(); @@ -257,10 +255,6 @@ bool AssetServer::needsToBeBaked(const AssetUtils::AssetPath& path, const AssetU return true; } - QString bakedFilename = bakedFilenameForAssetType(type); - auto bakedPath = HIDDEN_BAKED_CONTENT_FOLDER + assetHash + "/" + bakedFilename; - auto bakedPath = AssetUtils::HIDDEN_BAKED_CONTENT_FOLDER + assetHash + "/" + bakedFilename; - bool bakedMappingExists = _fileMappings.find(bakedPath) == _fileMappings.end(); return !bakedMappingExists || (meta.bakeVersion < currentVersion); } diff --git a/assignment-client/src/assets/AssetServer.h b/assignment-client/src/assets/AssetServer.h index 55cad8ebd6..a55a15e6fc 100644 --- a/assignment-client/src/assets/AssetServer.h +++ b/assignment-client/src/assets/AssetServer.h @@ -23,15 +23,6 @@ #include "RegisteredMetaTypes.h" -#include - -namespace std { - template <> - struct hash { - size_t operator()(const QString& v) const { return qHash(v); } - }; -} - using BakeVersion = int; static const BakeVersion INITIAL_BAKE_VERSION = 0; static const BakeVersion NEEDS_BAKING_BAKE_VERSION = -1; @@ -48,18 +39,24 @@ enum BakedAssetType : int { // ATTENTION! If you change the current version for an asset type, you will also // need to update the function currentBakeVersionForAssetType() inside of AssetServer.cpp. enum class ModelBakeVersion : BakeVersion { - Initial = INITIAL_BAKE_VERSION + Initial = INITIAL_BAKE_VERSION, + + COUNT }; // ATTENTION! See above. enum class TextureBakeVersion : BakeVersion { Initial = INITIAL_BAKE_VERSION, + + COUNT }; // ATTENTION! See above. enum class ScriptBakeVersion : BakeVersion { Initial = INITIAL_BAKE_VERSION, FixEmptyScripts, + + COUNT }; struct AssetMeta { From 5448099a9397212915451e52026094e3d3eb99bf Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Tue, 6 Mar 2018 09:10:41 -0800 Subject: [PATCH 14/24] Fix baker CLI not correctly exiting on failure We previusly were exiting while still inside of the QApplication ctor, before the event loop had been started. This fixes that by queueing up the baking to occur after the ctor has completed. --- tools/oven/src/BakerCLI.cpp | 1 + tools/oven/src/BakerCLI.h | 3 +++ tools/oven/src/OvenCLIApplication.cpp | 3 ++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/oven/src/BakerCLI.cpp b/tools/oven/src/BakerCLI.cpp index f5af5455fb..428b85f1cc 100644 --- a/tools/oven/src/BakerCLI.cpp +++ b/tools/oven/src/BakerCLI.cpp @@ -63,6 +63,7 @@ void BakerCLI::bakeFile(QUrl inputUrl, const QString& outputPath, const QString& } else { qCDebug(model_baking) << "Failed to determine baker type for file" << inputUrl; QCoreApplication::exit(OVEN_STATUS_CODE_FAIL); + return; } // invoke the bake method on the baker thread diff --git a/tools/oven/src/BakerCLI.h b/tools/oven/src/BakerCLI.h index 4f5b6607b0..bf33b625dd 100644 --- a/tools/oven/src/BakerCLI.h +++ b/tools/oven/src/BakerCLI.h @@ -14,6 +14,7 @@ #include #include +#include #include @@ -31,6 +32,8 @@ class BakerCLI : public QObject { public: BakerCLI(OvenCLIApplication* parent); + +public slots: void bakeFile(QUrl inputUrl, const QString& outputPath, const QString& type = QString::null); private slots: diff --git a/tools/oven/src/OvenCLIApplication.cpp b/tools/oven/src/OvenCLIApplication.cpp index 38d9963eeb..2fb8ea03f2 100644 --- a/tools/oven/src/OvenCLIApplication.cpp +++ b/tools/oven/src/OvenCLIApplication.cpp @@ -40,7 +40,8 @@ OvenCLIApplication::OvenCLIApplication(int argc, char* argv[]) : QUrl inputUrl(QDir::fromNativeSeparators(parser.value(CLI_INPUT_PARAMETER))); QUrl outputUrl(QDir::fromNativeSeparators(parser.value(CLI_OUTPUT_PARAMETER))); QString type = parser.isSet(CLI_TYPE_PARAMETER) ? parser.value(CLI_TYPE_PARAMETER) : QString::null; - cli->bakeFile(inputUrl, outputUrl.toString(), type); + QMetaObject::invokeMethod(cli, "bakeFile", Qt::QueuedConnection, Q_ARG(QUrl, inputUrl), + Q_ARG(QString, outputUrl.toString()), Q_ARG(QString, type)); } else { parser.showHelp(); QCoreApplication::quit(); From c555590e9b737a5f7a02cdfd6a64d3d36e9e2a05 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Tue, 6 Mar 2018 09:12:47 -0800 Subject: [PATCH 15/24] Enable support for baking JS files inside of the oven --- tools/oven/src/BakerCLI.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/oven/src/BakerCLI.cpp b/tools/oven/src/BakerCLI.cpp index 428b85f1cc..045034be2b 100644 --- a/tools/oven/src/BakerCLI.cpp +++ b/tools/oven/src/BakerCLI.cpp @@ -18,6 +18,7 @@ #include "ModelBakingLoggingCategory.h" #include "BakerCLI.h" #include "FBXBaker.h" +#include "JSBaker.h" #include "TextureBaker.h" BakerCLI::BakerCLI(OvenCLIApplication* parent) : QObject(parent) { @@ -34,6 +35,7 @@ void BakerCLI::bakeFile(QUrl inputUrl, const QString& outputPath, const QString& qDebug() << "Baking file type: " << type; static const QString MODEL_EXTENSION { "fbx" }; + static const QString SCRIPT_EXTENSION { "js" }; QString extension = type; @@ -44,6 +46,7 @@ void BakerCLI::bakeFile(QUrl inputUrl, const QString& outputPath, const QString& // check what kind of baker we should be creating bool isFBX = extension == MODEL_EXTENSION; + bool isScript = extension == SCRIPT_EXTENSION; bool isSupportedImage = QImageReader::supportedImageFormats().contains(extension.toLatin1()); @@ -57,6 +60,9 @@ void BakerCLI::bakeFile(QUrl inputUrl, const QString& outputPath, const QString& outputPath) }; _baker->moveToThread(Oven::instance().getNextWorkerThread()); + } else if (isScript) { + _baker = std::unique_ptr { new JSBaker(inputUrl, outputPath) }; + _baker->moveToThread(qApp->getNextWorkerThread()); } else if (isSupportedImage) { _baker = std::unique_ptr { new TextureBaker(inputUrl, image::TextureUsage::CUBE_TEXTURE, outputPath) }; _baker->moveToThread(Oven::instance().getNextWorkerThread()); From 0a00227ce3373463f46f8e0d0c53652140724865 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Tue, 6 Mar 2018 09:20:24 -0800 Subject: [PATCH 16/24] Update message for failed bakes inside of AssetServer.cpp --- assignment-client/src/assets/AssetServer.cpp | 2 +- tools/oven/src/BakerCLI.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/assignment-client/src/assets/AssetServer.cpp b/assignment-client/src/assets/AssetServer.cpp index 9f2352d9f1..0c2953774f 100644 --- a/assignment-client/src/assets/AssetServer.cpp +++ b/assignment-client/src/assets/AssetServer.cpp @@ -1338,7 +1338,7 @@ QString getBakeMapping(const AssetUtils::AssetHash& hash, const QString& relativ } void AssetServer::handleFailedBake(QString originalAssetHash, QString assetPath, QString errors) { - qDebug() << "Failed: " << originalAssetHash << assetPath << errors; + qDebug() << "Failed to bake: " << originalAssetHash << assetPath << "(" << errors << ")"; bool loaded; AssetMeta meta; diff --git a/tools/oven/src/BakerCLI.cpp b/tools/oven/src/BakerCLI.cpp index 045034be2b..35550cdca8 100644 --- a/tools/oven/src/BakerCLI.cpp +++ b/tools/oven/src/BakerCLI.cpp @@ -62,7 +62,7 @@ void BakerCLI::bakeFile(QUrl inputUrl, const QString& outputPath, const QString& _baker->moveToThread(Oven::instance().getNextWorkerThread()); } else if (isScript) { _baker = std::unique_ptr { new JSBaker(inputUrl, outputPath) }; - _baker->moveToThread(qApp->getNextWorkerThread()); + _baker->moveToThread(Oven::instance().getNextWorkerThread()); } else if (isSupportedImage) { _baker = std::unique_ptr { new TextureBaker(inputUrl, image::TextureUsage::CUBE_TEXTURE, outputPath) }; _baker->moveToThread(Oven::instance().getNextWorkerThread()); From 0fa73c73ce24c107d6dc519607e95930881f0386 Mon Sep 17 00:00:00 2001 From: SamGondelman Date: Thu, 15 Mar 2018 10:14:11 -0700 Subject: [PATCH 17/24] stats --- interface/resources/icons/+android/stats.svg | 16 +++++ interface/resources/qml/+android/StatText.qml | 9 +++ .../resources/qml/hifi/+android/StatsBar.qml | 71 +++++++++++++++++++ scripts/+android/defaultScripts.js | 3 +- scripts/system/+android/stats.js | 39 ++++++++++ 5 files changed, 137 insertions(+), 1 deletion(-) create mode 100644 interface/resources/icons/+android/stats.svg create mode 100644 interface/resources/qml/+android/StatText.qml create mode 100644 interface/resources/qml/hifi/+android/StatsBar.qml create mode 100644 scripts/system/+android/stats.js diff --git a/interface/resources/icons/+android/stats.svg b/interface/resources/icons/+android/stats.svg new file mode 100644 index 0000000000..f642650c66 --- /dev/null +++ b/interface/resources/icons/+android/stats.svg @@ -0,0 +1,16 @@ + + + + + + diff --git a/interface/resources/qml/+android/StatText.qml b/interface/resources/qml/+android/StatText.qml new file mode 100644 index 0000000000..5dc8377030 --- /dev/null +++ b/interface/resources/qml/+android/StatText.qml @@ -0,0 +1,9 @@ +import QtQuick 2.3 +import QtQuick.Controls 1.2 + +Text { + color: "white"; + style: Text.Outline; + styleColor: "black"; + font.pixelSize: 15; +} diff --git a/interface/resources/qml/hifi/+android/StatsBar.qml b/interface/resources/qml/hifi/+android/StatsBar.qml new file mode 100644 index 0000000000..aee438b44f --- /dev/null +++ b/interface/resources/qml/hifi/+android/StatsBar.qml @@ -0,0 +1,71 @@ +import QtQuick 2.5 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 +import QtQuick.Layouts 1.3 +import Qt.labs.settings 1.0 +import "../../styles-uit" +import "../../controls-uit" as HifiControlsUit +import "../../controls" as HifiControls +import ".." + +Item { + id: bar + x:300 + y:0 + width: 300 + height: 300 + z: -1 + + signal sendToScript(var message); + signal windowClosed(); + + property bool shown: true + + onShownChanged: { + bar.visible = shown; + } + + Rectangle { + anchors.fill : parent + color: "transparent" + Flow { + id: flowMain + spacing: 10 + flow: Flow.TopToBottom + layoutDirection: Flow.TopToBottom + anchors.fill: parent + anchors.margins: 4 + } + } + + Component.onCompleted: { + // put on bottom + x = 300; + y = 0; + width = 300; + height = 300; + } + + function addButton(properties) { + var component = Qt.createComponent("button.qml"); + if (component.status == Component.Ready) { + var button = component.createObject(flowMain); + // copy all properites to button + var keys = Object.keys(properties).forEach(function (key) { + button[key] = properties[key]; + }); + return button; + } else if( component.status == Component.Error) { + console.log("Load button errors " + component.errorString()); + } + } + + function urlHelper(src) { + if (src.match(/\bhttp/)) { + return src; + } else { + return "../../../" + src; + } + } + +} diff --git a/scripts/+android/defaultScripts.js b/scripts/+android/defaultScripts.js index a8f6bf42a1..11aee6a9d2 100644 --- a/scripts/+android/defaultScripts.js +++ b/scripts/+android/defaultScripts.js @@ -16,7 +16,8 @@ var DEFAULT_SCRIPTS_COMBINED = [ "system/+android/touchscreenvirtualpad.js", "system/+android/bottombar.js", "system/+android/audio.js" , - "system/+android/modes.js"/*, + "system/+android/modes.js", + "system/+android/stats.js"/*, "system/away.js", "system/controllers/controllerDisplayManager.js", "system/controllers/handControllerGrabAndroid.js", diff --git a/scripts/system/+android/stats.js b/scripts/system/+android/stats.js new file mode 100644 index 0000000000..a93bcb5794 --- /dev/null +++ b/scripts/system/+android/stats.js @@ -0,0 +1,39 @@ +"use strict"; +// +// stats.js +// scripts/system/ +// +// Created by Sam Gondelman on 3/14/18 +// Copyright 2018 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 +// + +(function() { // BEGIN LOCAL_SCOPE + +var statsbar; +var statsButton; + +function init() { + statsbar = new QmlFragment({ + qml: "hifi/StatsBar.qml" + }); + + statsButton = statsbar.addButton({ + icon: "icons/stats.svg", + activeIcon: "icons/stats.svg", + textSize: 45, + bgOpacity: 0.0, + activeBgOpacity: 0.0, + bgColor: "#FFFFFF", + text: "STATS" + }); + statsButton.clicked.connect(function() { + Menu.triggerOption("Stats"); + }); +} + +init(); + +}()); // END LOCAL_SCOPE From 06c0b3afd3e9c324e6e9fc4858dfb1adfdc6d46d Mon Sep 17 00:00:00 2001 From: SamGondelman Date: Fri, 16 Mar 2018 16:52:12 -0700 Subject: [PATCH 18/24] disable IK on android, input recorder doesn't do anything if off --- .../animation/src/AnimInverseKinematics.cpp | 5 ++ .../src/controllers/UserInputMapper.cpp | 62 +++++++++++-------- .../impl/endpoints/ActionEndpoint.cpp | 19 +++--- 3 files changed, 52 insertions(+), 34 deletions(-) diff --git a/libraries/animation/src/AnimInverseKinematics.cpp b/libraries/animation/src/AnimInverseKinematics.cpp index 849ea5ee6b..dc004fe60d 100644 --- a/libraries/animation/src/AnimInverseKinematics.cpp +++ b/libraries/animation/src/AnimInverseKinematics.cpp @@ -882,6 +882,11 @@ const AnimPoseVec& AnimInverseKinematics::evaluate(const AnimVariantMap& animVar //virtual const AnimPoseVec& AnimInverseKinematics::overlay(const AnimVariantMap& animVars, const AnimContext& context, float dt, Triggers& triggersOut, const AnimPoseVec& underPoses) { +#ifdef Q_OS_ANDROID + // disable IK on android + return underPoses; +#endif + // allows solutionSource to be overridden by an animVar auto solutionSource = animVars.lookup(_solutionSourceVar, (int)_solutionSource); diff --git a/libraries/controllers/src/controllers/UserInputMapper.cpp b/libraries/controllers/src/controllers/UserInputMapper.cpp index 29f011fba2..371deec7d5 100755 --- a/libraries/controllers/src/controllers/UserInputMapper.cpp +++ b/libraries/controllers/src/controllers/UserInputMapper.cpp @@ -73,7 +73,8 @@ void UserInputMapper::registerDevice(InputDevice::Pointer device) { qCDebug(controllers) << "Registered input device <" << device->getName() << "> deviceID = " << deviceID; - for (const auto& inputMapping : device->getAvailableInputs()) { + auto inputs = device->getAvailableInputs(); + for (const auto& inputMapping : inputs) { const auto& input = inputMapping.first; // Ignore aliases if (_endpointsByInput.count(input)) { @@ -126,7 +127,8 @@ void UserInputMapper::removeDevice(int deviceID) { _mappingsByDevice.erase(mappingsEntry); } - for (const auto& inputMapping : device->getAvailableInputs()) { + auto inputs = device->getAvailableInputs(); + for (const auto& inputMapping : inputs) { const auto& input = inputMapping.first; auto endpoint = _endpointsByInput.find(input); if (endpoint != _endpointsByInput.end()) { @@ -171,7 +173,7 @@ InputDevice::Pointer UserInputMapper::getDevice(const Input& input) { } } -QString UserInputMapper::getDeviceName(uint16 deviceID) { +QString UserInputMapper::getDeviceName(uint16 deviceID) { Locker locker(_lock); if (_registeredDevices.find(deviceID) != _registeredDevices.end()) { return _registeredDevices[deviceID]->_name; @@ -181,7 +183,7 @@ QString UserInputMapper::getDeviceName(uint16 deviceID) { int UserInputMapper::findDevice(QString name) const { Locker locker(_lock); - for (auto device : _registeredDevices) { + for (const auto& device : _registeredDevices) { if (device.second->_name == name) { return device.first; } @@ -192,7 +194,7 @@ int UserInputMapper::findDevice(QString name) const { QVector UserInputMapper::getDeviceNames() { Locker locker(_lock); QVector result; - for (auto device : _registeredDevices) { + for (const auto& device : _registeredDevices) { QString deviceName = device.second->_name.split(" (")[0]; result << deviceName; } @@ -218,7 +220,7 @@ Input UserInputMapper::findDeviceInput(const QString& inputName) const { const auto& device = _registeredDevices.at(deviceID); auto deviceInputs = device->getAvailableInputs(); - for (auto input : deviceInputs) { + for (const auto& input : deviceInputs) { if (input.second == inputName) { return input.first; } @@ -321,7 +323,8 @@ QVector UserInputMapper::getAllActions() const { QString UserInputMapper::getActionName(Action action) const { Locker locker(_lock); - for (auto actionPair : getActionInputs()) { + auto inputs = getActionInputs(); + for (const auto& actionPair : inputs) { if (actionPair.first.channel == toInt(action)) { return actionPair.second; } @@ -331,18 +334,20 @@ QString UserInputMapper::getActionName(Action action) const { QString UserInputMapper::getStandardPoseName(uint16_t pose) { Locker locker(_lock); - for (auto posePair : getStandardInputs()) { + auto inputs = getStandardInputs(); + for (const auto& posePair : inputs) { if (posePair.first.channel == pose && posePair.first.getType() == ChannelType::POSE) { return posePair.second; } } return QString(); -} +} QVector UserInputMapper::getActionNames() const { Locker locker(_lock); QVector result; - for (auto actionPair : getActionInputs()) { + auto inputs = getActionInputs(); + for (const auto& actionPair : inputs) { result << actionPair.second; } return result; @@ -357,7 +362,7 @@ Pose UserInputMapper::getPoseState(Action action) const { bool UserInputMapper::triggerHapticPulse(float strength, float duration, controller::Hand hand) { Locker locker(_lock); bool toReturn = false; - for (auto device : _registeredDevices) { + for (const auto& device : _registeredDevices) { toReturn = toReturn || device.second->triggerHapticPulse(strength, duration, hand); } return toReturn; @@ -469,7 +474,7 @@ void UserInputMapper::runMappings() { if (debugRoutes) { qCDebug(controllers) << "Beginning mapping frame"; } - for (auto endpointEntry : this->_endpointsByInput) { + for (const auto& endpointEntry : _endpointsByInput) { endpointEntry.second->reset(); } @@ -542,9 +547,9 @@ bool UserInputMapper::applyRoute(const Route::Pointer& route, bool force) { } - // Most endpoints can only be read once (though a given mapping can route them to + // Most endpoints can only be read once (though a given mapping can route them to // multiple places). Consider... If the default is to wire the A button to JUMP - // and someone else wires it to CONTEXT_MENU, I don't want both to occur when + // and someone else wires it to CONTEXT_MENU, I don't want both to occur when // I press the button. The exception is if I'm wiring a control back to itself // in order to adjust my interface, like inverting the Y axis on an analog stick if (!route->peek && !source->readable()) { @@ -897,7 +902,8 @@ Conditional::Pointer UserInputMapper::parseConditional(const QJsonValue& value) if (value.isArray()) { // Support "when" : [ "GamePad.RB", "GamePad.LB" ] Conditional::List children; - for (auto arrayItem : value.toArray()) { + auto array = value.toArray(); + for (const auto& arrayItem : array) { Conditional::Pointer childConditional = parseConditional(arrayItem); if (!childConditional) { return Conditional::Pointer(); @@ -908,7 +914,7 @@ Conditional::Pointer UserInputMapper::parseConditional(const QJsonValue& value) } else if (value.isString()) { // Support "when" : "GamePad.RB" auto conditionalToken = value.toString(); - + // Detect for modifier case (Not...) QString conditionalModifier; const QString JSON_CONDITIONAL_MODIFIER_NOT("!"); @@ -943,12 +949,12 @@ Filter::Pointer UserInputMapper::parseFilter(const QJsonValue& value) { result = Filter::getFactory().create(value.toString()); } else if (value.isObject()) { result = Filter::parse(value.toObject()); - } + } if (!result) { qWarning() << "Invalid filter definition " << value; } - + return result; } @@ -960,7 +966,7 @@ Filter::List UserInputMapper::parseFilters(const QJsonValue& value) { if (value.isArray()) { Filter::List result; auto filtersArray = value.toArray(); - for (auto filterValue : filtersArray) { + for (const auto& filterValue : filtersArray) { Filter::Pointer filter = parseFilter(filterValue); if (!filter) { return Filter::List(); @@ -968,7 +974,7 @@ Filter::List UserInputMapper::parseFilters(const QJsonValue& value) { result.push_back(filter); } return result; - } + } Filter::Pointer filter = parseFilter(value); if (!filter) { @@ -980,7 +986,8 @@ Filter::List UserInputMapper::parseFilters(const QJsonValue& value) { Endpoint::Pointer UserInputMapper::parseDestination(const QJsonValue& value) { if (value.isArray()) { ArrayEndpoint::Pointer result = std::make_shared(); - for (auto arrayItem : value.toArray()) { + auto array = value.toArray(); + for (const auto& arrayItem : array) { Endpoint::Pointer destination = parseEndpoint(arrayItem); if (!destination) { return Endpoint::Pointer(); @@ -988,14 +995,14 @@ Endpoint::Pointer UserInputMapper::parseDestination(const QJsonValue& value) { result->_children.push_back(destination); } return result; - } - + } + return parseEndpoint(value); } Endpoint::Pointer UserInputMapper::parseAxis(const QJsonValue& value) { if (value.isObject()) { - auto object = value.toObject(); + auto object = value.toObject(); if (object.contains("makeAxis")) { auto axisValue = object.value("makeAxis"); if (axisValue.isArray()) { @@ -1017,7 +1024,8 @@ Endpoint::Pointer UserInputMapper::parseAxis(const QJsonValue& value) { Endpoint::Pointer UserInputMapper::parseAny(const QJsonValue& value) { if (value.isArray()) { Endpoint::List children; - for (auto arrayItem : value.toArray()) { + auto array = value.toArray(); + for (const auto& arrayItem : array) { Endpoint::Pointer destination = parseEndpoint(arrayItem); if (!destination) { return Endpoint::Pointer(); @@ -1162,7 +1170,7 @@ Mapping::Pointer UserInputMapper::parseMapping(const QString& json) { template bool hasDebuggableRoute(const T& routes) { - for (auto route : routes) { + for (const auto& route : routes) { if (route->debug) { return true; } @@ -1174,7 +1182,7 @@ bool hasDebuggableRoute(const T& routes) { void UserInputMapper::enableMapping(const Mapping::Pointer& mapping) { Locker locker(_lock); // New routes for a device get injected IN FRONT of existing routes. Routes - // are processed in order so this ensures that the standard -> action processing + // are processed in order so this ensures that the standard -> action processing // takes place after all of the hardware -> standard or hardware -> action processing // because standard -> action is the first set of routes added. Route::List standardRoutes = mapping->routes; diff --git a/libraries/controllers/src/controllers/impl/endpoints/ActionEndpoint.cpp b/libraries/controllers/src/controllers/impl/endpoints/ActionEndpoint.cpp index ef9f04402b..f73268b41f 100644 --- a/libraries/controllers/src/controllers/impl/endpoints/ActionEndpoint.cpp +++ b/libraries/controllers/src/controllers/impl/endpoints/ActionEndpoint.cpp @@ -16,11 +16,14 @@ using namespace controller; void ActionEndpoint::apply(float newValue, const Pointer& source) { - InputRecorder* inputRecorder = InputRecorder::getInstance(); auto userInputMapper = DependencyManager::get(); - QString actionName = userInputMapper->getActionName(Action(_input.getChannel())); - if(inputRecorder->isPlayingback()) { - newValue = inputRecorder->getActionState(actionName); + InputRecorder* inputRecorder = InputRecorder::getInstance(); + QString actionName; + if (inputRecorder->isPlayingback() || inputRecorder->isRecording()) { + actionName = userInputMapper->getActionName(Action(_input.getChannel())); + if (inputRecorder->isPlayingback()) { + newValue = inputRecorder->getActionState(actionName); + } } _currentValue += newValue; @@ -32,10 +35,12 @@ void ActionEndpoint::apply(float newValue, const Pointer& source) { void ActionEndpoint::apply(const Pose& value, const Pointer& source) { _currentPose = value; - InputRecorder* inputRecorder = InputRecorder::getInstance(); auto userInputMapper = DependencyManager::get(); - QString actionName = userInputMapper->getActionName(Action(_input.getChannel())); - inputRecorder->setActionState(actionName, _currentPose); + InputRecorder* inputRecorder = InputRecorder::getInstance(); + if (inputRecorder->isRecording()) { + QString actionName = userInputMapper->getActionName(Action(_input.getChannel())); + inputRecorder->setActionState(actionName, _currentPose); + } if (!_currentPose.isValid()) { return; From 4b52c21d1cb24e4e8ecda3d2eb30c42f1553989c Mon Sep 17 00:00:00 2001 From: David Rowe Date: Tue, 20 Mar 2018 09:51:10 +1300 Subject: [PATCH 19/24] JSDoc that an entity's clientOnly property can be set at entity creation --- libraries/entities/src/EntityItemProperties.cpp | 7 +++++-- libraries/entities/src/EntityScriptingInterface.h | 6 +++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp index d348101b66..a6eea8c892 100644 --- a/libraries/entities/src/EntityItemProperties.cpp +++ b/libraries/entities/src/EntityItemProperties.cpp @@ -451,8 +451,11 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const { * @property {Entities.EntityType} type - The entity type. You cannot change the type of an entity after it's created. (Though * its value may switch among "Box", "Shape", and "Sphere" depending on changes to * the shape property set for entities of these types.) Read-only. - * @property {boolean} clientOnly=false - If true then the entity is an avatar entity, otherwise it is a server - * entity. Read-only. + * @property {boolean} clientOnly=false - If true then the entity is an avatar entity; otherwise it is a server + * entity. An avatar entity follows you to each domain you visit, rendering at the same world coordinates unless it's + * parented to your avatar. Value cannot be changed after the entity is created.
+ * The value can also be set at entity creation by using the clientOnly parameter in + * {@link Entities.addEntity}. * @property {Uuid} owningAvatarID=Uuid.NULL - The session ID of the owning avatar if clientOnly is * true, otherwise {@link Uuid|Uuid.NULL}. Read-only. * diff --git a/libraries/entities/src/EntityScriptingInterface.h b/libraries/entities/src/EntityScriptingInterface.h index b483225390..9613a7a310 100644 --- a/libraries/entities/src/EntityScriptingInterface.h +++ b/libraries/entities/src/EntityScriptingInterface.h @@ -203,9 +203,9 @@ public slots: * Add a new entity with specified properties. * @function Entities.addEntity * @param {Entities.EntityProperties} properties - The properties of the entity to create. - * @param {boolean} [clientOnly=false] - If true, the entity is created as an avatar entity, otherwise it - * is created on the server. An avatar entity follows you to each domain you visit, rendering at the same world - * coordinates unless it's parented to your avatar. + * @param {boolean} [clientOnly=false] - If true, or if clientOnly is set true in + * the properties, the entity is created as an avatar entity; otherwise it is created on the server. An avatar entity + * follows you to each domain you visit, rendering at the same world coordinates unless it's parented to your avatar. * @returns {Uuid} The ID of the entity if successfully created, otherwise {@link Uuid|Uuid.NULL}. * @example Create a box entity in front of your avatar. * var entityID = Entities.addEntity({ From 541d798a6be1ad242b6088f4d93580d9423dc9ad Mon Sep 17 00:00:00 2001 From: David Rowe Date: Tue, 20 Mar 2018 09:53:57 +1300 Subject: [PATCH 20/24] Update code comment --- libraries/entities/src/EntityItemProperties.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp index a6eea8c892..7bf9a21c60 100644 --- a/libraries/entities/src/EntityItemProperties.cpp +++ b/libraries/entities/src/EntityItemProperties.cpp @@ -1416,7 +1416,7 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LOCAL_ANGULAR_VELOCITY, localAngularVelocity); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LOCAL_DIMENSIONS, localDimensions); - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_CLIENT_ONLY, clientOnly); // Gettable but not settable + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_CLIENT_ONLY, clientOnly); // Gettable but not settable except at entity creation COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_OWNING_AVATAR_ID, owningAvatarID); // Gettable but not settable // Rendering info From 42324d79f1b5d7f52d2e3feedb7ff42e334e02bc Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 21 Mar 2018 12:15:54 -0700 Subject: [PATCH 21/24] Remove unused DS settings.js change --- domain-server/resources/web/settings/js/settings.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/domain-server/resources/web/settings/js/settings.js b/domain-server/resources/web/settings/js/settings.js index 0a675263ca..e67ea43158 100644 --- a/domain-server/resources/web/settings/js/settings.js +++ b/domain-server/resources/web/settings/js/settings.js @@ -128,10 +128,6 @@ $(document).ready(function(){ createTemporaryDomain(); }); - $('#' + Settings.FORM_ID).on('change', 'select', function(){ - $("input[name='" + $(this).attr('data-hidden-input') + "']").val($(this).val()).change() - }); - $('#' + Settings.FORM_ID).on('click', '#' + Settings.DISCONNECT_ACCOUNT_BTN_ID, function(e){ $(this).blur(); disonnectHighFidelityAccount(); From 655636c44f23d53e2b4e175440417382b7676201 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 21 Mar 2018 12:16:12 -0700 Subject: [PATCH 22/24] Remove redundant if block in AssetServer.cpp --- assignment-client/src/assets/AssetServer.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/assignment-client/src/assets/AssetServer.cpp b/assignment-client/src/assets/AssetServer.cpp index 0c2953774f..e1fb7e4d49 100644 --- a/assignment-client/src/assets/AssetServer.cpp +++ b/assignment-client/src/assets/AssetServer.cpp @@ -251,10 +251,6 @@ bool AssetServer::needsToBeBaked(const AssetUtils::AssetPath& path, const AssetU return false; } - if (meta.bakeVersion < currentVersion) { - return true; - } - return !bakedMappingExists || (meta.bakeVersion < currentVersion); } From d2ae30f8e052c7e334fb53b16465657a717e7279 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Thu, 22 Mar 2018 16:22:59 -0700 Subject: [PATCH 23/24] Disable support for baking scripts in the Asset Server --- assignment-client/src/assets/AssetServer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assignment-client/src/assets/AssetServer.cpp b/assignment-client/src/assets/AssetServer.cpp index e1fb7e4d49..1eb43a45a5 100644 --- a/assignment-client/src/assets/AssetServer.cpp +++ b/assignment-client/src/assets/AssetServer.cpp @@ -48,7 +48,7 @@ static const int INTERFACE_RUNNING_CHECK_FREQUENCY_MS = 1000; static const QStringList BAKEABLE_MODEL_EXTENSIONS = { "fbx" }; static QStringList BAKEABLE_TEXTURE_EXTENSIONS; -static const QStringList BAKEABLE_SCRIPT_EXTENSIONS = { "js" }; +static const QStringList BAKEABLE_SCRIPT_EXTENSIONS = { }; static const QString BAKED_MODEL_SIMPLE_NAME = "asset.fbx"; static const QString BAKED_TEXTURE_SIMPLE_NAME = "texture.ktx"; From a19f71e759b41e809e77abd0aaa2cc1c79868ad8 Mon Sep 17 00:00:00 2001 From: SamGondelman Date: Fri, 23 Mar 2018 14:16:47 -0700 Subject: [PATCH 24/24] fix tonemapping on android --- .../src/display-plugins/OpenGLDisplayPlugin.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libraries/display-plugins/src/display-plugins/OpenGLDisplayPlugin.cpp b/libraries/display-plugins/src/display-plugins/OpenGLDisplayPlugin.cpp index 9597be7e53..4b33565bfd 100644 --- a/libraries/display-plugins/src/display-plugins/OpenGLDisplayPlugin.cpp +++ b/libraries/display-plugins/src/display-plugins/OpenGLDisplayPlugin.cpp @@ -530,7 +530,11 @@ void OpenGLDisplayPlugin::renderFromTexture(gpu::Batch& batch, const gpu::Textur batch.setStateScissorRect(scissor); batch.setViewportTransform(viewport); batch.setResourceTexture(0, texture); +#ifndef USE_GLES batch.setPipeline(_presentPipeline); +#else + batch.setPipeline(_simplePipeline); +#endif batch.draw(gpu::TRIANGLE_STRIP, 4); if (copyFbo) { gpu::Vec4i copyFboRect(0, 0, copyFbo->getWidth(), copyFbo->getHeight());