Skip to content

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

C

remove unused function

Abel You001cb39062a0
diff --git a/toonz/sources/toonz/iocommand.cpp b/toonz/sources/toonz/iocommand.cpp
index 71c87a67e..e904f0104 100644
--- a/toonz/sources/toonz/iocommand.cpp
+++ b/toonz/sources/toonz/iocommand.cpp
@@ -2915,119 +2915,6 @@ QRegularExpression::ExtendedPatternSyntaxOption);
}
}
-// Use double value DPI as policy
-// 0:Image DPI , -1:CameraDPI , other:value of dpi
-void IoCmd::convertNAARaster2TLV(std::vector<LoadResourceArguments::ResourceData>& rds,
- bool askUser, double dpi, bool appendPalette) {
- struct locals {
- static bool checkConvertPolicy(const TFilePath& path) {
- switch (Preferences::instance()->getIntValue(convertPolicy)) {
- case 0:
- break; // Ask every time
- case 1:
- return true; // Always convert
- case 2:
- return false; // Never convert
- }
-
- QString label = QObject::tr(
- "%1\n\nis an image sequence that can be converted into a TLV format "
- "\nWould you like to convert it?")
- .arg(path.getQString());
-
- QString checkBoxLabel = QObject::tr("Always do this action.");
- QStringList buttons;
- buttons << QObject::tr("Yes") << QObject::tr("No, use as is");
-
- DVGui::MessageAndCheckboxDialog* convertDialog =
- DVGui::createMsgandCheckbox(DVGui::QUESTION, label, checkBoxLabel,
- buttons, 1, Qt::Unchecked);
-
- int ret = convertDialog->exec();
- int checked = convertDialog->getChecked();
-
- if (checked) {
- Preferences::instance()->setValue(convertPolicy, ret);
- TApp::instance()->getCurrentScene()->notifyImportPolicyChanged(ret);
- }
-
- return ret == 1;
- }
-
- static bool getRange(const TFilePath& path, int& from, int& to, TFilePath &first) {
- TLevelP levelTmp;
- TLevelReaderP lrTmp = TLevelReaderP(path);
- if (lrTmp) {
- levelTmp = lrTmp->loadInfo();
- TLevel::Table* t = levelTmp->getTable();
- if (!t->empty()) {
- TFrameId start = t->begin()->first;
- TFrameId end = t->rbegin()->first;
- if (start.getNumber() >= 0 && end.getNumber() >= 0) {
- from = start.getNumber();
- to = end.getNumber();
- first = lrTmp->getFrameReader(start)->getFilePath();
- return true;
- }
- }
- }
- return false;
- }
- };//Locals
-
- static const QStringList rasterExts = {
- "png", "jpg", "jpeg", "bmp", "tga" };
- TApp* app = TApp::instance();
- ToonzScene* scene = app->getCurrentScene()->getScene();
- for (auto &rd : rds) {
- TFilePath& path = rd.m_path;
- if (path.getDots() == ".." && rasterExts.contains(QString::fromStdString(path.getType()).toLower())) {
- if (!path.isAbsolute()) path = scene->decodeFilePath(path);
- TFilePath dstPath = path.getParentDir() + TFilePath(path.getName()).withType("tlv");
- int from, to;
- TFilePath first;
- if (!locals::getRange(path, from, to, first)) continue;
- if (ImageUtils::isAAImage(first))continue;
- if (askUser && !locals::checkConvertPolicy(path))continue;
- if (TSystem::doesExistFileOrLevel(dstPath)) {
- OverwriteDialog dialog;
- dstPath = dstPath.withName(dialog.execute(scene, dstPath, false));
-
- switch (dialog.getChoice()) {
- case OverwriteDialog::RENAME:
- case OverwriteDialog::KEEP_OLD:
- continue;
- case OverwriteDialog::OVERWRITE:
- TSystem::removeFileOrLevel(dstPath);
- TSystem::removeFileOrLevel(dstPath.withType("tpl"));
- break;
- default:
- continue;
- }
- }
- Convert2Tlv converter(path, TFilePath(), dstPath.getParentDir(), QString::fromStdWString(dstPath.getWideName())
- , from, to, false, TFilePath(), 20, 0, 50, false, true, scene->getCurrentCamera()->getDpi().x);
- std::string e;
- converter.init(e);
- if (!e.empty()) {
- DVGui::warning(QString("Failed to Convert\n%1").arg(path.getQString()));
- continue;
- }
- int count = converter.getFramesToConvertCount();
- if (count) {
- IoCmd::ConvertingPopup convertingPopup(
- TApp::instance()->getMainWindow(),
- path.getQString());
- convertingPopup.show();
- for (int i = 0; i < count; ++i)converter.convertNext(e);
- convertingPopup.hide();
- if (TSystem::doesExistFileOrLevel(dstPath))
- path = scene->codeFilePath(dstPath);
- }
- }
- }
-}
-
//===========================================================================
// If the scene will be saved in the different folder, check out the scene
// cast.