From 96858c95869486b63a2aeeba0227e7510c68924e Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Fri, 1 Jun 2018 13:36:32 -0700 Subject: [PATCH] MS15529: Add secondary camera snapshot notification flag --- interface/src/Application.cpp | 12 ++++++------ interface/src/Application.h | 7 +++++-- interface/src/scripting/WindowScriptingInterface.cpp | 8 ++++---- interface/src/scripting/WindowScriptingInterface.h | 4 ++-- interface/src/ui/Snapshot.cpp | 9 ++++++--- interface/src/ui/Snapshot.h | 6 +++++- 6 files changed, 28 insertions(+), 18 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index c4f700fc20..7f834f1c88 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -7652,18 +7652,18 @@ void Application::takeSnapshot(bool notify, bool includeAnimated, float aspectRa }); } -void Application::takeSecondaryCameraSnapshot(const QString& filename) { - postLambdaEvent([filename, this] { +void Application::takeSecondaryCameraSnapshot(const bool& notify, const QString& filename) { + postLambdaEvent([notify, filename, this] { QString snapshotPath = DependencyManager::get()->saveSnapshot(getActiveDisplayPlugin()->getSecondaryCameraScreenshot(), filename, TestScriptingInterface::getInstance()->getTestResultsLocation()); - emit DependencyManager::get()->stillSnapshotTaken(snapshotPath, true); + emit DependencyManager::get()->stillSnapshotTaken(snapshotPath, notify); }); } -void Application::takeSecondaryCamera360Snapshot(const glm::vec3& cameraPosition, const bool& cubemapOutputFormat, const QString& filename) { - postLambdaEvent([filename, cubemapOutputFormat, cameraPosition] { - DependencyManager::get()->save360Snapshot(cameraPosition, cubemapOutputFormat, filename); +void Application::takeSecondaryCamera360Snapshot(const glm::vec3& cameraPosition, const bool& cubemapOutputFormat, const bool& notify, const QString& filename) { + postLambdaEvent([notify, filename, cubemapOutputFormat, cameraPosition] { + DependencyManager::get()->save360Snapshot(cameraPosition, cubemapOutputFormat, notify, filename); }); } diff --git a/interface/src/Application.h b/interface/src/Application.h index 0fea476c07..236edf8bb0 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -281,8 +281,11 @@ public: float getGameLoopRate() const { return _gameLoopCounter.rate(); } void takeSnapshot(bool notify, bool includeAnimated = false, float aspectRatio = 0.0f, const QString& filename = QString()); - void takeSecondaryCameraSnapshot(const QString& filename = QString()); - void takeSecondaryCamera360Snapshot(const glm::vec3& cameraPosition, const bool& cubemapOutputFormat, const QString& filename = QString()); + void takeSecondaryCameraSnapshot(const bool& notify, const QString& filename = QString()); + void takeSecondaryCamera360Snapshot(const glm::vec3& cameraPosition, + const bool& cubemapOutputFormat, + const bool& notify, + const QString& filename = QString()); void shareSnapshot(const QString& filename, const QUrl& href = QUrl("")); diff --git a/interface/src/scripting/WindowScriptingInterface.cpp b/interface/src/scripting/WindowScriptingInterface.cpp index af9b5c8a46..0aea7a02c5 100644 --- a/interface/src/scripting/WindowScriptingInterface.cpp +++ b/interface/src/scripting/WindowScriptingInterface.cpp @@ -446,12 +446,12 @@ void WindowScriptingInterface::takeSnapshot(bool notify, bool includeAnimated, f qApp->takeSnapshot(notify, includeAnimated, aspectRatio, filename); } -void WindowScriptingInterface::takeSecondaryCameraSnapshot(const QString& filename) { - qApp->takeSecondaryCameraSnapshot(filename); +void WindowScriptingInterface::takeSecondaryCameraSnapshot(const bool& notify, const QString& filename) { + qApp->takeSecondaryCameraSnapshot(notify, filename); } -void WindowScriptingInterface::takeSecondaryCamera360Snapshot(const glm::vec3& cameraPosition, const bool& cubemapOutputFormat, const QString& filename) { - qApp->takeSecondaryCamera360Snapshot(cameraPosition, cubemapOutputFormat, filename); +void WindowScriptingInterface::takeSecondaryCamera360Snapshot(const glm::vec3& cameraPosition, const bool& cubemapOutputFormat, const bool& notify, const QString& filename) { + qApp->takeSecondaryCamera360Snapshot(cameraPosition, cubemapOutputFormat, notify, filename); } void WindowScriptingInterface::shareSnapshot(const QString& path, const QUrl& href) { diff --git a/interface/src/scripting/WindowScriptingInterface.h b/interface/src/scripting/WindowScriptingInterface.h index 5ddbc30dd3..f44fa00ac3 100644 --- a/interface/src/scripting/WindowScriptingInterface.h +++ b/interface/src/scripting/WindowScriptingInterface.h @@ -368,7 +368,7 @@ public slots: * * var filename = QString(); */ - void takeSecondaryCameraSnapshot(const QString& filename = QString()); + void takeSecondaryCameraSnapshot(const bool& notify = true, const QString& filename = QString()); /**jsdoc * Takes a 360 snapshot given a position of the secondary camera (which does not need to have been previously set up). @@ -382,7 +382,7 @@ public slots: * * var filename = QString(); */ - void takeSecondaryCamera360Snapshot(const glm::vec3& cameraPosition, const bool& cubemapOutputFormat = false, const QString& filename = QString()); + void takeSecondaryCamera360Snapshot(const glm::vec3& cameraPosition, const bool& cubemapOutputFormat = false, const bool& notify = true, const QString& filename = QString()); /**jsdoc * Emit a {@link Window.connectionAdded|connectionAdded} or a {@link Window.connectionError|connectionError} signal that diff --git a/interface/src/ui/Snapshot.cpp b/interface/src/ui/Snapshot.cpp index b2c0ee7ce7..2b306ace91 100644 --- a/interface/src/ui/Snapshot.cpp +++ b/interface/src/ui/Snapshot.cpp @@ -122,8 +122,9 @@ static const glm::quat CAMERA_ORIENTATION_LEFT(glm::quat(glm::radians(glm::vec3( static const glm::quat CAMERA_ORIENTATION_BACK(glm::quat(glm::radians(glm::vec3(0.0f, 180.0f, 0.0f)))); static const glm::quat CAMERA_ORIENTATION_RIGHT(glm::quat(glm::radians(glm::vec3(0.0f, 270.0f, 0.0f)))); static const glm::quat CAMERA_ORIENTATION_UP(glm::quat(glm::radians(glm::vec3(90.0f, 0.0f, 0.0f)))); -void Snapshot::save360Snapshot(const glm::vec3& cameraPosition, const bool& cubemapOutputFormat, const QString& filename) { +void Snapshot::save360Snapshot(const glm::vec3& cameraPosition, const bool& cubemapOutputFormat, const bool& notify, const QString& filename) { _snapshotFilename = filename; + _notify360 = notify; _cubemapOutputFormat = cubemapOutputFormat; SecondaryCameraJobConfig* secondaryCameraRenderConfig = static_cast(qApp->getRenderEngine()->getConfiguration()->getConfig("SecondaryCamera")); @@ -247,7 +248,8 @@ void Snapshot::convertToCubemap() { painter.end(); - emit DependencyManager::get()->snapshot360Taken(saveSnapshot(outputImage, _snapshotFilename), true); + emit DependencyManager::get()->snapshot360Taken(saveSnapshot(outputImage, _snapshotFilename), + _notify360); } void Snapshot::convertToEquirectangular() { @@ -327,7 +329,8 @@ void Snapshot::convertToEquirectangular() { } } - emit DependencyManager::get()->snapshot360Taken(saveSnapshot(outputImage, _snapshotFilename), true); + emit DependencyManager::get()->snapshot360Taken(saveSnapshot(outputImage, _snapshotFilename), + _notify360); } QTemporaryFile* Snapshot::saveTempSnapshot(QImage image) { diff --git a/interface/src/ui/Snapshot.h b/interface/src/ui/Snapshot.h index 2bac857a97..8fc05775bd 100644 --- a/interface/src/ui/Snapshot.h +++ b/interface/src/ui/Snapshot.h @@ -50,7 +50,10 @@ class Snapshot : public QObject, public Dependency { public: Snapshot(); QString saveSnapshot(QImage image, const QString& filename, const QString& pathname = QString()); - void save360Snapshot(const glm::vec3& cameraPosition, const bool& cubemapOutputFormat, const QString& filename); + void save360Snapshot(const glm::vec3& cameraPosition, + const bool& cubemapOutputFormat, + const bool& notify, + const QString& filename); QTemporaryFile* saveTempSnapshot(QImage image); SnapshotMetaData* parseSnapshotData(QString snapshotPath); @@ -89,6 +92,7 @@ private: const QString& userSelectedFilename = QString(), const QString& userSelectedPathname = QString()); QString _snapshotFilename; + bool _notify360; bool _cubemapOutputFormat; QTimer _snapshotTimer; qint16 _snapshotIndex;