mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
Add error text reading to asset server baking
This commit is contained in:
parent
de7e3e60cd
commit
bee666b522
3 changed files with 23 additions and 5 deletions
|
@ -77,12 +77,23 @@ void BakeAssetTask::run() {
|
|||
}
|
||||
|
||||
if (exitCode == OVEN_STATUS_CODE_SUCCESS) {
|
||||
_didFinish.store(true);
|
||||
emit bakeComplete(_assetHash, _assetPath, tempOutputDir, outputFiles);
|
||||
} else if (exitCode == OVEN_STATUS_CODE_ABORT) {
|
||||
_wasAborted.store(true);
|
||||
emit bakeAborted(_assetHash, _assetPath);
|
||||
} else {
|
||||
QString errors;
|
||||
if (exitCode == OVEN_STATUS_CODE_FAIL) {
|
||||
_didFinish.store(true);
|
||||
auto errorFilePath = _outputDir.absoluteFilePath("errors.txt");
|
||||
QFile errorFile { errorFilePath };
|
||||
if (errorFile.open(QIODevice::ReadOnly)) {
|
||||
errors = errorFile.readAll();
|
||||
errorFile.close();
|
||||
} else {
|
||||
errors = "Unknown error occurred";
|
||||
}
|
||||
}
|
||||
emit bakeFailed(_assetHash, _assetPath, errors);
|
||||
}
|
||||
|
@ -95,12 +106,9 @@ void BakeAssetTask::run() {
|
|||
qDebug() << "Process started";
|
||||
});
|
||||
|
||||
qDebug() << "Starting process!";
|
||||
proc->start(path, args, QIODevice::ReadOnly);
|
||||
proc->waitForStarted();
|
||||
qDebug() << "Started";
|
||||
proc->waitForFinished();
|
||||
qDebug() << "Finished";
|
||||
|
||||
return;
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <QObject>
|
||||
#include <QImageReader>
|
||||
#include <QtCore/QDebug>
|
||||
#include <QFile>
|
||||
|
||||
#include "ModelBakingLoggingCategory.h"
|
||||
#include "Oven.h"
|
||||
|
@ -45,6 +46,8 @@ void BakerCLI::bakeFile(QUrl inputUrl, const QString& outputPath, const QString&
|
|||
|
||||
bool isSupportedImage = QImageReader::supportedImageFormats().contains(extension.toLatin1());
|
||||
|
||||
_outputPath = outputPath;
|
||||
|
||||
// create our appropiate baker
|
||||
if (isFBX) {
|
||||
_baker = std::unique_ptr<Baker> { new FBXBaker(inputUrl, []() -> QThread* { return qApp->getNextWorkerThread(); }, outputPath) };
|
||||
|
@ -68,10 +71,15 @@ void BakerCLI::handleFinishedBaker() {
|
|||
qCDebug(model_baking) << "Finished baking file.";
|
||||
int exitCode = OVEN_STATUS_CODE_SUCCESS;
|
||||
// Do we need this?
|
||||
if (_baker.get()->wasAborted()) {
|
||||
if (_baker->wasAborted()) {
|
||||
exitCode = OVEN_STATUS_CODE_ABORT;
|
||||
} else if (_baker.get()->hasErrors()) {
|
||||
} else if (_baker->hasErrors()) {
|
||||
exitCode = OVEN_STATUS_CODE_FAIL;
|
||||
QFile errorFile { _outputPath.absoluteFilePath("errors.txt") };
|
||||
if (errorFile.open(QFile::WriteOnly)) {
|
||||
errorFile.write(_baker->getErrors().join('\n').toUtf8());
|
||||
errorFile.close();
|
||||
}
|
||||
}
|
||||
QApplication::exit(exitCode);
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#define hifi_BakerCLI_h
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QDir>
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
@ -36,6 +37,7 @@ private slots:
|
|||
void handleFinishedBaker();
|
||||
|
||||
private:
|
||||
QDir _outputPath;
|
||||
std::unique_ptr<Baker> _baker;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue