Enable support for baking JS files inside of the oven

This commit is contained in:
Ryan Huffman 2018-03-06 09:12:47 -08:00
parent 5448099a93
commit c555590e9b

View file

@ -18,6 +18,7 @@
#include "ModelBakingLoggingCategory.h"
#include "BakerCLI.h"
#include "FBXBaker.h"
#include "JSBaker.h"
#include "TextureBaker.h"
BakerCLI::BakerCLI(OvenCLIApplication* parent) : QObject(parent) {
@ -34,6 +35,7 @@ void BakerCLI::bakeFile(QUrl inputUrl, const QString& outputPath, const QString&
qDebug() << "Baking file type: " << type;
static const QString MODEL_EXTENSION { "fbx" };
static const QString SCRIPT_EXTENSION { "js" };
QString extension = type;
@ -44,6 +46,7 @@ void BakerCLI::bakeFile(QUrl inputUrl, const QString& outputPath, const QString&
// check what kind of baker we should be creating
bool isFBX = extension == MODEL_EXTENSION;
bool isScript = extension == SCRIPT_EXTENSION;
bool isSupportedImage = QImageReader::supportedImageFormats().contains(extension.toLatin1());
@ -57,6 +60,9 @@ void BakerCLI::bakeFile(QUrl inputUrl, const QString& outputPath, const QString&
outputPath)
};
_baker->moveToThread(Oven::instance().getNextWorkerThread());
} else if (isScript) {
_baker = std::unique_ptr<Baker> { new JSBaker(inputUrl, outputPath) };
_baker->moveToThread(qApp->getNextWorkerThread());
} else if (isSupportedImage) {
_baker = std::unique_ptr<Baker> { new TextureBaker(inputUrl, image::TextureUsage::CUBE_TEXTURE, outputPath) };
_baker->moveToThread(Oven::instance().getNextWorkerThread());