MS15529: Add secondary camera snapshot notification flag

This commit is contained in:
Zach Fox 2018-06-01 13:36:32 -07:00
parent ed8d12593d
commit 96858c9586
6 changed files with 28 additions and 18 deletions

View file

@ -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<Snapshot>()->saveSnapshot(getActiveDisplayPlugin()->getSecondaryCameraScreenshot(), filename,
TestScriptingInterface::getInstance()->getTestResultsLocation());
emit DependencyManager::get<WindowScriptingInterface>()->stillSnapshotTaken(snapshotPath, true);
emit DependencyManager::get<WindowScriptingInterface>()->stillSnapshotTaken(snapshotPath, notify);
});
}
void Application::takeSecondaryCamera360Snapshot(const glm::vec3& cameraPosition, const bool& cubemapOutputFormat, const QString& filename) {
postLambdaEvent([filename, cubemapOutputFormat, cameraPosition] {
DependencyManager::get<Snapshot>()->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<Snapshot>()->save360Snapshot(cameraPosition, cubemapOutputFormat, notify, filename);
});
}

View file

@ -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(""));

View file

@ -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) {

View file

@ -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

View file

@ -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<SecondaryCameraJobConfig*>(qApp->getRenderEngine()->getConfiguration()->getConfig("SecondaryCamera"));
@ -247,7 +248,8 @@ void Snapshot::convertToCubemap() {
painter.end();
emit DependencyManager::get<WindowScriptingInterface>()->snapshot360Taken(saveSnapshot(outputImage, _snapshotFilename), true);
emit DependencyManager::get<WindowScriptingInterface>()->snapshot360Taken(saveSnapshot(outputImage, _snapshotFilename),
_notify360);
}
void Snapshot::convertToEquirectangular() {
@ -327,7 +329,8 @@ void Snapshot::convertToEquirectangular() {
}
}
emit DependencyManager::get<WindowScriptingInterface>()->snapshot360Taken(saveSnapshot(outputImage, _snapshotFilename), true);
emit DependencyManager::get<WindowScriptingInterface>()->snapshot360Taken(saveSnapshot(outputImage, _snapshotFilename),
_notify360);
}
QTemporaryFile* Snapshot::saveTempSnapshot(QImage image) {

View file

@ -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;