hslt: '-L' command line parameter to set the log level; '-r' immediately starts rendering in mtsgui
parent
cb56d97fcf
commit
5d578e9c68
|
@ -36,6 +36,7 @@
|
|||
#include <mitsuba/render/scenehandler.h>
|
||||
#include <fstream>
|
||||
#include <stdexcept>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
#if defined(__WINDOWS__)
|
||||
#include <mitsuba/core/getopt.h>
|
||||
|
@ -78,7 +79,8 @@ void help() {
|
|||
cout << " -r sec Write (partial) output images every 'sec' seconds" << endl << endl;
|
||||
cout << " -b res Specify the block resolution used to split images into parallel" << endl;
|
||||
cout << " workloads (default: 32). Only applies to some integrators." << endl << endl;
|
||||
cout << " -v Be more verbose" << endl << endl;
|
||||
cout << " -v Be more verbose (can be specified twice)" << endl << endl;
|
||||
cout << " -L level Explicitly specify the log level (trace/debug/info/warn/error)" << endl << endl;
|
||||
cout << " -w Treat warnings as errors" << endl << endl;
|
||||
cout << " -z Disable progress bars" << endl << endl;
|
||||
cout << " For documentation, please refer to http://www.mitsuba-renderer.org/docs.html" << endl;
|
||||
|
@ -149,7 +151,7 @@ int mitsuba_app(int argc, char **argv) {
|
|||
|
||||
optind = 1;
|
||||
/* Parse command-line arguments */
|
||||
while ((optchar = getopt(argc, argv, "a:c:D:s:j:n:o:r:b:p:qhzvtwx")) != -1) {
|
||||
while ((optchar = getopt(argc, argv, "a:c:D:s:j:n:o:r:b:p:L:qhzvtwx")) != -1) {
|
||||
switch (optchar) {
|
||||
case 'a': {
|
||||
std::vector<std::string> paths = tokenize(optarg, ";");
|
||||
|
@ -194,6 +196,22 @@ int mitsuba_app(int argc, char **argv) {
|
|||
else
|
||||
logLevel = ETrace;
|
||||
break;
|
||||
case 'L': {
|
||||
std::string arg = boost::to_lower_copy(std::string(optarg));
|
||||
if (arg == "trace")
|
||||
logLevel = ETrace;
|
||||
else if (arg == "debug")
|
||||
logLevel = EDebug;
|
||||
else if (arg == "info")
|
||||
logLevel = EInfo;
|
||||
else if (arg == "warn")
|
||||
logLevel = EWarn;
|
||||
else if (arg == "error")
|
||||
logLevel = EError;
|
||||
else
|
||||
SLog(EError, "Invalid log level!");
|
||||
}
|
||||
break;
|
||||
case 'x':
|
||||
skipExisting = true;
|
||||
break;
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <mitsuba/core/bitmap.h>
|
||||
#include <fstream>
|
||||
#include <stdexcept>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
#include <io.h>
|
||||
|
@ -108,7 +109,7 @@ int mtssrv(int argc, char **argv) {
|
|||
|
||||
optind = 1;
|
||||
/* Parse command-line arguments */
|
||||
while ((optchar = getopt(argc, argv, "a:c:s:n:p:i:l:qhv")) != -1) {
|
||||
while ((optchar = getopt(argc, argv, "a:c:s:n:p:i:l:L:qhv")) != -1) {
|
||||
switch (optchar) {
|
||||
case 'a': {
|
||||
std::vector<std::string> paths = tokenize(optarg, ";");
|
||||
|
@ -146,6 +147,22 @@ int mtssrv(int argc, char **argv) {
|
|||
case 'v':
|
||||
logLevel = EDebug;
|
||||
break;
|
||||
case 'L': {
|
||||
std::string arg = boost::to_lower_copy(std::string(optarg));
|
||||
if (arg == "trace")
|
||||
logLevel = ETrace;
|
||||
else if (arg == "debug")
|
||||
logLevel = EDebug;
|
||||
else if (arg == "info")
|
||||
logLevel = EInfo;
|
||||
else if (arg == "warn")
|
||||
logLevel = EWarn;
|
||||
else if (arg == "error")
|
||||
logLevel = EError;
|
||||
else
|
||||
SLog(EError, "Invalid log level!");
|
||||
}
|
||||
break;
|
||||
case 'l':
|
||||
if (!strcmp("s", optarg)) {
|
||||
listenPort = -1;
|
||||
|
@ -184,7 +201,8 @@ int mtssrv(int argc, char **argv) {
|
|||
cout << " -l port Listen for connections on a certain port (Default: " << MTS_DEFAULT_PORT << ")." << endl;
|
||||
cout << " To listen on stdin, specify \"-ls\" (implies -q)" << endl << endl;
|
||||
cout << " -n name Assign a node name to this instance (Default: host name)" << endl << endl;
|
||||
cout << " -v Be more verbose" << endl << endl;
|
||||
cout << " -v Be more verbose (can be specified twice)" << endl << endl;
|
||||
cout << " -L level Explicitly specify the log level (trace/debug/info/warn/error)" << endl << endl;
|
||||
cout << " For documentation, please refer to http://www.mitsuba-renderer.org/docs.html" << endl;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -499,6 +499,9 @@ void GLWidget::keyPressEvent(QKeyEvent *event) {
|
|||
} else if (event->key() == Qt::Key_R) {
|
||||
emit beginRendering();
|
||||
}
|
||||
else if (event->key() == Qt::Key_S) {
|
||||
emit stopRendering();
|
||||
}
|
||||
|
||||
if (event->isAutoRepeat() || !m_context)
|
||||
return;
|
||||
|
|
|
@ -32,7 +32,7 @@ LoadDialog::LoadDialog(QWidget *parent) :
|
|||
m_consoleAppender = new QConsoleAppender();
|
||||
Logger *logger = Thread::getThread()->getLogger();
|
||||
m_oldLogLevel = logger->getLogLevel();
|
||||
logger->setLogLevel(EDebug);
|
||||
//logger->setLogLevel(EDebug);
|
||||
logger->addAppender(m_consoleAppender);
|
||||
connect(m_consoleAppender, SIGNAL(textMessage(ELogLevel, const QString &)),
|
||||
this, SLOT(onTextMessage(ELogLevel, const QString &)), Qt::QueuedConnection);
|
||||
|
|
|
@ -166,7 +166,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
|
||||
connect(ui->glView, SIGNAL(quit()), this, SLOT(on_actionExit_triggered()));
|
||||
connect(ui->glView, SIGNAL(beginRendering()), this, SLOT(on_actionRender_triggered()));
|
||||
connect(ui->glView, SIGNAL(stopRendering()), this, SLOT(updateUI()));
|
||||
connect(ui->glView, SIGNAL(stopRendering()), this, SLOT(on_actionStop_triggered()));
|
||||
connect(ui->glView, SIGNAL(statusMessage(const QString &)), this, SLOT(onStatusMessage(const QString &)),
|
||||
Qt::QueuedConnection);
|
||||
connect(ui->glView, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()));
|
||||
|
@ -269,6 +269,7 @@ bool MainWindow::initWorkersProcessArgv() {
|
|||
int localWorkerCount = settings.value("localWorkers", getCoreCount()).toInt();
|
||||
ref<Scheduler> scheduler = Scheduler::getInstance();
|
||||
QString outputFile("");
|
||||
bool beginRendering = false;
|
||||
|
||||
for (int i=1; i<args.count(); ++i) {
|
||||
if (args[i].startsWith("-D")) {
|
||||
|
@ -296,6 +297,29 @@ bool MainWindow::initWorkersProcessArgv() {
|
|||
unsigned int numCores = value.toUInt(&ok, 10);
|
||||
if (ok)
|
||||
localWorkerCount = numCores;
|
||||
} else if (args[i].startsWith("-r")) {
|
||||
beginRendering = true;
|
||||
} else if (args[i].startsWith("-L")) {
|
||||
Logger *logger = Thread::getThread()->getLogger();
|
||||
QString value = args[i].mid(2);
|
||||
if (value.length() == 0 && i+1<args.count())
|
||||
value = args[++i];
|
||||
value = value.toLower();
|
||||
ELogLevel logLevel = EDebug;
|
||||
if (value == "trace")
|
||||
logLevel = ETrace;
|
||||
else if (value == "debug")
|
||||
logLevel = EDebug;
|
||||
else if (value == "info")
|
||||
logLevel = EInfo;
|
||||
else if (value == "warn")
|
||||
logLevel = EWarn;
|
||||
else if (value == "error")
|
||||
logLevel = EError;
|
||||
else
|
||||
SLog(EError, "Invalid log level!");
|
||||
logger->setLogLevel(logLevel);
|
||||
settings.setValue("verbosity", logLevel);
|
||||
} else if (args[i] == "-h") {
|
||||
cout << "Mitsuba version " << Version(MTS_VERSION).toStringComplete()
|
||||
<< ", Copyright (c) " MTS_YEAR " Wenzel Jakob" << endl;
|
||||
|
@ -306,6 +330,8 @@ bool MainWindow::initWorkersProcessArgv() {
|
|||
cout << " -o fname Write the output image to the file denoted by \"fname\"" << endl << endl;
|
||||
cout << " -a p1;p2;.. Add one or more entries to the resource search path" << endl << endl;
|
||||
cout << " -p count Override the detected number of processors." << endl << endl;
|
||||
cout << " -L level Explicitly specify the log level (trace/debug/info/warn/error)" << endl << endl;
|
||||
cout << " -r Immediately begin rendering" << endl << endl;
|
||||
cout << " For documentation, please refer to http://www.mitsuba-renderer.org/docs.html" << endl;
|
||||
return false;
|
||||
} else if (args[i].startsWith("-")) {
|
||||
|
@ -376,6 +402,14 @@ bool MainWindow::initWorkersProcessArgv() {
|
|||
loadFile(toBeLoaded[i].first, toBeLoaded[i].second);
|
||||
|
||||
scheduler->start();
|
||||
|
||||
if (beginRendering) {
|
||||
for (int i=0; i<ui->tabBar->count(); ++i) {
|
||||
ui->tabBar->setCurrentIndex(i);
|
||||
on_actionRender_triggered();
|
||||
}
|
||||
}
|
||||
|
||||
raise();
|
||||
return true;
|
||||
}
|
||||
|
@ -667,6 +701,7 @@ void MainWindow::onClearRecent() {
|
|||
|
||||
SceneContext *MainWindow::loadScene(const QString &qFileName, const QString &destFile) {
|
||||
ref<FileResolver> resolver = Thread::getThread()->getFileResolver();
|
||||
ref<Logger> logger = Thread::getThread()->getLogger();
|
||||
fs::path filename = resolver->resolve(toFsPath(qFileName));
|
||||
fs::path filePath = fs::absolute(filename).parent_path();
|
||||
ref<FileResolver> newResolver = resolver->clone();
|
||||
|
|
Loading…
Reference in New Issue