From 657f8fdad56d5241c0d24c1219192358fae28cf1 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Wed, 15 Jun 2016 14:12:49 +1200 Subject: [PATCH 1/6] Fix reporting of JSON export failure --- interface/src/Application.cpp | 2 +- libraries/octree/src/Octree.cpp | 30 ++++++++++++++++++--------- libraries/octree/src/Octree.h | 6 +++--- libraries/ui/src/FileDialogHelper.cpp | 2 ++ 4 files changed, 26 insertions(+), 14 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 49c2e17d84..7a74258916 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -2916,7 +2916,7 @@ bool Application::exportEntities(const QString& filename, const QVectorwriteToJSONFile(filename.toLocal8Bit().constData()); + success = exportTree->writeToJSONFile(filename.toLocal8Bit().constData()); // restore the main window's active state _window->activateWindow(); diff --git a/libraries/octree/src/Octree.cpp b/libraries/octree/src/Octree.cpp index 475beef03c..d8c8229ce3 100644 --- a/libraries/octree/src/Octree.cpp +++ b/libraries/octree/src/Octree.cpp @@ -1868,24 +1868,26 @@ bool Octree::readJSONFromStream(unsigned long streamLength, QDataStream& inputSt return success; } -void Octree::writeToFile(const char* fileName, OctreeElementPointer element, QString persistAsFileType) { +bool Octree::writeToFile(const char* fileName, OctreeElementPointer element, QString persistAsFileType) { // make the sure file extension makes sense QString qFileName = fileNameWithoutExtension(QString(fileName), PERSIST_EXTENSIONS) + "." + persistAsFileType; QByteArray byteArray = qFileName.toUtf8(); const char* cFileName = byteArray.constData(); + bool success = false; if (persistAsFileType == "svo") { - writeToSVOFile(fileName, element); + success = writeToSVOFile(fileName, element); } else if (persistAsFileType == "json") { - writeToJSONFile(cFileName, element); + success = writeToJSONFile(cFileName, element); } else if (persistAsFileType == "json.gz") { - writeToJSONFile(cFileName, element, true); + success = writeToJSONFile(cFileName, element, true); } else { qCDebug(octree) << "unable to write octree to file of type" << persistAsFileType; } + return success; } -void Octree::writeToJSONFile(const char* fileName, OctreeElementPointer element, bool doGzip) { +bool Octree::writeToJSONFile(const char* fileName, OctreeElementPointer element, bool doGzip) { QVariantMap entityDescription; qCDebug(octree, "Saving JSON SVO to file %s...", fileName); @@ -1906,7 +1908,7 @@ void Octree::writeToJSONFile(const char* fileName, OctreeElementPointer element, bool entityDescriptionSuccess = writeToMap(entityDescription, top, true, true); if (!entityDescriptionSuccess) { qCritical("Failed to convert Entities to QVariantMap while saving to json."); - return; + return false; } // convert the QVariantMap to JSON @@ -1916,22 +1918,26 @@ void Octree::writeToJSONFile(const char* fileName, OctreeElementPointer element, if (doGzip) { if (!gzip(jsonData, jsonDataForFile, -1)) { qCritical("unable to gzip data while saving to json."); - return; + return false; } } else { jsonDataForFile = jsonData; } QFile persistFile(fileName); + bool success = false; if (persistFile.open(QIODevice::WriteOnly)) { - persistFile.write(jsonDataForFile); + success = persistFile.write(jsonDataForFile) != -1; } else { qCritical("Could not write to JSON description of entities."); } + + return success; } -void Octree::writeToSVOFile(const char* fileName, OctreeElementPointer element) { - qWarning() << "SVO file format depricated. Support for reading SVO files is no longer support and will be removed soon."; +bool Octree::writeToSVOFile(const char* fileName, OctreeElementPointer element) { + qWarning() << "SVO file format deprecated. Support for reading SVO files is no longer support and will be removed soon."; + bool success = false; std::ofstream file(fileName, std::ios::out|std::ios::binary); @@ -2010,8 +2016,12 @@ void Octree::writeToSVOFile(const char* fileName, OctreeElementPointer element) } releaseSceneEncodeData(&extraEncodeData); + + success = true; } file.close(); + + return success; } unsigned long Octree::getOctreeElementsCount() { diff --git a/libraries/octree/src/Octree.h b/libraries/octree/src/Octree.h index 2f0ce3b807..6894f0aa1a 100644 --- a/libraries/octree/src/Octree.h +++ b/libraries/octree/src/Octree.h @@ -299,9 +299,9 @@ public: void loadOctreeFile(const char* fileName); // Octree exporters - void writeToFile(const char* filename, OctreeElementPointer element = NULL, QString persistAsFileType = "svo"); - void writeToJSONFile(const char* filename, OctreeElementPointer element = NULL, bool doGzip = false); - void writeToSVOFile(const char* filename, OctreeElementPointer element = NULL); + bool writeToFile(const char* filename, OctreeElementPointer element = NULL, QString persistAsFileType = "svo"); + bool writeToJSONFile(const char* filename, OctreeElementPointer element = NULL, bool doGzip = false); + bool writeToSVOFile(const char* filename, OctreeElementPointer element = NULL); virtual bool writeToMap(QVariantMap& entityDescription, OctreeElementPointer element, bool skipDefaultValues, bool skipThoseWithBadParents) = 0; diff --git a/libraries/ui/src/FileDialogHelper.cpp b/libraries/ui/src/FileDialogHelper.cpp index c9a8953f01..9840e55927 100644 --- a/libraries/ui/src/FileDialogHelper.cpp +++ b/libraries/ui/src/FileDialogHelper.cpp @@ -95,6 +95,8 @@ bool FileDialogHelper::urlIsWritable(const QUrl& url) { // No file, get the parent directory and check if writable return QFileInfo(fileInfo.absoluteDir().absolutePath()).isWritable(); + // Note: Does not correctly detect on Windows that the OS drive root (i.e., C:/) cannot be written to. This even if turn on + // NTFS permissions checking. } QStringList FileDialogHelper::drives() { From 3e459085ac650ef121b7a7ca53c096da12a50a7f Mon Sep 17 00:00:00 2001 From: Brad Hefta-Gaub Date: Wed, 15 Jun 2016 09:25:46 -0700 Subject: [PATCH 2/6] don't log spam on empty URL --- libraries/procedural/src/procedural/Procedural.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libraries/procedural/src/procedural/Procedural.cpp b/libraries/procedural/src/procedural/Procedural.cpp index a9a297a2e1..7dd729384c 100644 --- a/libraries/procedural/src/procedural/Procedural.cpp +++ b/libraries/procedural/src/procedural/Procedural.cpp @@ -96,7 +96,9 @@ bool Procedural::parseVersion(const QJsonValue& version) { bool Procedural::parseUrl(const QUrl& shaderUrl) { if (!shaderUrl.isValid()) { - qWarning() << "Invalid shader URL: " << shaderUrl; + if (!shaderUrl.isEmpty()) { + qWarning() << "Invalid shader URL: " << shaderUrl; + } _networkShader.reset(); return false; } From 775656eb1d8e5daaabc8e0861738c7ee06d658bc Mon Sep 17 00:00:00 2001 From: David Rowe Date: Thu, 16 Jun 2016 08:48:30 +1200 Subject: [PATCH 3/6] Delete comment --- libraries/ui/src/FileDialogHelper.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/libraries/ui/src/FileDialogHelper.cpp b/libraries/ui/src/FileDialogHelper.cpp index 9840e55927..c9a8953f01 100644 --- a/libraries/ui/src/FileDialogHelper.cpp +++ b/libraries/ui/src/FileDialogHelper.cpp @@ -95,8 +95,6 @@ bool FileDialogHelper::urlIsWritable(const QUrl& url) { // No file, get the parent directory and check if writable return QFileInfo(fileInfo.absoluteDir().absolutePath()).isWritable(); - // Note: Does not correctly detect on Windows that the OS drive root (i.e., C:/) cannot be written to. This even if turn on - // NTFS permissions checking. } QStringList FileDialogHelper::drives() { From 5dae20975a620c6d022b1df27a09c98d270bbfa8 Mon Sep 17 00:00:00 2001 From: Brad Hefta-Gaub Date: Thu, 16 Jun 2016 08:14:31 -0700 Subject: [PATCH 4/6] fix v1 procedural shaders --- libraries/procedural/src/procedural/ProceduralCommon.slf | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libraries/procedural/src/procedural/ProceduralCommon.slf b/libraries/procedural/src/procedural/ProceduralCommon.slf index 128723265f..d4144ad537 100644 --- a/libraries/procedural/src/procedural/ProceduralCommon.slf +++ b/libraries/procedural/src/procedural/ProceduralCommon.slf @@ -264,12 +264,18 @@ float snoise(vec2 v) { return 130.0 * dot(m, g); } + #define PROCEDURAL 1 //PROCEDURAL_VERSION #ifdef PROCEDURAL_V1 +// shader playback time (in seconds) +uniform float iGlobalTime; +// the dimensions of the object being rendered +uniform vec3 iWorldScale; + #else // Unimplemented uniforms From 96d6cb12ac9ddaf43151577e77cee3a501efef35 Mon Sep 17 00:00:00 2001 From: "James B. Pollack" Date: Thu, 16 Jun 2016 12:27:03 -0700 Subject: [PATCH 5/6] supress some messages and errors --- scripts/system/html/entityProperties.html | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/system/html/entityProperties.html b/scripts/system/html/entityProperties.html index c8edbdb369..82387cafa5 100644 --- a/scripts/system/html/entityProperties.html +++ b/scripts/system/html/entityProperties.html @@ -671,7 +671,6 @@ } else { for (var i = 0; i < elShapeSections.length; i++) { - console.log("Hiding shape section " + elShapeSections[i]) elShapeSections[i].style.display = 'none'; } } @@ -805,8 +804,10 @@ } var activeElement = document.activeElement; - - activeElement.select(); + + if(typeof activeElement.select!=="undefined"){ + activeElement.select(); + } } } }); From 77976281abcfceccfb476b5a64484b5d69726552 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Fri, 17 Jun 2016 09:58:44 +1200 Subject: [PATCH 6/6] Make audio device selection available without advanced menus enabled --- scripts/system/selectAudioDevice.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/system/selectAudioDevice.js b/scripts/system/selectAudioDevice.js index fd4cd43a59..663f96b59c 100644 --- a/scripts/system/selectAudioDevice.js +++ b/scripts/system/selectAudioDevice.js @@ -48,7 +48,7 @@ var selectedInputMenu = ""; var selectedOutputMenu = ""; function setupAudioMenus() { - Menu.addMenu("Audio > Devices", "Advanced"); + Menu.addMenu("Audio > Devices"); Menu.addSeparator("Audio > Devices","Output Audio Device"); var outputDeviceSetting = Settings.getValue(OUTPUT_DEVICE_SETTING);