mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-15 12:59:22 +02:00
Made requested changes to OvenCLI constructor
This commit is contained in:
parent
a3d2fa2630
commit
99e9e10882
3 changed files with 13 additions and 9 deletions
|
@ -19,11 +19,10 @@
|
|||
#include "FBXBaker.h"
|
||||
#include "TextureBaker.h"
|
||||
|
||||
BakerCLI::BakerCLI(Oven* parent) : QObject() {
|
||||
BakerCLI::BakerCLI(Oven* parent) : QObject(parent) {
|
||||
}
|
||||
|
||||
void BakerCLI::bakeFile(const QString inputFilename, const QString outputPath) {
|
||||
QUrl inputUrl(inputFilename);
|
||||
void BakerCLI::bakeFile(QUrl inputUrl, const QString outputPath) {
|
||||
|
||||
// if the URL doesn't have a scheme, assume it is a local file
|
||||
if (inputUrl.scheme() != "http" && inputUrl.scheme() != "https" && inputUrl.scheme() != "ftp") {
|
||||
|
@ -33,11 +32,11 @@ void BakerCLI::bakeFile(const QString inputFilename, const QString outputPath) {
|
|||
static const QString MODEL_EXTENSION { ".fbx" };
|
||||
|
||||
// check what kind of baker we should be creating
|
||||
bool isFBX = inputFilename.endsWith(MODEL_EXTENSION, Qt::CaseInsensitive);
|
||||
bool isFBX = inputUrl.toDisplayString().endsWith(MODEL_EXTENSION, Qt::CaseInsensitive);
|
||||
bool isSupportedImage = false;
|
||||
|
||||
for (QByteArray format : QImageReader::supportedImageFormats()) {
|
||||
isSupportedImage |= inputFilename.endsWith(format, Qt::CaseInsensitive);
|
||||
isSupportedImage |= inputUrl.toDisplayString().endsWith(format, Qt::CaseInsensitive);
|
||||
}
|
||||
|
||||
// create our appropiate baker
|
||||
|
|
|
@ -21,7 +21,7 @@ class BakerCLI : public QObject {
|
|||
|
||||
public:
|
||||
BakerCLI(Oven* parent);
|
||||
void bakeFile(const QString inputFilename, const QString outputPath);
|
||||
void bakeFile(QUrl inputUrl, const QString outputPath);
|
||||
|
||||
private slots:
|
||||
void handleFinishedBaker();
|
||||
|
|
|
@ -58,9 +58,14 @@ 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(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));
|
||||
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);
|
||||
cli->bakeFile(parser.value(CLI_INPUT_PARAMETER), parser.value(CLI_OUTPUT_PARAMETER));
|
||||
} else {
|
||||
parser.showHelp();
|
||||
QApplication::quit();
|
||||
}
|
||||
} else {
|
||||
// setup the GUI
|
||||
_mainWindow = new OvenMainWindow;
|
||||
|
|
Loading…
Reference in a new issue