mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-15 12:59:22 +02:00
Made requested changed to Oven CLI
This commit is contained in:
parent
46400f4122
commit
a3d2fa2630
3 changed files with 20 additions and 10 deletions
|
@ -9,16 +9,20 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#include <QObject>
|
||||
#include <QImageReader>
|
||||
#include <QtCore/QDebug>
|
||||
#include "ModelBakingLoggingCategory.h"
|
||||
|
||||
#include "ModelBakingLoggingCategory.h"
|
||||
#include "Oven.h"
|
||||
#include "BakerCLI.h"
|
||||
#include "FBXBaker.h"
|
||||
#include "TextureBaker.h"
|
||||
|
||||
void BakerCLI::bakeFile(const QString inputFilename, const QString outputFilename) {
|
||||
BakerCLI::BakerCLI(Oven* parent) : QObject() {
|
||||
}
|
||||
|
||||
void BakerCLI::bakeFile(const QString inputFilename, const QString outputPath) {
|
||||
QUrl inputUrl(inputFilename);
|
||||
|
||||
// if the URL doesn't have a scheme, assume it is a local file
|
||||
|
@ -40,12 +44,12 @@ void BakerCLI::bakeFile(const QString inputFilename, const QString outputFilenam
|
|||
Baker* baker;
|
||||
|
||||
if (isFBX) {
|
||||
baker = new FBXBaker(inputUrl, outputFilename, []() -> QThread* {
|
||||
baker = new FBXBaker(inputUrl, outputPath, []() -> QThread* {
|
||||
return qApp->getNextWorkerThread();
|
||||
});
|
||||
baker->moveToThread(qApp->getFBXBakerThread());
|
||||
} else if (isSupportedImage) {
|
||||
baker = new TextureBaker(inputUrl, image::TextureUsage::CUBE_TEXTURE, outputFilename);
|
||||
baker = new TextureBaker(inputUrl, image::TextureUsage::CUBE_TEXTURE, outputPath);
|
||||
baker->moveToThread(qApp->getNextWorkerThread());
|
||||
} else {
|
||||
qCDebug(model_baking) << "Failed to determine baker type for file" << inputUrl;
|
||||
|
|
|
@ -14,11 +14,14 @@
|
|||
|
||||
#include <QtCore/QObject>
|
||||
|
||||
#include "Oven.h"
|
||||
|
||||
class BakerCLI : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
void bakeFile(const QString inputFilename, const QString outputFilename);
|
||||
BakerCLI(Oven* parent);
|
||||
void bakeFile(const QString inputFilename, const QString outputPath);
|
||||
|
||||
private slots:
|
||||
void handleFinishedBaker();
|
||||
|
|
|
@ -22,6 +22,9 @@
|
|||
|
||||
static const QString OUTPUT_FOLDER = "/Users/birarda/code/hifi/lod/test-oven/export";
|
||||
|
||||
static const QString CLI_INPUT_PARAMETER = "i";
|
||||
static const QString CLI_OUTPUT_PARAMETER = "o";
|
||||
|
||||
Oven::Oven(int argc, char* argv[]) :
|
||||
QApplication(argc, argv)
|
||||
{
|
||||
|
@ -35,8 +38,8 @@ Oven::Oven(int argc, char* argv[]) :
|
|||
QCommandLineParser parser;
|
||||
|
||||
parser.addOptions({
|
||||
{ "i", "Path to file that you would like to bake.", "input" },
|
||||
{ "o", "Path to folder that will be used as output.", "output" }
|
||||
{ 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" }
|
||||
});
|
||||
parser.addHelpOption();
|
||||
parser.process(*this);
|
||||
|
@ -55,9 +58,9 @@ Oven::Oven(int argc, char* argv[]) :
|
|||
setupFBXBakerThread();
|
||||
|
||||
// check if we were passed any command line arguments that would tell us just to run without the GUI
|
||||
if (parser.isSet("i") && parser.isSet("o")) {
|
||||
BakerCLI* cli = new BakerCLI();
|
||||
cli->bakeFile(parser.value("i"), parser.value("o"));
|
||||
if (parser.isSet(CLI_INPUT_PARAMETER) && parser.isSet(CLI_OUTPUT_PARAMETER)) {
|
||||
BakerCLI* cli = new BakerCLI(this);
|
||||
cli->bakeFile(parser.value(CLI_INPUT_PARAMETER), parser.value(CLI_OUTPUT_PARAMETER));
|
||||
} else {
|
||||
// setup the GUI
|
||||
_mainWindow = new OvenMainWindow;
|
||||
|
|
Loading…
Reference in a new issue