mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +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) {
|
if (exitCode == OVEN_STATUS_CODE_SUCCESS) {
|
||||||
|
_didFinish.store(true);
|
||||||
emit bakeComplete(_assetHash, _assetPath, tempOutputDir, outputFiles);
|
emit bakeComplete(_assetHash, _assetPath, tempOutputDir, outputFiles);
|
||||||
} else if (exitCode == OVEN_STATUS_CODE_ABORT) {
|
} else if (exitCode == OVEN_STATUS_CODE_ABORT) {
|
||||||
|
_wasAborted.store(true);
|
||||||
emit bakeAborted(_assetHash, _assetPath);
|
emit bakeAborted(_assetHash, _assetPath);
|
||||||
} else {
|
} else {
|
||||||
QString errors;
|
QString errors;
|
||||||
if (exitCode == OVEN_STATUS_CODE_FAIL) {
|
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);
|
emit bakeFailed(_assetHash, _assetPath, errors);
|
||||||
}
|
}
|
||||||
|
@ -95,12 +106,9 @@ void BakeAssetTask::run() {
|
||||||
qDebug() << "Process started";
|
qDebug() << "Process started";
|
||||||
});
|
});
|
||||||
|
|
||||||
qDebug() << "Starting process!";
|
|
||||||
proc->start(path, args, QIODevice::ReadOnly);
|
proc->start(path, args, QIODevice::ReadOnly);
|
||||||
proc->waitForStarted();
|
proc->waitForStarted();
|
||||||
qDebug() << "Started";
|
|
||||||
proc->waitForFinished();
|
proc->waitForFinished();
|
||||||
qDebug() << "Finished";
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QImageReader>
|
#include <QImageReader>
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
|
#include <QFile>
|
||||||
|
|
||||||
#include "ModelBakingLoggingCategory.h"
|
#include "ModelBakingLoggingCategory.h"
|
||||||
#include "Oven.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());
|
bool isSupportedImage = QImageReader::supportedImageFormats().contains(extension.toLatin1());
|
||||||
|
|
||||||
|
_outputPath = outputPath;
|
||||||
|
|
||||||
// create our appropiate baker
|
// create our appropiate baker
|
||||||
if (isFBX) {
|
if (isFBX) {
|
||||||
_baker = std::unique_ptr<Baker> { new FBXBaker(inputUrl, []() -> QThread* { return qApp->getNextWorkerThread(); }, outputPath) };
|
_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.";
|
qCDebug(model_baking) << "Finished baking file.";
|
||||||
int exitCode = OVEN_STATUS_CODE_SUCCESS;
|
int exitCode = OVEN_STATUS_CODE_SUCCESS;
|
||||||
// Do we need this?
|
// Do we need this?
|
||||||
if (_baker.get()->wasAborted()) {
|
if (_baker->wasAborted()) {
|
||||||
exitCode = OVEN_STATUS_CODE_ABORT;
|
exitCode = OVEN_STATUS_CODE_ABORT;
|
||||||
} else if (_baker.get()->hasErrors()) {
|
} else if (_baker->hasErrors()) {
|
||||||
exitCode = OVEN_STATUS_CODE_FAIL;
|
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);
|
QApplication::exit(exitCode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#define hifi_BakerCLI_h
|
#define hifi_BakerCLI_h
|
||||||
|
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
|
#include <QDir>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
@ -36,6 +37,7 @@ private slots:
|
||||||
void handleFinishedBaker();
|
void handleFinishedBaker();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
QDir _outputPath;
|
||||||
std::unique_ptr<Baker> _baker;
|
std::unique_ptr<Baker> _baker;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue