Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

fix output path

shun-iwasawa6940808db8db
diff --git a/toonz/sources/toonz/outputsettingspopup.cpp b/toonz/sources/toonz/outputsettingspopup.cpp
index 7ed1341fb..973088def 100644
--- a/toonz/sources/toonz/outputsettingspopup.cpp
+++ b/toonz/sources/toonz/outputsettingspopup.cpp
@@ -37,6 +37,7 @@
#include "tenv.h"
#include "tsystem.h"
#include "tstream.h"
+#include "tfiletype.h"
// Qt includes
#include <QLabel>
@@ -144,6 +145,13 @@ enum ThreadsOption {
enum GranularityOption { c_off, c_large, c_medium, c_small };
+bool checkForSeqNum(QString type) {
+ TFileType::Type typeInfo = TFileType::getInfoFromExtension(type);
+ if ((typeInfo & TFileType::IMAGE) && !(typeInfo & TFileType::LEVEL))
+ return true;
+ else
+ return false;
+}
} // anonymous namespace
//-----------------------------------------------------------------------------
@@ -1038,10 +1046,10 @@ void OutputSettingsPopup::onNameChanged() {
TOutputProperties *prop = getProperties();
TFilePath fp = prop->getPath();
- if (fp.getWideName() == wname) return; // Already had the right name
+ TFilePath newFp = fp.withName(wname);
+ if (newFp == fp) return; // Already had the right name
- fp = fp.withName(wname);
- prop->setPath(fp);
+ prop->setPath(newFp);
TApp::instance()->getCurrentScene()->setDirtyFlag(true);
@@ -1060,7 +1068,11 @@ void OutputSettingsPopup::onFormatChanged(const QString &str) {
TOutputProperties *prop = getProperties();
bool wasMultiRenderInvalid =
isMultiRenderInvalid(prop->getPath().getType(), m_allowMT);
- TFilePath fp = prop->getPath().withType(str.toStdString());
+ // remove sepchar, ..
+ TFilePath fp = prop->getPath().withNoFrame().withType(str.toStdString());
+ // .. then add sepchar for sequencial image formats
+ if (checkForSeqNum(str)) fp = fp.withFrame(prop->formatTemplateFId());
+
prop->setPath(fp);
TApp::instance()->getCurrentScene()->setDirtyFlag(true);
m_allowMT = Preferences::instance()->getFfmpegMultiThread();