diff --git a/toonz/sources/include/tfarmtask.h b/toonz/sources/include/tfarmtask.h index 23a1bcd..03751bc 100644 --- a/toonz/sources/include/tfarmtask.h +++ b/toonz/sources/include/tfarmtask.h @@ -135,6 +135,7 @@ public: QString getCommandLinePrgName() const; QString getCommandLineArguments() const; + QStringList getCommandLineArgumentsList() const; QString getCommandLine(bool isFarmTask = false) const; void parseCommandLine(QString commandLine); diff --git a/toonz/sources/toonz/batches.cpp b/toonz/sources/toonz/batches.cpp index a0877c1..a0bd2d3 100644 --- a/toonz/sources/toonz/batches.cpp +++ b/toonz/sources/toonz/batches.cpp @@ -244,17 +244,7 @@ commandline += " -id " + task->m_id;*/ } process->setProgram(task->getCommandLinePrgName()); -#if defined(_WIN32) - process->setNativeArguments(task->getCommandLineArguments()); -#else -#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) - process->setArguments( - task->getCommandLineArguments().split(" ", Qt::SkipEmptyParts)); -#else - process->setArguments( - task->getCommandLineArguments().split(" ", QString::SkipEmptyParts)); -#endif -#endif + process->setArguments(task->getCommandLineArgumentsList()); process->start(); process->waitForFinished(-1); diff --git a/toonz/sources/toonzfarm/tfarm/tfarmtask.cpp b/toonz/sources/toonzfarm/tfarm/tfarmtask.cpp index 836266b..28fd4b2 100644 --- a/toonz/sources/toonzfarm/tfarm/tfarmtask.cpp +++ b/toonz/sources/toonzfarm/tfarm/tfarmtask.cpp @@ -368,8 +368,8 @@ static QString getExeName(bool isComposer) { return name + ".exe "; #elif defined(MACOSX) TVER::ToonzVersion tver; - return "\"./" + QString::fromStdString(tver.getAppName()) + - ".app/Contents/MacOS/" + name + "\" "; + return QString::fromStdString(tver.getAppName()) + ".app/Contents/MacOS/" + + name; #else return name; #endif @@ -541,6 +541,59 @@ QString TFarmTask::getCommandLineArguments() const { return cmdline; } +QStringList TFarmTask::getCommandLineArgumentsList() const { + QStringList ret; + + if (!m_taskFilePath.isEmpty()) + ret << QString::fromStdWString( + TSystem::toUNC(m_taskFilePath).getWideString()); + + if (m_callerMachineName != "") { + struct hostent *he = gethostbyname(m_callerMachineName.toLatin1()); + if (he) { + char *ipAddress = inet_ntoa(*(struct in_addr *)*(he->h_addr_list)); + ret << "-tmsg" << QString::fromUtf8(ipAddress); + } + } + + if (!m_isComposerTask) { + if (m_overwrite == Overwrite_All) + ret << "-overwriteAll"; + else if (m_overwrite == Overwrite_NoPaint) + ret << "-overwriteNoPaint"; + if (m_onlyVisible) ret << "-onlyvisible"; + return ret; + } + + if (!m_outputPath.isEmpty()) { + TFilePath outputPath; + try { + outputPath = TSystem::toUNC(m_outputPath); + } catch (TException &) { + } + + ret << "-o" << QString::fromStdWString(outputPath.getWideString()); + } + + ret << "-range" << QString::number(m_from) << QString::number(m_to); + ret << "-step" << QString::number(m_step); + ret << "-shrink" << QString::number(m_shrink); + ret << "-multimedia" << QString::number(m_multimedia); + + const QString threadCounts[3] = {"single", "half", "all"}; + ret << "-nthreads" << threadCounts[m_threadsIndex]; + + const QString maxTileSizes[4] = { + "none", QString::number(TOutputProperties::LargeVal), + QString::number(TOutputProperties::MediumVal), + QString::number(TOutputProperties::SmallVal)}; + ret << "-maxtilesize" << maxTileSizes[m_maxTileSizeIndex]; + + QString appname = QSettings().applicationName(); + + return ret; +} + QString TFarmTask::getCommandLine(bool) const { return getCommandLinePrgName() + getCommandLineArguments(); }