Merge pull request #12589 from highfidelity/RC65

merge back RC65 to master after RC hotfixes
This commit is contained in:
Clément Brisset 2018-03-07 17:22:41 -08:00 committed by GitHub
commit b7ac07f590
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 239 additions and 115 deletions

View file

@ -1937,9 +1937,11 @@ bool DomainServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url
const QString UUID_REGEX_STRING = "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}";
QPointer<HTTPConnection> connectionPtr { connection };
auto nodeList = DependencyManager::get<LimitedNodeList>();
auto getSetting = [this](QString keyPath, QVariant value) -> bool {
auto getSetting = [this](QString keyPath, QVariant& value) -> bool {
value = _settingsManager.valueForKeyPath(keyPath);
if (!value.isValid()) {
@ -2120,30 +2122,38 @@ bool DomainServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url
return true;
} else if (url.path() == URI_API_BACKUPS) {
auto deferred = makePromise("getAllBackupsAndStatus");
deferred->then([connection, JSON_MIME_TYPE](QString error, QVariantMap result) {
deferred->then([connectionPtr, JSON_MIME_TYPE](QString error, QVariantMap result) {
if (!connectionPtr) {
return;
}
QJsonDocument docJSON(QJsonObject::fromVariantMap(result));
connection->respond(HTTPConnection::StatusCode200, docJSON.toJson(), JSON_MIME_TYPE.toUtf8());
connectionPtr->respond(HTTPConnection::StatusCode200, docJSON.toJson(), JSON_MIME_TYPE.toUtf8());
});
_contentManager->getAllBackupsAndStatus(deferred);
return true;
} else if (url.path().startsWith(URI_API_BACKUPS_ID)) {
auto id = url.path().mid(QString(URI_API_BACKUPS_ID).length());
auto deferred = makePromise("consolidateBackup");
deferred->then([connection, JSON_MIME_TYPE](QString error, QVariantMap result) {
deferred->then([connectionPtr, JSON_MIME_TYPE](QString error, QVariantMap result) {
if (!connectionPtr) {
return;
}
QJsonObject rootJSON;
auto success = result["success"].toBool();
if (success) {
auto path = result["backupFilePath"].toString();
auto file { std::unique_ptr<QFile>(new QFile(path)) };
if (file->open(QIODevice::ReadOnly)) {
connection->respond(HTTPConnection::StatusCode200, std::move(file));
connectionPtr->respond(HTTPConnection::StatusCode200, std::move(file));
} else {
qCritical(domain_server) << "Unable to load consolidated backup at:" << path << result;
connection->respond(HTTPConnection::StatusCode500, "Error opening backup");
connectionPtr->respond(HTTPConnection::StatusCode500, "Error opening backup");
}
} else {
connection->respond(HTTPConnection::StatusCode400);
connectionPtr->respond(HTTPConnection::StatusCode400);
}
});
_contentManager->consolidateBackup(deferred, id);
@ -2264,12 +2274,16 @@ bool DomainServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url
} else if (uploadedFilename.endsWith(".zip", Qt::CaseInsensitive)) {
auto deferred = makePromise("recoverFromUploadedBackup");
deferred->then([connection, JSON_MIME_TYPE](QString error, QVariantMap result) {
deferred->then([connectionPtr, JSON_MIME_TYPE](QString error, QVariantMap result) {
if (!connectionPtr) {
return;
}
QJsonObject rootJSON;
auto success = result["success"].toBool();
rootJSON["success"] = success;
QJsonDocument docJSON(rootJSON);
connection->respond(success ? HTTPConnection::StatusCode200 : HTTPConnection::StatusCode400, docJSON.toJson(),
connectionPtr->respond(success ? HTTPConnection::StatusCode200 : HTTPConnection::StatusCode400, docJSON.toJson(),
JSON_MIME_TYPE.toUtf8());
});
@ -2297,12 +2311,16 @@ bool DomainServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url
}
auto deferred = makePromise("createManualBackup");
deferred->then([connection, JSON_MIME_TYPE](QString error, QVariantMap result) {
deferred->then([connectionPtr, JSON_MIME_TYPE](QString error, QVariantMap result) {
if (!connectionPtr) {
return;
}
QJsonObject rootJSON;
auto success = result["success"].toBool();
rootJSON["success"] = success;
QJsonDocument docJSON(rootJSON);
connection->respond(success ? HTTPConnection::StatusCode200 : HTTPConnection::StatusCode400, docJSON.toJson(),
connectionPtr->respond(success ? HTTPConnection::StatusCode200 : HTTPConnection::StatusCode400, docJSON.toJson(),
JSON_MIME_TYPE.toUtf8());
});
_contentManager->createManualBackup(deferred, it.value());
@ -2322,12 +2340,16 @@ bool DomainServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url
} else if (url.path().startsWith(URI_API_BACKUPS_RECOVER)) {
auto id = url.path().mid(QString(URI_API_BACKUPS_RECOVER).length());
auto deferred = makePromise("recoverFromBackup");
deferred->then([connection, JSON_MIME_TYPE](QString error, QVariantMap result) {
deferred->then([connectionPtr, JSON_MIME_TYPE](QString error, QVariantMap result) {
if (!connectionPtr) {
return;
}
QJsonObject rootJSON;
auto success = result["success"].toBool();
rootJSON["success"] = success;
QJsonDocument docJSON(rootJSON);
connection->respond(success ? HTTPConnection::StatusCode200 : HTTPConnection::StatusCode400, docJSON.toJson(),
connectionPtr->respond(success ? HTTPConnection::StatusCode200 : HTTPConnection::StatusCode400, docJSON.toJson(),
JSON_MIME_TYPE.toUtf8());
});
_contentManager->recoverFromBackup(deferred, id);
@ -2423,12 +2445,16 @@ bool DomainServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url
if (url.path().startsWith(URI_API_BACKUPS_ID)) {
auto id = url.path().mid(QString(URI_API_BACKUPS_ID).length());
auto deferred = makePromise("deleteBackup");
deferred->then([connection, JSON_MIME_TYPE](QString error, QVariantMap result) {
deferred->then([connectionPtr, JSON_MIME_TYPE](QString error, QVariantMap result) {
if (!connectionPtr) {
return;
}
QJsonObject rootJSON;
auto success = result["success"].toBool();
rootJSON["success"] = success;
QJsonDocument docJSON(rootJSON);
connection->respond(success ? HTTPConnection::StatusCode200 : HTTPConnection::StatusCode400, docJSON.toJson(),
connectionPtr->respond(success ? HTTPConnection::StatusCode200 : HTTPConnection::StatusCode400, docJSON.toJson(),
JSON_MIME_TYPE.toUtf8());
});
_contentManager->deleteBackup(deferred, id);

View file

@ -578,6 +578,7 @@ void Connection::processControl(ControlPacketPointer controlPacket) {
#ifdef UDT_CONNECTION_DEBUG
qCDebug(networking) << "Got handshake request, stopping SendQueue";
#endif
_hasReceivedHandshakeACK = false;
stopSendQueue();
}
break;

View file

@ -14,13 +14,14 @@
#include <QtCore/QDebug>
#include <QFile>
#include "OvenCLIApplication.h"
#include "ModelBakingLoggingCategory.h"
#include "Oven.h"
#include "BakerCLI.h"
#include "FBXBaker.h"
#include "TextureBaker.h"
BakerCLI::BakerCLI(Oven* parent) : QObject(parent) {
BakerCLI::BakerCLI(OvenCLIApplication* parent) : QObject(parent) {
}
void BakerCLI::bakeFile(QUrl inputUrl, const QString& outputPath, const QString& type) {
@ -50,14 +51,18 @@ void BakerCLI::bakeFile(QUrl inputUrl, const QString& outputPath, const QString&
// create our appropiate baker
if (isFBX) {
_baker = std::unique_ptr<Baker> { new FBXBaker(inputUrl, []() -> QThread* { return qApp->getNextWorkerThread(); }, outputPath) };
_baker->moveToThread(qApp->getNextWorkerThread());
_baker = std::unique_ptr<Baker> {
new FBXBaker(inputUrl,
[]() -> QThread* { return Oven::instance().getNextWorkerThread(); },
outputPath)
};
_baker->moveToThread(Oven::instance().getNextWorkerThread());
} else if (isSupportedImage) {
_baker = std::unique_ptr<Baker> { new TextureBaker(inputUrl, image::TextureUsage::CUBE_TEXTURE, outputPath) };
_baker->moveToThread(qApp->getNextWorkerThread());
_baker->moveToThread(Oven::instance().getNextWorkerThread());
} else {
qCDebug(model_baking) << "Failed to determine baker type for file" << inputUrl;
QApplication::exit(OVEN_STATUS_CODE_FAIL);
QCoreApplication::exit(OVEN_STATUS_CODE_FAIL);
}
// invoke the bake method on the baker thread
@ -81,5 +86,5 @@ void BakerCLI::handleFinishedBaker() {
errorFile.close();
}
}
QApplication::exit(exitCode);
QCoreApplication::exit(exitCode);
}

View file

@ -18,7 +18,7 @@
#include <memory>
#include "Baker.h"
#include "Oven.h"
#include "OvenCLIApplication.h"
static const int OVEN_STATUS_CODE_SUCCESS { 0 };
static const int OVEN_STATUS_CODE_FAIL { 1 };
@ -27,10 +27,10 @@ static const int OVEN_STATUS_CODE_ABORT { 2 };
static const QString OVEN_ERROR_FILENAME = "errors.txt";
class BakerCLI : public QObject {
Q_OBJECT
Q_OBJECT
public:
BakerCLI(Oven* parent);
BakerCLI(OvenCLIApplication* parent);
void bakeFile(QUrl inputUrl, const QString& outputPath, const QString& type = QString::null);
private slots:

View file

@ -201,7 +201,7 @@ void DomainBaker::enumerateEntities() {
}
QSharedPointer<FBXBaker> baker {
new FBXBaker(modelURL, []() -> QThread* {
return qApp->getNextWorkerThread();
return Oven::instance().getNextWorkerThread();
}, _contentOutputPath + subDirName + "/baked", _contentOutputPath + subDirName + "/original"),
&FBXBaker::deleteLater
};
@ -214,7 +214,7 @@ void DomainBaker::enumerateEntities() {
// move the baker to the baker thread
// and kickoff the bake
baker->moveToThread(qApp->getNextWorkerThread());
baker->moveToThread(Oven::instance().getNextWorkerThread());
QMetaObject::invokeMethod(baker.data(), "bake");
// keep track of the total number of baking entities
@ -285,7 +285,7 @@ void DomainBaker::bakeSkybox(QUrl skyboxURL, QJsonValueRef entity) {
_skyboxBakers.insert(skyboxURL, skyboxBaker);
// move the baker to a worker thread and kickoff the bake
skyboxBaker->moveToThread(qApp->getNextWorkerThread());
skyboxBaker->moveToThread(Oven::instance().getNextWorkerThread());
QMetaObject::invokeMethod(skyboxBaker.data(), "bake");
// keep track of the total number of baking entities

View file

@ -11,33 +11,15 @@
#include <QtCore/QDebug>
#include <QtCore/QThread>
#include <QtCore/QCommandLineParser>
#include <image/Image.h>
#include "ui/OvenMainWindow.h"
#include "Oven.h"
#include "BakerCLI.h"
static const QString OUTPUT_FOLDER = "/Users/birarda/code/hifi/lod/test-oven/export";
Oven* Oven::_staticInstance { nullptr };
static const QString CLI_INPUT_PARAMETER = "i";
static const QString CLI_OUTPUT_PARAMETER = "o";
static const QString CLI_TYPE_PARAMETER = "t";
Oven::Oven(int argc, char* argv[]) :
QApplication(argc, argv)
{
// parse the command line parameters
QCommandLineParser parser;
parser.addOptions({
{ CLI_INPUT_PARAMETER, "Path to file that you would like to bake.", "input" },
{ CLI_OUTPUT_PARAMETER, "Path to folder that will be used as output.", "output" },
{ CLI_TYPE_PARAMETER, "Type of asset.", "type" }
});
parser.addHelpOption();
parser.process(*this);
Oven::Oven() {
_staticInstance = this;
// enable compression in image library
image::setColorTexturesCompressionEnabled(true);
@ -47,41 +29,30 @@ Oven::Oven(int argc, char* argv[]) :
// setup our worker threads
setupWorkerThreads(QThread::idealThreadCount());
// check if we were passed any command line arguments that would tell us just to run without the GUI
if (parser.isSet(CLI_INPUT_PARAMETER) || parser.isSet(CLI_OUTPUT_PARAMETER)) {
if (parser.isSet(CLI_INPUT_PARAMETER) && parser.isSet(CLI_OUTPUT_PARAMETER)) {
BakerCLI* cli = new BakerCLI(this);
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);
} else {
parser.showHelp();
QApplication::quit();
}
} else {
// setup the GUI
_mainWindow = new OvenMainWindow;
_mainWindow->show();
}
}
Oven::~Oven() {
// cleanup the worker threads
for (auto i = 0; i < _workerThreads.size(); ++i) {
_workerThreads[i]->quit();
_workerThreads[i]->wait();
// quit all worker threads and wait on them
for (auto& thread : _workerThreads) {
thread->quit();
}
for (auto& thread: _workerThreads) {
thread->wait();
}
_staticInstance = nullptr;
}
void Oven::setupWorkerThreads(int numWorkerThreads) {
_workerThreads.reserve(numWorkerThreads);
for (auto i = 0; i < numWorkerThreads; ++i) {
// setup a worker thread yet and add it to our concurrent vector
auto newThread = new QThread(this);
auto newThread = std::unique_ptr<QThread> { new QThread };
newThread->setObjectName("Oven Worker Thread " + QString::number(i + 1));
_workerThreads.push_back(newThread);
_workerThreads.push_back(std::move(newThread));
}
}
@ -92,13 +63,13 @@ QThread* Oven::getNextWorkerThread() {
// (for the FBX Baker Thread to have room), and cycle through them to hand a usable running thread back to our callers.
auto nextIndex = ++_nextWorkerThreadIndex;
auto nextThread = _workerThreads[nextIndex % _workerThreads.size()];
auto& nextThread = _workerThreads[nextIndex % _workerThreads.size()];
// start the thread if it isn't running yet
if (!nextThread->isRunning()) {
nextThread->start();
}
return nextThread;
return nextThread.get();
}

View file

@ -12,27 +12,16 @@
#ifndef hifi_Oven_h
#define hifi_Oven_h
#include <QtWidgets/QApplication>
#include <TBBHelpers.h>
#include <atomic>
#include <memory>
#if defined(qApp)
#undef qApp
#endif
#define qApp (static_cast<Oven*>(QCoreApplication::instance()))
class OvenMainWindow;
class Oven : public QApplication {
Q_OBJECT
class Oven {
public:
Oven(int argc, char* argv[]);
Oven();
~Oven();
OvenMainWindow* getMainWindow() const { return _mainWindow; }
static Oven& instance() { return *_staticInstance; }
QThread* getNextWorkerThread();
@ -40,11 +29,12 @@ private:
void setupWorkerThreads(int numWorkerThreads);
void setupFBXBakerThread();
OvenMainWindow* _mainWindow;
QList<QThread*> _workerThreads;
std::vector<std::unique_ptr<QThread>> _workerThreads;
std::atomic<uint> _nextWorkerThreadIndex;
int _numWorkerThreads;
static Oven* _staticInstance;
};

View file

@ -0,0 +1,49 @@
//
// OvenCLIApplication.cpp
// tools/oven/src
//
// Created by Stephen Birarda on 2/20/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
//
#include <QtCore/QCommandLineParser>
#include <QtCore/QUrl>
#include "BakerCLI.h"
#include "OvenCLIApplication.h"
static const QString CLI_INPUT_PARAMETER = "i";
static const QString CLI_OUTPUT_PARAMETER = "o";
static const QString CLI_TYPE_PARAMETER = "t";
OvenCLIApplication::OvenCLIApplication(int argc, char* argv[]) :
QCoreApplication(argc, argv)
{
// parse the command line parameters
QCommandLineParser parser;
parser.addOptions({
{ CLI_INPUT_PARAMETER, "Path to file that you would like to bake.", "input" },
{ CLI_OUTPUT_PARAMETER, "Path to folder that will be used as output.", "output" },
{ CLI_TYPE_PARAMETER, "Type of asset.", "type" }
});
parser.addHelpOption();
parser.process(*this);
if (parser.isSet(CLI_INPUT_PARAMETER) && parser.isSet(CLI_OUTPUT_PARAMETER)) {
BakerCLI* cli = new BakerCLI(this);
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);
} else {
parser.showHelp();
QCoreApplication::quit();
}
}

View file

@ -0,0 +1,27 @@
//
// OvenCLIApplication.h
// tools/oven/src
//
// Created by Stephen Birarda on 2/20/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
//
#ifndef hifi_OvenCLIApplication_h
#define hifi_OvenCLIApplication_h
#include <QtCore/QCoreApplication>
#include "Oven.h"
class OvenCLIApplication : public QCoreApplication, public Oven {
Q_OBJECT
public:
OvenCLIApplication(int argc, char* argv[]);
static OvenCLIApplication* instance() { return dynamic_cast<OvenCLIApplication*>(QCoreApplication::instance()); }
};
#endif // hifi_OvenCLIApplication_h

View file

@ -0,0 +1,19 @@
//
// OvenGUIApplication.cpp
// tools/src/oven
//
// Created by Stephen Birarda on 2/20/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
//
#include "OvenGUIApplication.h"
OvenGUIApplication::OvenGUIApplication(int argc, char* argv[]) :
QApplication(argc, argv)
{
// setup the GUI
_mainWindow.show();
}

View file

@ -0,0 +1,33 @@
//
// OvenGUIApplication.h
// tools/oven/src
//
// Created by Stephen Birarda on 2/20/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
//
#ifndef hifi_OvenGUIApplication_h
#define hifi_OvenGUIApplication_h
#include <QtWidgets/QApplication>
#include "ui/OvenMainWindow.h"
#include "Oven.h"
class OvenGUIApplication : public QApplication, public Oven {
Q_OBJECT
public:
OvenGUIApplication(int argc, char* argv[]);
static OvenGUIApplication* instance() { return dynamic_cast<OvenGUIApplication*>(QApplication::instance()); }
OvenMainWindow* getMainWindow() { return &_mainWindow; }
private:
OvenMainWindow _mainWindow;
};
#endif // hifi_OvenGUIApplication_h

View file

@ -8,7 +8,8 @@
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
#include "Oven.h"
#include "OvenCLIApplication.h"
#include "OvenGUIApplication.h"
#include <BuildInfo.h>
#include <SettingInterface.h>
@ -20,6 +21,12 @@ int main (int argc, char** argv) {
// init the settings interface so we can save and load settings
Setting::init();
Oven app(argc, argv);
return app.exec();
// figure out if we're launching our GUI application or just the simple command line interface
if (argc > 1) {
OvenCLIApplication app { argc, argv };
return app.exec();
} else {
OvenGUIApplication app { argc, argv };
return app.exec();
}
}

View file

@ -11,8 +11,7 @@
#include <QtWidgets/QStackedWidget>
#include "../Oven.h"
#include "OvenMainWindow.h"
#include "../OvenGUIApplication.h"
#include "BakeWidget.h"
@ -28,7 +27,7 @@ BakeWidget::~BakeWidget() {
auto it = _bakers.begin();
while (it != _bakers.end()) {
auto resultRow = it->second;
auto resultsWindow = qApp->getMainWindow()->showResultsWindow();
auto resultsWindow = OvenGUIApplication::instance()->getMainWindow()->showResultsWindow();
resultsWindow->changeStatusForRow(resultRow, "Cancelled");

View file

@ -21,8 +21,7 @@
#include <QtCore/QDir>
#include <QtCore/QDebug>
#include "../Oven.h"
#include "OvenMainWindow.h"
#include "../OvenGUIApplication.h"
#include "DomainBakeWidget.h"
@ -223,14 +222,14 @@ void DomainBakeWidget::bakeButtonClicked() {
connect(domainBaker.get(), &DomainBaker::bakeProgress, this, &DomainBakeWidget::handleBakerProgress);
// move the baker to the next available Oven worker thread
auto nextThread = qApp->getNextWorkerThread();
auto nextThread = Oven::instance().getNextWorkerThread();
domainBaker->moveToThread(nextThread);
// kickoff the domain baker on its thread
QMetaObject::invokeMethod(domainBaker.get(), "bake");
// add a pending row to the results window to show that this bake is in process
auto resultsWindow = qApp->getMainWindow()->showResultsWindow();
auto resultsWindow = OvenGUIApplication::instance()->getMainWindow()->showResultsWindow();
auto resultsRowName = _domainNameLineEdit->text().isEmpty() ? fileToBakeURL.fileName() : _domainNameLineEdit->text();
auto resultsRow = resultsWindow->addPendingResultRow(resultsRowName, outputDirectory);
@ -250,7 +249,7 @@ void DomainBakeWidget::handleBakerProgress(int baked, int total) {
auto resultRow = it->second;
// grab the results window, don't force it to be brought to the top
auto resultsWindow = qApp->getMainWindow()->showResultsWindow(false);
auto resultsWindow = OvenGUIApplication::instance()->getMainWindow()->showResultsWindow(false);
int percentage = roundf(float(baked) / float(total) * 100.0f);
@ -269,7 +268,7 @@ void DomainBakeWidget::handleFinishedBaker() {
if (it != _bakers.end()) {
auto resultRow = it->second;
auto resultsWindow = qApp->getMainWindow()->showResultsWindow();
auto resultsWindow = OvenGUIApplication::instance()->getMainWindow()->showResultsWindow();
if (baker->hasErrors()) {
auto errors = baker->getErrors();

View file

@ -21,8 +21,7 @@
#include <QtCore/QDebug>
#include <QtCore/QThread>
#include "../Oven.h"
#include "OvenMainWindow.h"
#include "../OvenGUIApplication.h"
#include "ModelBakeWidget.h"
@ -208,12 +207,12 @@ void ModelBakeWidget::bakeButtonClicked() {
// everything seems to be in place, kick off a bake for this model now
auto baker = std::unique_ptr<FBXBaker> {
new FBXBaker(modelToBakeURL, []() -> QThread* {
return qApp->getNextWorkerThread();
return Oven::instance().getNextWorkerThread();
}, bakedOutputDirectory.absolutePath(), originalOutputDirectory.absolutePath())
};
// move the baker to the FBX baker thread
baker->moveToThread(qApp->getNextWorkerThread());
baker->moveToThread(Oven::instance().getNextWorkerThread());
// invoke the bake method on the baker thread
QMetaObject::invokeMethod(baker.get(), "bake");
@ -222,7 +221,7 @@ void ModelBakeWidget::bakeButtonClicked() {
connect(baker.get(), &FBXBaker::finished, this, &ModelBakeWidget::handleFinishedBaker);
// add a pending row to the results window to show that this bake is in process
auto resultsWindow = qApp->getMainWindow()->showResultsWindow();
auto resultsWindow = OvenGUIApplication::instance()->getMainWindow()->showResultsWindow();
auto resultsRow = resultsWindow->addPendingResultRow(modelToBakeURL.fileName(), outputDirectory);
// keep a unique_ptr to this baker
@ -244,7 +243,7 @@ void ModelBakeWidget::handleFinishedBaker() {
if (it != _bakers.end()) {
auto resultRow = it->second;
auto resultsWindow = qApp->getMainWindow()->showResultsWindow();
auto resultsWindow = OvenGUIApplication::instance()->getMainWindow()->showResultsWindow();
if (baker->hasErrors()) {
resultsWindow->changeStatusForRow(resultRow, baker->getErrors().join("\n"));

View file

@ -21,8 +21,7 @@
#include <QtCore/QDebug>
#include <QtCore/QThread>
#include "../Oven.h"
#include "OvenMainWindow.h"
#include "../OvenGUIApplication.h"
#include "SkyboxBakeWidget.h"
@ -184,7 +183,7 @@ void SkyboxBakeWidget::bakeButtonClicked() {
};
// move the baker to a worker thread
baker->moveToThread(qApp->getNextWorkerThread());
baker->moveToThread(Oven::instance().getNextWorkerThread());
// invoke the bake method on the baker thread
QMetaObject::invokeMethod(baker.get(), "bake");
@ -193,7 +192,7 @@ void SkyboxBakeWidget::bakeButtonClicked() {
connect(baker.get(), &TextureBaker::finished, this, &SkyboxBakeWidget::handleFinishedBaker);
// add a pending row to the results window to show that this bake is in process
auto resultsWindow = qApp->getMainWindow()->showResultsWindow();
auto resultsWindow = OvenGUIApplication::instance()->getMainWindow()->showResultsWindow();
auto resultsRow = resultsWindow->addPendingResultRow(skyboxToBakeURL.fileName(), outputDirectory);
// keep a unique_ptr to this baker
@ -211,7 +210,7 @@ void SkyboxBakeWidget::handleFinishedBaker() {
if (it != _bakers.end()) {
auto resultRow = it->second;
auto resultsWindow = qApp->getMainWindow()->showResultsWindow();
auto resultsWindow = OvenGUIApplication::instance()->getMainWindow()->showResultsWindow();
if (baker->hasErrors()) {
resultsWindow->changeStatusForRow(resultRow, baker->getErrors().join("\n"));