From 693f4f8ba9c8cb7e7df1b2eb1ca6be3e20b9f5f1 Mon Sep 17 00:00:00 2001 From: manongjohn Date: Sat, 13 Mar 2021 17:40:40 -0500 Subject: [PATCH 01/21] Add Rhubarb path in Preferences --- toonz/sources/include/toonz/preferences.h | 1 + .../include/toonz/preferencesitemids.h | 1 + toonz/sources/toonz/preferencespopup.cpp | 49 ++++++++++--------- toonz/sources/toonzlib/preferences.cpp | 1 + 4 files changed, 30 insertions(+), 22 deletions(-) diff --git a/toonz/sources/include/toonz/preferences.h b/toonz/sources/include/toonz/preferences.h index 5dbc89f6..1fae2761 100644 --- a/toonz/sources/include/toonz/preferences.h +++ b/toonz/sources/include/toonz/preferences.h @@ -282,6 +282,7 @@ public: QString getFfmpegPath() const { return getStringValue(ffmpegPath); } int getFfmpegTimeout() { return getIntValue(ffmpegTimeout); } QString getFastRenderPath() const { return getStringValue(fastRenderPath); } + QString getRhubarbPath() const { return getStringValue(rhubarbPath); } // Drawing tab QString getScanLevelType() const { return getStringValue(scanLevelType); } diff --git a/toonz/sources/include/toonz/preferencesitemids.h b/toonz/sources/include/toonz/preferencesitemids.h index 930e2e5a..f8fe3229 100644 --- a/toonz/sources/include/toonz/preferencesitemids.h +++ b/toonz/sources/include/toonz/preferencesitemids.h @@ -74,6 +74,7 @@ enum PreferencesItemId { ffmpegPath, ffmpegTimeout, fastRenderPath, + rhubarbPath, //---------- // Drawing diff --git a/toonz/sources/toonz/preferencespopup.cpp b/toonz/sources/toonz/preferencespopup.cpp index 5481b696..14edb6be 100644 --- a/toonz/sources/toonz/preferencespopup.cpp +++ b/toonz/sources/toonz/preferencespopup.cpp @@ -1042,9 +1042,10 @@ QString PreferencesPopup::getUIString(PreferencesItemId id) { {defaultProjectPath, tr("Default Project Path:")}, // Import / Export - {ffmpegPath, tr("FFmpeg Path:")}, - {ffmpegTimeout, tr("FFmpeg Timeout:")}, - {fastRenderPath, tr("Fast Render Path:")}, + {ffmpegPath, tr("Executable Directory:")}, + {ffmpegTimeout, tr("Process Timeout:")}, + {fastRenderPath, tr("Fast Render Output Directory:")}, + {rhubarbPath, tr("Executable Directory:")}, // Drawing {scanLevelType, tr("Scan File Format:")}, @@ -1619,26 +1620,28 @@ QWidget* PreferencesPopup::createImportExportPage() { QWidget* widget = new QWidget(this); QGridLayout* lay = new QGridLayout(); setupLayout(lay); - - putLabel( - tr("Tahoma2D can use FFmpeg for additional file formats.\n") + - tr("FFmpeg is bundled with Tahoma2D,\n") + - tr("but you can provide the path to a different ffmpeg location."), - lay); - insertUI(ffmpegPath, lay); - - putLabel(tr("Number of seconds to wait for FFmpeg to complete processing the " - "output:"), + putLabel(tr("External applications used by Tahoma2D.\nThese come bundled " + "with Tahoma2D, but you can set path to a different version."), lay); - putLabel( - tr("Note: FFmpeg begins working once all images have been processed."), - lay); - insertUI(ffmpegTimeout, lay); - putLabel(tr("Please indicate where you would like exports from Fast " - "Render (MP4) to go."), - lay); - insertUI(fastRenderPath, lay); + QGridLayout* ffmpegOptionsLay = insertGroupBox(tr("FFmpeg"), lay); + { + insertUI(ffmpegPath, ffmpegOptionsLay); + + putLabel( + tr("Number of seconds to wait for FFmpeg to complete processing the " + "output:"), + ffmpegOptionsLay); + putLabel( + tr("Note: FFmpeg begins working once all images have been processed."), + ffmpegOptionsLay); + insertUI(ffmpegTimeout, ffmpegOptionsLay); + + insertUI(fastRenderPath, ffmpegOptionsLay); + } + + QGridLayout* rhubarbOptionsLay = insertGroupBox(tr("Rhubarb"), lay); + { insertUI(rhubarbPath, rhubarbOptionsLay); } lay->setRowStretch(lay->rowCount(), 1); insertFootNote(lay); @@ -2134,7 +2137,8 @@ void PreferencesPopup::onImport() { DVGui::warning("Failed to process Settings.\nCould not find " + srcDir.getQString()); else { - QString origFfmpegPath = Preferences::instance()->getFfmpegPath(); + QString origFfmpegPath = Preferences::instance()->getFfmpegPath(); + QString origRhubarbPath = Preferences::instance()->getRhubarbPath(); QFileInfoList fil = QDir(toQString(srcDir)).entryInfoList(); int i; @@ -2155,6 +2159,7 @@ void PreferencesPopup::onImport() { // it to find it again otherwise it will point to old location Preferences::instance()->load(); Preferences::instance()->setValue(ffmpegPath, origFfmpegPath); + Preferences::instance()->setValue(rhubarbPath, origRhubarbPath); } if (useLegacy) { diff --git a/toonz/sources/toonzlib/preferences.cpp b/toonz/sources/toonzlib/preferences.cpp index 23717563..293be7a1 100644 --- a/toonz/sources/toonzlib/preferences.cpp +++ b/toonz/sources/toonzlib/preferences.cpp @@ -449,6 +449,7 @@ void Preferences::definePreferenceItems() { define(ffmpegTimeout, "ffmpegTimeout", QMetaType::Int, 600, 1, std::numeric_limits::max()); define(fastRenderPath, "fastRenderPath", QMetaType::QString, "desktop"); + define(rhubarbPath, "rhubarbPath", QMetaType::QString, ""); // Drawing define(scanLevelType, "scanLevelType", QMetaType::QString, "tif"); From 2d8998c1e68833dd679f8cb52974291b69b87e78 Mon Sep 17 00:00:00 2001 From: manongjohn Date: Sat, 13 Mar 2021 17:42:58 -0500 Subject: [PATCH 02/21] Update to autoset and use Rhubarb Path Preference setting --- toonz/sources/common/tsystem/tsystem.cpp | 12 ++++ toonz/sources/include/tsystem.h | 2 + toonz/sources/toonz/lipsyncpopup.cpp | 83 +++++++++++++----------- toonz/sources/toonz/lipsyncpopup.h | 3 +- 4 files changed, 62 insertions(+), 38 deletions(-) diff --git a/toonz/sources/common/tsystem/tsystem.cpp b/toonz/sources/common/tsystem/tsystem.cpp index 6f6f7554..ade28df2 100644 --- a/toonz/sources/common/tsystem/tsystem.cpp +++ b/toonz/sources/common/tsystem/tsystem.cpp @@ -1044,6 +1044,18 @@ bool TSystem::showDocument(const TFilePath &path) { #endif } +QString TSystem::findFileLocation(QStringList folderList, QString fileName) { + if (folderList.isEmpty()) return ""; + + QStringList::iterator it; + for (it = folderList.begin(); it != folderList.end(); it++) { + QString path = *it + "/" + fileName; + if (TSystem::doesExistFileOrLevel(TFilePath(path))) return *it; + } + + return ""; +} + #else #include diff --git a/toonz/sources/include/tsystem.h b/toonz/sources/include/tsystem.h index 58fde0d1..2a111b11 100644 --- a/toonz/sources/include/tsystem.h +++ b/toonz/sources/include/tsystem.h @@ -263,6 +263,8 @@ DVAPI TFilePath toLocalPath(const TFilePath &fp); DVAPI bool showDocument(const TFilePath &fp); +DVAPI QString findFileLocation(QStringList folderList, QString fileName); + #ifndef TNZCORE_LIGHT DVAPI QDateTime getFileTime(const TFilePath &path); DVAPI QString getHostName(); diff --git a/toonz/sources/toonz/lipsyncpopup.cpp b/toonz/sources/toonz/lipsyncpopup.cpp index e57d4a67..5d692171 100644 --- a/toonz/sources/toonz/lipsyncpopup.cpp +++ b/toonz/sources/toonz/lipsyncpopup.cpp @@ -433,7 +433,7 @@ LipSyncPopup::LipSyncPopup() QHBoxLayout *optionsLay = new QHBoxLayout(this); optionsLay->setMargin(10); optionsLay->setSpacing(15); - QHBoxLayout* insertAtLay = new QHBoxLayout(this); + QHBoxLayout *insertAtLay = new QHBoxLayout(this); insertAtLay->setMargin(0); insertAtLay->setSpacing(4); m_insertAtLabel = new QLabel(tr("Insert at Frame: ")); @@ -477,6 +477,8 @@ LipSyncPopup::LipSyncPopup() SLOT(setPage(int))); assert(ret); + + m_rhubarbPath = ""; } //----------------------------------------------------------------------------- @@ -515,6 +517,9 @@ void LipSyncPopup::showEvent(QShowEvent *) { m_isEditingLevel = app->getCurrentFrame()->isEditingLevel(); m_startAt->setValue(row + 1); m_startAt->clearFocus(); + + if (checkRhubarb()) m_rhubarbPath = Preferences::instance()->getRhubarbPath(); + TXshLevelHandle *level = app->getCurrentLevel(); m_sl = level->getSimpleLevel(); if (!m_sl) { @@ -548,7 +553,6 @@ void LipSyncPopup::showEvent(QShowEvent *) { } refreshSoundLevels(); onLevelChanged(-1); - findRhubarb(); } //----------------------------------------------------------------------------- @@ -686,53 +690,47 @@ void LipSyncPopup::saveAudio() { //----------------------------------------------------------------------------- -QString LipSyncPopup::findRhubarb() { - QString path = QDir::currentPath() + "/rhubarb/rhubarb"; - bool found = false; +bool LipSyncPopup::checkRhubarb() { + QString exe = "rhubarb"; #if defined(_WIN32) - path = path + ".exe"; + exe = exe + ".exe"; #endif + // check the user defined path in preferences first + QString path = Preferences::instance()->getRhubarbPath() + "/" + exe; + if (TSystem::doesExistFileOrLevel(TFilePath(path))) return true; + + // Let's try and autodetect the exe included with release + QStringList folderList; + + folderList.append("."); + folderList.append("./rhubarb"); // rhubarb folder + #ifdef MACOSX - path = QDir::currentPath() + "/" + - QString::fromStdString(TEnv::getApplicationFileName()) + - ".app/rhubarb/rhubarb"; - if (TSystem::doesExistFileOrLevel(TFilePath(path))) { - found = true; - } - + // Look inside app + folderList.append("./" + + QString::fromStdString(TEnv::getApplicationFileName()) + + ".app/rhubarb"); // rhubarb folder +#elif defined LINUX + // Need to account for symbolic links + folderList.append(TEnv::getWorkingDirectory().getQString() + + "/rhubarb"); // rhubarb folder #endif - std::string sPath = path.toStdString(); - if (!found && TSystem::doesExistFileOrLevel(TFilePath(path))) { - found = true; + QString exePath = TSystem::findFileLocation(folderList, exe); + + if (!exePath.isEmpty()) { + Preferences::instance()->setValue(rhubarbPath, exePath); + return true; } - if (found) { - m_tabBarContainer->show(); - if (m_tabBar->currentIndex() != m_stackedChooser->currentIndex()) - m_tabBar->setCurrentIndex(m_stackedChooser->currentIndex()); - int index = m_soundLevels->currentIndex(); - int count = m_soundLevels->count(); - if (index == count - 1) { - m_audioFile->show(); - } else { - m_audioFile->hide(); - } - setPage(m_stackedChooser->currentIndex()); - return path; - } else { - m_tabBarContainer->hide(); - setPage(1); - return QString(""); - } + // give up + return false; } //----------------------------------------------------------------------------- void LipSyncPopup::runRhubarb() { - QString path = findRhubarb(); - QString cacheRoot = ToonzFolder::getCacheRootFolder().getQString(); if (!TSystem::doesExistFileOrLevel(TFilePath(cacheRoot + "/rhubarb"))) { TSystem::mkDir(TFilePath(cacheRoot + "/rhubarb")); @@ -772,7 +770,12 @@ void LipSyncPopup::runRhubarb() { m_progressDialog->show(); connect(m_rhubarb, &QProcess::readyReadStandardError, this, &LipSyncPopup::onOutputReady); - m_rhubarb->start(path, args); + + QString rhubarbExe = m_rhubarbPath + "/rhubarb"; +#ifdef _WIN32 + rhubarbExe = rhubarbExe + ".exe"; +#endif + m_rhubarb->start(rhubarbExe, args); } //----------------------------------------------------------------------------- @@ -811,6 +814,12 @@ void LipSyncPopup::onApplyButton() { if (m_stackedChooser->currentIndex() == 0) { bool hasAudio = setAudioFile(); if (!hasAudio) return; + if (m_rhubarbPath.isEmpty() || m_rhubarbPath.isNull()) { + DVGui::warning( + tr("Rhubarb not found, please set the location in Preferences and " + "restart.")); + return; + } runRhubarb(); m_rhubarb->waitForFinished(); m_progressDialog->hide(); diff --git a/toonz/sources/toonz/lipsyncpopup.h b/toonz/sources/toonz/lipsyncpopup.h index ecf7df5e..406e04c0 100644 --- a/toonz/sources/toonz/lipsyncpopup.h +++ b/toonz/sources/toonz/lipsyncpopup.h @@ -78,6 +78,7 @@ class LipSyncPopup final : public DVGui::Dialog { bool m_deleteFile = false; DVGui::ProgressDialog *m_progressDialog; QProcess *m_rhubarb; + QString m_rhubarbPath; QFrame *m_audioFrame; QFrame *m_dataFrame; QStackedWidget *m_stackedChooser; @@ -93,7 +94,7 @@ protected: void refreshSoundLevels(); void saveAudio(); void runRhubarb(); - QString findRhubarb(); + bool checkRhubarb(); public slots: void onApplyButton(); From 9776462747fcd5e09cb92dac8d740642e5eae1a4 Mon Sep 17 00:00:00 2001 From: manongjohn Date: Sat, 13 Mar 2021 17:56:42 -0500 Subject: [PATCH 03/21] Display rhubarb processing errors in popup --- toonz/sources/toonz/lipsyncpopup.cpp | 31 ++++++++++++++++++---------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/toonz/sources/toonz/lipsyncpopup.cpp b/toonz/sources/toonz/lipsyncpopup.cpp index 5d692171..7a8d7d10 100644 --- a/toonz/sources/toonz/lipsyncpopup.cpp +++ b/toonz/sources/toonz/lipsyncpopup.cpp @@ -781,11 +781,24 @@ void LipSyncPopup::runRhubarb() { //----------------------------------------------------------------------------- void LipSyncPopup::onOutputReady() { - QString output = m_rhubarb->readAllStandardError().simplified(); - int index = output.lastIndexOf("%"); - QString newString = output.mid(index - 2, 2); - m_progressDialog->setValue(newString.toInt()); - qDebug() << "output: " << output; + QString output = m_rhubarb->readAllStandardError().simplified(); + output = output.replace("\\n", "\n") + .replace("\\\\", "\\") + .replace("\\\"", "") + .replace("\"", ""); + QStringList outputList = + output.mid(2, (output.size() - 4)).split(", ", QString::SkipEmptyParts); + if (outputList.size()) { + QStringList outputType = outputList.at(0).split(": "); + if (outputType.at(1) == "progress") { + QStringList outputValue = outputList.at(1).split(": "); + double progress = outputValue.at(1).toDouble() * 100.0; + m_progressDialog->setValue(progress); + } else if (outputType.at(1) == "failure") { + QStringList outputReason = outputList.at(1).split(": "); + DVGui::warning(tr("Rhubarb Processing Error:\n\n") + outputReason.at(1)); + } + } } //----------------------------------------------------------------------------- @@ -829,12 +842,8 @@ void LipSyncPopup::onApplyButton() { int exitCode = -1; if (m_rhubarb->exitStatus() == QProcess::NormalExit) { exitCode = m_rhubarb->exitCode(); - if (exitCode != 0) { - DVGui::warning( - tr("An error occurred processing the audio. Please check the audio " - "and try again.")); - return; - } + // onOuputReady will handle displaying any error messages from rhubarb + if (exitCode != 0) return; } std::string strResults = results.toStdString(); m_startAt->setValue(std::max(1, m_startFrame)); From 2c3d3bf045d2d98bc0d9ee46adda5bcf562c4979 Mon Sep 17 00:00:00 2001 From: manongjohn Date: Sat, 13 Mar 2021 18:39:35 -0500 Subject: [PATCH 04/21] Update autoset ffmpeg path --- toonz/sources/image/ffmpeg/tiio_ffmpeg.cpp | 101 +++++++++------------ 1 file changed, 45 insertions(+), 56 deletions(-) diff --git a/toonz/sources/image/ffmpeg/tiio_ffmpeg.cpp b/toonz/sources/image/ffmpeg/tiio_ffmpeg.cpp index 78adb79d..2fcf4361 100644 --- a/toonz/sources/image/ffmpeg/tiio_ffmpeg.cpp +++ b/toonz/sources/image/ffmpeg/tiio_ffmpeg.cpp @@ -21,87 +21,76 @@ Ffmpeg::Ffmpeg() { Ffmpeg::~Ffmpeg() {} bool Ffmpeg::checkFfmpeg() { - // check the user defined path in preferences first - QString path = Preferences::instance()->getFfmpegPath() + "/ffmpeg"; + QString exe = "ffmpeg"; #if defined(_WIN32) - path = path + ".exe"; + exe = exe + ".exe"; #endif + + // check the user defined path in preferences first + QString path = Preferences::instance()->getFfmpegPath() + "/" + exe; if (TSystem::doesExistFileOrLevel(TFilePath(path))) return true; - // check the Tahoma root directory next - path = QDir::currentPath() + "/ffmpeg"; -#if defined(_WIN32) - path = path + ".exe"; -#endif - if (TSystem::doesExistFileOrLevel(TFilePath(path))) { - Preferences::instance()->setValue(ffmpegPath, QDir::currentPath()); - return true; - } + // Let's try and autodetect the exe included with release + QStringList folderList; + + folderList.append("."); + folderList.append("./ffmpeg"); // ffmpeg folder #ifdef MACOSX - path = QDir::currentPath() + "/" + - QString::fromStdString(TEnv::getApplicationFileName()) + - ".app/ffmpeg/ffmpeg"; - if (TSystem::doesExistFileOrLevel(TFilePath(path))) { - Preferences::instance()->setValue( - ffmpegPath, QDir::currentPath() + "/" + - QString::fromStdString(TEnv::getApplicationFileName()) + - ".app/ffmpeg/"); - return true; - } + // Look inside app + folderList.append("./" + + QString::fromStdString(TEnv::getApplicationFileName()) + + ".app/ffmpeg"); // ffmpeg folder +#elif defined LINUX + // Need to account for symbolic links + folderList.append(TEnv::getWorkingDirectory().getQString() + + "/ffmpeg"); // ffmpeg folder #endif -#ifdef LINUX - QString currentPath = TEnv::getWorkingDirectory().getQString(); - path = currentPath + "/ffmpeg/ffmpeg"; - if (TSystem::doesExistFileOrLevel(TFilePath(path))) { - Preferences::instance()->setValue(ffmpegPath, currentPath + "/ffmpeg/"); + QString exePath = TSystem::findFileLocation(folderList, exe); + + if (!exePath.isEmpty()) { + Preferences::instance()->setValue(ffmpegPath, exePath); return true; } -#endif + // give up return false; } bool Ffmpeg::checkFfprobe() { - // check the user defined path in preferences first - QString path = Preferences::instance()->getFfmpegPath() + "/ffprobe"; + QString exe = "ffprobe"; #if defined(_WIN32) - path = path + ".exe"; + exe = exe + ".exe"; #endif + + // check the user defined path in preferences first + QString path = Preferences::instance()->getFfmpegPath() + "/" + exe; if (TSystem::doesExistFileOrLevel(TFilePath(path))) return true; - // check the Tahoma root directory next - path = QDir::currentPath() + "/ffprobe"; -#if defined(_WIN32) - path = path + ".exe"; -#endif - if (TSystem::doesExistFileOrLevel(TFilePath(path))) { - Preferences::instance()->setValue(ffmpegPath, QDir::currentPath()); - return true; - } + // Let's try and autodetect the exe included with release + QStringList folderList; + + folderList.append("."); + folderList.append("./ffmpeg"); // ffmpeg folder #ifdef MACOSX - path = QDir::currentPath() + "/" + - QString::fromStdString(TEnv::getApplicationFileName()) + - ".app/ffmpeg/ffprobe"; - if (TSystem::doesExistFileOrLevel(TFilePath(path))) { - Preferences::instance()->setValue( - ffmpegPath, QDir::currentPath() + "/" + - QString::fromStdString(TEnv::getApplicationFileName()) + - ".app/ffmpeg/"); - return true; - } + // Look inside app + folderList.append("./" + + QString::fromStdString(TEnv::getApplicationFileName()) + + ".app/ffmpeg"); // ffmpeg folder +#elif defined LINUX + // Need to account for symbolic links + folderList.append(TEnv::getWorkingDirectory().getQString() + + "/ffmpeg"); // ffmpeg folder #endif -#ifdef LINUX - QString currentPath = TEnv::getWorkingDirectory().getQString(); - path = currentPath + "/ffmpeg/ffprobe"; - if (TSystem::doesExistFileOrLevel(TFilePath(path))) { - Preferences::instance()->setValue(ffmpegPath, currentPath + "/ffmpeg/"); + QString exePath = TSystem::findFileLocation(folderList, exe); + + if (!exePath.isEmpty()) { + Preferences::instance()->setValue(ffmpegPath, exePath); return true; } -#endif // give up return false; From 623b42d13923fb74c7ea5806d35002b8352f626d Mon Sep 17 00:00:00 2001 From: manongjohn Date: Sat, 13 Mar 2021 18:48:08 -0500 Subject: [PATCH 05/21] Add Rhubarb Lip Sync license --- stuff/doc/LICENSE/LICENSE_rhubarb.txt | 9 +++++++++ stuff/doc/LICENSE/LICENSE_rhubarb_info.txt | 7 +++++++ 2 files changed, 16 insertions(+) create mode 100644 stuff/doc/LICENSE/LICENSE_rhubarb.txt create mode 100644 stuff/doc/LICENSE/LICENSE_rhubarb_info.txt diff --git a/stuff/doc/LICENSE/LICENSE_rhubarb.txt b/stuff/doc/LICENSE/LICENSE_rhubarb.txt new file mode 100644 index 00000000..45a7f297 --- /dev/null +++ b/stuff/doc/LICENSE/LICENSE_rhubarb.txt @@ -0,0 +1,9 @@ +Rhubarb Lip Sync is released under the MIT License (MIT). + +Copyright (c) 2015-2016 Daniel Wolf + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/stuff/doc/LICENSE/LICENSE_rhubarb_info.txt b/stuff/doc/LICENSE/LICENSE_rhubarb_info.txt new file mode 100644 index 00000000..7c6d696c --- /dev/null +++ b/stuff/doc/LICENSE/LICENSE_rhubarb_info.txt @@ -0,0 +1,7 @@ +Tahoma2D ships with Rhubarb Lip Sync, and uses Rhubarb Lip Sync through command line commands. +Tahoma2D does not directly use Rhubarb Lip Sync libraries or code. + +Rhubarb Lip Sync source code can be found at: +https://github.com/tahoma2d/rhubarb-lip-sync +or +https://github.com/DanielSWolf/rhubarb-lip-sync From f93095dbf51b362819211e8e351e9600847cd8b7 Mon Sep 17 00:00:00 2001 From: manongjohn Date: Sat, 13 Mar 2021 18:50:23 -0500 Subject: [PATCH 06/21] Update Rhubarb label in preferences --- toonz/sources/toonz/preferencespopup.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toonz/sources/toonz/preferencespopup.cpp b/toonz/sources/toonz/preferencespopup.cpp index 14edb6be..db482e43 100644 --- a/toonz/sources/toonz/preferencespopup.cpp +++ b/toonz/sources/toonz/preferencespopup.cpp @@ -1640,7 +1640,7 @@ QWidget* PreferencesPopup::createImportExportPage() { insertUI(fastRenderPath, ffmpegOptionsLay); } - QGridLayout* rhubarbOptionsLay = insertGroupBox(tr("Rhubarb"), lay); + QGridLayout* rhubarbOptionsLay = insertGroupBox(tr("Rhubarb Lip Sync"), lay); { insertUI(rhubarbPath, rhubarbOptionsLay); } lay->setRowStretch(lay->rowCount(), 1); From ea81bcd94a555369f275fdf461d13c60808605b8 Mon Sep 17 00:00:00 2001 From: manongjohn Date: Sun, 14 Mar 2021 14:04:05 -0400 Subject: [PATCH 07/21] Update package scripts to include Rhubarb --- ci-scripts/linux/tahoma-buildpkg.sh | 10 ++++++++++ ci-scripts/osx/tahoma-buildpkg.sh | 11 +++++++++++ 2 files changed, 21 insertions(+) diff --git a/ci-scripts/linux/tahoma-buildpkg.sh b/ci-scripts/linux/tahoma-buildpkg.sh index 2bc5c54c..ca8fbeb2 100755 --- a/ci-scripts/linux/tahoma-buildpkg.sh +++ b/ci-scripts/linux/tahoma-buildpkg.sh @@ -45,6 +45,16 @@ then cp -R ../../thirdparty/ffmpeg/bin Tahoma2D/ffmpeg fi +if [ -d ../../thirdparty/rhubarb ] +then + echo ">>> Copying Rhubarb Lip Sync to Tahoma2D/rhubarb" + if [ -d Tahoma2D/rhubarb ] + then + rm -rf Tahoma2D/rhubarb + fi + cp -R ../../thirdparty/rhubarb Tahoma2D/rhubarb +fi + echo ">>> Creating Tahoma2D/Tahoma2D.AppImage" if [ ! -f linuxdeployqt*.AppImage ] diff --git a/ci-scripts/osx/tahoma-buildpkg.sh b/ci-scripts/osx/tahoma-buildpkg.sh index 09378833..a2a3a849 100755 --- a/ci-scripts/osx/tahoma-buildpkg.sh +++ b/ci-scripts/osx/tahoma-buildpkg.sh @@ -33,6 +33,17 @@ then cp -R thirdparty/ffmpeg/bin $TOONZDIR/Tahoma2D.app/ffmpeg fi +if [ -d thirdparty/rhubarb ] +then + echo ">>> Copying Rhubarb Lip Sync to $TOONZDIR/Tahoma2D.app/rhubarb" + if [ -d $TOONZDIR/Tahoma2D.app/rhubarb ] + then + # In case of prior builds, replace rhubarb folder + rm -rf $TOONZDIR/Tahoma2D.app/rhubarb + fi + cp -R thirdparty/rhubarb $TOONZDIR/Tahoma2D.app/rhubarb +fi + if [ -d thirdparty/canon/Framework ] then echo ">>> Copying canon framework to $TOONZDIR/Tahoma2D.app/Contents/Frameworks/EDSDK.Framework" From b66677a30913c2aef340942e87afc192076acb97 Mon Sep 17 00:00:00 2001 From: manongjohn Date: Sun, 14 Mar 2021 18:18:58 -0400 Subject: [PATCH 08/21] Add Rhubarb timeout Preference --- toonz/sources/include/toonz/preferences.h | 1 + toonz/sources/include/toonz/preferencesitemids.h | 1 + toonz/sources/toonz/lipsyncpopup.cpp | 4 +++- toonz/sources/toonz/preferencespopup.cpp | 6 +++++- toonz/sources/toonzlib/preferences.cpp | 2 ++ 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/toonz/sources/include/toonz/preferences.h b/toonz/sources/include/toonz/preferences.h index 1fae2761..ab4e48af 100644 --- a/toonz/sources/include/toonz/preferences.h +++ b/toonz/sources/include/toonz/preferences.h @@ -283,6 +283,7 @@ public: int getFfmpegTimeout() { return getIntValue(ffmpegTimeout); } QString getFastRenderPath() const { return getStringValue(fastRenderPath); } QString getRhubarbPath() const { return getStringValue(rhubarbPath); } + int getRhubarbTimeout() { return getIntValue(rhubarbTimeout); } // Drawing tab QString getScanLevelType() const { return getStringValue(scanLevelType); } diff --git a/toonz/sources/include/toonz/preferencesitemids.h b/toonz/sources/include/toonz/preferencesitemids.h index f8fe3229..1b82e34a 100644 --- a/toonz/sources/include/toonz/preferencesitemids.h +++ b/toonz/sources/include/toonz/preferencesitemids.h @@ -75,6 +75,7 @@ enum PreferencesItemId { ffmpegTimeout, fastRenderPath, rhubarbPath, + rhubarbTimeout, //---------- // Drawing diff --git a/toonz/sources/toonz/lipsyncpopup.cpp b/toonz/sources/toonz/lipsyncpopup.cpp index 7a8d7d10..a1503b79 100644 --- a/toonz/sources/toonz/lipsyncpopup.cpp +++ b/toonz/sources/toonz/lipsyncpopup.cpp @@ -834,7 +834,9 @@ void LipSyncPopup::onApplyButton() { return; } runRhubarb(); - m_rhubarb->waitForFinished(); + int rhubarbTimeout = Preferences::instance()->getRhubarbTimeout(); + if (rhubarbTimeout > 0) rhubarbTimeout * 1000; + m_rhubarb->waitForFinished(rhubarbTimeout); m_progressDialog->hide(); QString results = m_rhubarb->readAllStandardError(); results += m_rhubarb->readAllStandardOutput(); diff --git a/toonz/sources/toonz/preferencespopup.cpp b/toonz/sources/toonz/preferencespopup.cpp index db482e43..44897f30 100644 --- a/toonz/sources/toonz/preferencespopup.cpp +++ b/toonz/sources/toonz/preferencespopup.cpp @@ -1046,6 +1046,7 @@ QString PreferencesPopup::getUIString(PreferencesItemId id) { {ffmpegTimeout, tr("Process Timeout:")}, {fastRenderPath, tr("Fast Render Output Directory:")}, {rhubarbPath, tr("Executable Directory:")}, + {rhubarbTimeout, tr("Analyze Audio Timeout (sec; -1 = no timeout):") }, // Drawing {scanLevelType, tr("Scan File Format:")}, @@ -1641,7 +1642,10 @@ QWidget* PreferencesPopup::createImportExportPage() { } QGridLayout* rhubarbOptionsLay = insertGroupBox(tr("Rhubarb Lip Sync"), lay); - { insertUI(rhubarbPath, rhubarbOptionsLay); } + { + insertUI(rhubarbPath, rhubarbOptionsLay); + insertUI(rhubarbTimeout, rhubarbOptionsLay); + } lay->setRowStretch(lay->rowCount(), 1); insertFootNote(lay); diff --git a/toonz/sources/toonzlib/preferences.cpp b/toonz/sources/toonzlib/preferences.cpp index 293be7a1..79d66b62 100644 --- a/toonz/sources/toonzlib/preferences.cpp +++ b/toonz/sources/toonzlib/preferences.cpp @@ -450,6 +450,8 @@ void Preferences::definePreferenceItems() { std::numeric_limits::max()); define(fastRenderPath, "fastRenderPath", QMetaType::QString, "desktop"); define(rhubarbPath, "rhubarbPath", QMetaType::QString, ""); + define(rhubarbTimeout, "rhubarbTimeout", QMetaType::Int, -1, -1, + std::numeric_limits::max()); // Drawing define(scanLevelType, "scanLevelType", QMetaType::QString, "tif"); From fc25fe3b337315a61e950651e6843e72f465bfc5 Mon Sep 17 00:00:00 2001 From: manongjohn Date: Sun, 14 Mar 2021 18:19:57 -0400 Subject: [PATCH 09/21] Allow -1 ffmpeg timeout --- toonz/sources/image/ffmpeg/tiio_ffmpeg.cpp | 5 +++-- toonz/sources/toonzlib/preferences.cpp | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/toonz/sources/image/ffmpeg/tiio_ffmpeg.cpp b/toonz/sources/image/ffmpeg/tiio_ffmpeg.cpp index 2fcf4361..0713b53a 100644 --- a/toonz/sources/image/ffmpeg/tiio_ffmpeg.cpp +++ b/toonz/sources/image/ffmpeg/tiio_ffmpeg.cpp @@ -13,8 +13,9 @@ #include "tmsgcore.h" Ffmpeg::Ffmpeg() { - m_ffmpegPath = Preferences::instance()->getFfmpegPath(); - m_ffmpegTimeout = Preferences::instance()->getFfmpegTimeout() * 1000; + m_ffmpegPath = Preferences::instance()->getFfmpegPath(); + m_ffmpegTimeout = Preferences::instance()->getFfmpegTimeout(); + if (m_ffmpegTimeout > 0) m_ffmpegTimeout * 1000; std::string strPath = m_ffmpegPath.toStdString(); m_intermediateFormat = "png"; } diff --git a/toonz/sources/toonzlib/preferences.cpp b/toonz/sources/toonzlib/preferences.cpp index 79d66b62..fc3c98af 100644 --- a/toonz/sources/toonzlib/preferences.cpp +++ b/toonz/sources/toonzlib/preferences.cpp @@ -446,7 +446,7 @@ void Preferences::definePreferenceItems() { // Import / Export define(ffmpegPath, "ffmpegPath", QMetaType::QString, ""); - define(ffmpegTimeout, "ffmpegTimeout", QMetaType::Int, 600, 1, + define(ffmpegTimeout, "ffmpegTimeout", QMetaType::Int, -1, -1, std::numeric_limits::max()); define(fastRenderPath, "fastRenderPath", QMetaType::QString, "desktop"); define(rhubarbPath, "rhubarbPath", QMetaType::QString, ""); From c9f33d20e74227b0d93a65809acdcfe1a5a2045c Mon Sep 17 00:00:00 2001 From: manongjohn Date: Sun, 14 Mar 2021 18:20:27 -0400 Subject: [PATCH 10/21] Update ffmpeg Preference wording --- toonz/sources/toonz/preferencespopup.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/toonz/sources/toonz/preferencespopup.cpp b/toonz/sources/toonz/preferencespopup.cpp index 44897f30..2c041a64 100644 --- a/toonz/sources/toonz/preferencespopup.cpp +++ b/toonz/sources/toonz/preferencespopup.cpp @@ -1043,7 +1043,7 @@ QString PreferencesPopup::getUIString(PreferencesItemId id) { // Import / Export {ffmpegPath, tr("Executable Directory:")}, - {ffmpegTimeout, tr("Process Timeout:")}, + {ffmpegTimeout, tr("Import/Export Timeout (sec; -1 = no timeout):")}, {fastRenderPath, tr("Fast Render Output Directory:")}, {rhubarbPath, tr("Executable Directory:")}, {rhubarbTimeout, tr("Analyze Audio Timeout (sec; -1 = no timeout):") }, @@ -1628,14 +1628,6 @@ QWidget* PreferencesPopup::createImportExportPage() { QGridLayout* ffmpegOptionsLay = insertGroupBox(tr("FFmpeg"), lay); { insertUI(ffmpegPath, ffmpegOptionsLay); - - putLabel( - tr("Number of seconds to wait for FFmpeg to complete processing the " - "output:"), - ffmpegOptionsLay); - putLabel( - tr("Note: FFmpeg begins working once all images have been processed."), - ffmpegOptionsLay); insertUI(ffmpegTimeout, ffmpegOptionsLay); insertUI(fastRenderPath, ffmpegOptionsLay); From 7a80c7c8791a1cb9aa378e4a910ea0a706987787 Mon Sep 17 00:00:00 2001 From: manongjohn Date: Sun, 14 Mar 2021 18:26:50 -0400 Subject: [PATCH 11/21] Move Fast Render Output Preference to Saving page --- toonz/sources/toonz/preferencespopup.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/toonz/sources/toonz/preferencespopup.cpp b/toonz/sources/toonz/preferencespopup.cpp index 2c041a64..6b14e6a2 100644 --- a/toonz/sources/toonz/preferencespopup.cpp +++ b/toonz/sources/toonz/preferencespopup.cpp @@ -1605,6 +1605,8 @@ QWidget* PreferencesPopup::createSavingPage() { insertUI(resetUndoOnSavingLevel, lay); insertUI(doNotShowPopupSaveScene, lay); + insertUI(fastRenderPath, lay); + lay->setRowStretch(lay->rowCount(), 1); widget->setLayout(lay); return widget; @@ -1629,8 +1631,6 @@ QWidget* PreferencesPopup::createImportExportPage() { { insertUI(ffmpegPath, ffmpegOptionsLay); insertUI(ffmpegTimeout, ffmpegOptionsLay); - - insertUI(fastRenderPath, ffmpegOptionsLay); } QGridLayout* rhubarbOptionsLay = insertGroupBox(tr("Rhubarb Lip Sync"), lay); From 0ff1308561772723dec3f38e16cdb3066a77fb22 Mon Sep 17 00:00:00 2001 From: manongjohn Date: Sun, 14 Mar 2021 18:45:17 -0400 Subject: [PATCH 12/21] Relabel Preference "Import/Export" to "3rd Party Apps" --- toonz/sources/toonz/preferencespopup.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toonz/sources/toonz/preferencespopup.cpp b/toonz/sources/toonz/preferencespopup.cpp index 6b14e6a2..b68a470e 100644 --- a/toonz/sources/toonz/preferencespopup.cpp +++ b/toonz/sources/toonz/preferencespopup.cpp @@ -1271,7 +1271,7 @@ PreferencesPopup::PreferencesPopup() m_categoryList = new QListWidget(this); QStringList categories; categories << tr("General") << tr("Interface") << tr("Visualization") - << tr("Loading") << tr("Saving") << tr("Import/Export") + << tr("Loading") << tr("Saving") << tr("3rd Party Apps") << tr("Drawing") << tr("Tools") << tr("Scene") << tr("Animation") << tr("Preview") << tr("Onion Skin") << tr("Colors") << tr("Version Control") << tr("Touch/Tablet Settings"); From 4442f02561ddf5040fd30d95ee97d16202221b14 Mon Sep 17 00:00:00 2001 From: manongjohn Date: Sun, 14 Mar 2021 21:37:44 -0400 Subject: [PATCH 13/21] Fix findFileLocation to ignore directories with matching name --- toonz/sources/common/tsystem/tsystem.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/toonz/sources/common/tsystem/tsystem.cpp b/toonz/sources/common/tsystem/tsystem.cpp index ade28df2..1baa5e1e 100644 --- a/toonz/sources/common/tsystem/tsystem.cpp +++ b/toonz/sources/common/tsystem/tsystem.cpp @@ -1050,7 +1050,9 @@ QString TSystem::findFileLocation(QStringList folderList, QString fileName) { QStringList::iterator it; for (it = folderList.begin(); it != folderList.end(); it++) { QString path = *it + "/" + fileName; - if (TSystem::doesExistFileOrLevel(TFilePath(path))) return *it; + TFilePath fp(path); + if (TSystem::doesExistFileOrLevel(fp) && !TFileStatus(fp).isDirectory()) + return *it; } return ""; From 1a97781e8c335dbf0b344bb0adfd23e5bdedeff6 Mon Sep 17 00:00:00 2001 From: manongjohn Date: Mon, 15 Mar 2021 18:17:06 -0400 Subject: [PATCH 14/21] Disable timeouts with 0 values --- toonz/sources/image/ffmpeg/tiio_ffmpeg.cpp | 5 ++++- toonz/sources/image/ffmpeg/tiio_ffmpeg.h | 2 +- toonz/sources/toonz/lipsyncpopup.cpp | 5 ++++- toonz/sources/toonz/preferencespopup.cpp | 6 +++--- toonz/sources/toonzlib/preferences.cpp | 6 +++--- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/toonz/sources/image/ffmpeg/tiio_ffmpeg.cpp b/toonz/sources/image/ffmpeg/tiio_ffmpeg.cpp index 0713b53a..cfca9854 100644 --- a/toonz/sources/image/ffmpeg/tiio_ffmpeg.cpp +++ b/toonz/sources/image/ffmpeg/tiio_ffmpeg.cpp @@ -15,7 +15,10 @@ Ffmpeg::Ffmpeg() { m_ffmpegPath = Preferences::instance()->getFfmpegPath(); m_ffmpegTimeout = Preferences::instance()->getFfmpegTimeout(); - if (m_ffmpegTimeout > 0) m_ffmpegTimeout * 1000; + if (m_ffmpegTimeout > 0) + m_ffmpegTimeout * 1000; + else + m_ffmpegTimeout = -1; std::string strPath = m_ffmpegPath.toStdString(); m_intermediateFormat = "png"; } diff --git a/toonz/sources/image/ffmpeg/tiio_ffmpeg.h b/toonz/sources/image/ffmpeg/tiio_ffmpeg.h index 88747db0..67248aa5 100644 --- a/toonz/sources/image/ffmpeg/tiio_ffmpeg.h +++ b/toonz/sources/image/ffmpeg/tiio_ffmpeg.h @@ -46,7 +46,7 @@ public: private: QString m_intermediateFormat, m_ffmpegPath, m_audioPath, m_audioFormat; int m_frameCount = 0, m_lx, m_ly, m_bpp, m_bitsPerSample, m_channelCount, - m_ffmpegTimeout = 30000, m_frameNumberOffset = -1; + m_ffmpegTimeout = -1, m_frameNumberOffset = -1; double m_frameRate = 24.0; bool m_ffmpegExists = false, m_ffprobeExists = false, m_hasSoundTrack = false; TFilePath m_path; diff --git a/toonz/sources/toonz/lipsyncpopup.cpp b/toonz/sources/toonz/lipsyncpopup.cpp index a1503b79..70a82881 100644 --- a/toonz/sources/toonz/lipsyncpopup.cpp +++ b/toonz/sources/toonz/lipsyncpopup.cpp @@ -835,7 +835,10 @@ void LipSyncPopup::onApplyButton() { } runRhubarb(); int rhubarbTimeout = Preferences::instance()->getRhubarbTimeout(); - if (rhubarbTimeout > 0) rhubarbTimeout * 1000; + if (rhubarbTimeout > 0) + rhubarbTimeout * 1000; + else + rhubarbTimeout = -1; m_rhubarb->waitForFinished(rhubarbTimeout); m_progressDialog->hide(); QString results = m_rhubarb->readAllStandardError(); diff --git a/toonz/sources/toonz/preferencespopup.cpp b/toonz/sources/toonz/preferencespopup.cpp index b68a470e..d85c28df 100644 --- a/toonz/sources/toonz/preferencespopup.cpp +++ b/toonz/sources/toonz/preferencespopup.cpp @@ -1043,10 +1043,10 @@ QString PreferencesPopup::getUIString(PreferencesItemId id) { // Import / Export {ffmpegPath, tr("Executable Directory:")}, - {ffmpegTimeout, tr("Import/Export Timeout (sec; -1 = no timeout):")}, + {ffmpegTimeout, tr("Import/Export Timeout (seconds):")}, {fastRenderPath, tr("Fast Render Output Directory:")}, {rhubarbPath, tr("Executable Directory:")}, - {rhubarbTimeout, tr("Analyze Audio Timeout (sec; -1 = no timeout):") }, + {rhubarbTimeout, tr("Analyze Audio Timeout (seconds):")}, // Drawing {scanLevelType, tr("Scan File Format:")}, @@ -1635,7 +1635,7 @@ QWidget* PreferencesPopup::createImportExportPage() { QGridLayout* rhubarbOptionsLay = insertGroupBox(tr("Rhubarb Lip Sync"), lay); { - insertUI(rhubarbPath, rhubarbOptionsLay); + insertUI(rhubarbPath, rhubarbOptionsLay); insertUI(rhubarbTimeout, rhubarbOptionsLay); } diff --git a/toonz/sources/toonzlib/preferences.cpp b/toonz/sources/toonzlib/preferences.cpp index fc3c98af..3223d07d 100644 --- a/toonz/sources/toonzlib/preferences.cpp +++ b/toonz/sources/toonzlib/preferences.cpp @@ -446,12 +446,12 @@ void Preferences::definePreferenceItems() { // Import / Export define(ffmpegPath, "ffmpegPath", QMetaType::QString, ""); - define(ffmpegTimeout, "ffmpegTimeout", QMetaType::Int, -1, -1, + define(ffmpegTimeout, "ffmpegTimeout", QMetaType::Int, 0, 0, std::numeric_limits::max()); define(fastRenderPath, "fastRenderPath", QMetaType::QString, "desktop"); define(rhubarbPath, "rhubarbPath", QMetaType::QString, ""); - define(rhubarbTimeout, "rhubarbTimeout", QMetaType::Int, -1, -1, - std::numeric_limits::max()); + define(rhubarbTimeout, "rhubarbTimeout", QMetaType::Int, 0, 0, + std::numeric_limits::max()); // Drawing define(scanLevelType, "scanLevelType", QMetaType::QString, "tif"); From 496d35155686537e5caffa2a141ecc40db881b6e Mon Sep 17 00:00:00 2001 From: manongjohn Date: Sun, 21 Mar 2021 14:40:38 -0400 Subject: [PATCH 15/21] Switch to download and package precompiled 3rd party apps (macOS) --- .github/workflows/macOS_build.yml | 3 ++ ci-scripts/osx/tahoma-buildffmpeg.sh | 37 +----------------------- ci-scripts/osx/tahoma-buildpkg.sh | 11 ++++--- ci-scripts/osx/tahoma-get3rdpartyapps.sh | 20 +++++++++++++ 4 files changed, 31 insertions(+), 40 deletions(-) create mode 100755 ci-scripts/osx/tahoma-get3rdpartyapps.sh diff --git a/.github/workflows/macOS_build.yml b/.github/workflows/macOS_build.yml index 12fd4218..909ea39f 100644 --- a/.github/workflows/macOS_build.yml +++ b/.github/workflows/macOS_build.yml @@ -34,6 +34,9 @@ jobs: run: | export PATH="/usr/local/opt/ccache/libexec:$PATH" ci-scripts/osx/tahoma-build.sh + - name: Get 3rd Party Apps + run: | + ci-scripts/osx/tahoma-get3rdpartyapps.sh - name: Create Package run: bash ./ci-scripts/osx/tahoma-buildpkg.sh - uses: actions/upload-artifact@v1 diff --git a/ci-scripts/osx/tahoma-buildffmpeg.sh b/ci-scripts/osx/tahoma-buildffmpeg.sh index 0b1eeaa9..54d79fee 100755 --- a/ci-scripts/osx/tahoma-buildffmpeg.sh +++ b/ci-scripts/osx/tahoma-buildffmpeg.sh @@ -26,9 +26,8 @@ cd ../.. echo ">>> Cloning ffmpeg" git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg -cp -R ffmpeg ffmpeg_shared -cd ffmpeg_shared +cd ffmpeg echo "*" >| .gitignore echo ">>> Configuring to build ffmpeg (shared)" @@ -73,37 +72,3 @@ make -j7 # runs 7 jobs in parallel echo ">>> Installing ffmpeg (shared)" sudo make install -echo ">>> Configuring to build ffmpeg (static)" -cd ../ffmpeg -echo "*" >| .gitignore - -export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig -export SDKROOT=`xcrun --show-sdk-path` -./configure --prefix=/usr/local \ - --pkg-config-flags="--static" \ - --enable-static \ - --disable-shared \ - --enable-pic \ - --enable-pthreads \ - --enable-version3 \ - --enable-videotoolbox \ - --enable-avresample \ - --enable-libaom \ - --enable-libxml2 \ - --enable-libvpx \ - --disable-ffplay \ - --disable-sdl2 \ - --disable-libjack \ - --disable-libxcb \ - --disable-indev=jack - -echo ">>> Building ffmpeg (static)" -make -j7 # runs 7 jobs in parallel - -echo ">>> Installing to tahoma2d/thirdparty/ffmpeg/bin" -if [ ! -d bin ] -then - mkdir bin -fi - -cp ffmpeg ffprobe bin/ diff --git a/ci-scripts/osx/tahoma-buildpkg.sh b/ci-scripts/osx/tahoma-buildpkg.sh index a2a3a849..152c0b41 100755 --- a/ci-scripts/osx/tahoma-buildpkg.sh +++ b/ci-scripts/osx/tahoma-buildpkg.sh @@ -22,7 +22,7 @@ fi cp -R stuff $TOONZDIR/Tahoma2D.app/tahomastuff chmod -R 777 $TOONZDIR/Tahoma2D.app/tahomastuff -if [ -d thirdparty/ffmpeg/bin ] +if [ -d thirdparty/apps/ffmpeg/bin ] then echo ">>> Copying FFmpeg to $TOONZDIR/Tahoma2D.app/ffmpeg" if [ -d $TOONZDIR/Tahoma2D.app/ffmpeg ] @@ -30,10 +30,11 @@ then # In case of prior builds, replace ffmpeg folder rm -rf $TOONZDIR/Tahoma2D.app/ffmpeg fi - cp -R thirdparty/ffmpeg/bin $TOONZDIR/Tahoma2D.app/ffmpeg + mkdir $TOONZDIR/Tahoma2D.app/ffmpeg + cp -R thirdparty/apps/ffmpeg/bin/ffmpeg thirdparty/apps/ffmpeg/bin/ffprobe $TOONZDIR/Tahoma2D.app/ffmpeg fi -if [ -d thirdparty/rhubarb ] +if [ -d thirdparty/apps/rhubarb ] then echo ">>> Copying Rhubarb Lip Sync to $TOONZDIR/Tahoma2D.app/rhubarb" if [ -d $TOONZDIR/Tahoma2D.app/rhubarb ] @@ -41,7 +42,8 @@ then # In case of prior builds, replace rhubarb folder rm -rf $TOONZDIR/Tahoma2D.app/rhubarb fi - cp -R thirdparty/rhubarb $TOONZDIR/Tahoma2D.app/rhubarb + mkdir $TOONZDIR/Tahoma2D.app/rhubarb + cp -R thirdparty/apps/rhubarb/rhubarb thirdparty/apps/rhubarb/res $TOONZDIR/Tahoma2D.app/rhubarb fi if [ -d thirdparty/canon/Framework ] @@ -88,3 +90,4 @@ echo ">>> Creating Tahoma2D-osx.dmg" $QTDIR/bin/macdeployqt $TOONZDIR/Tahoma2D.app -dmg -verbose=0 mv $TOONZDIR/Tahoma2D.dmg $TOONZDIR/../Tahoma2D-osx.dmg + diff --git a/ci-scripts/osx/tahoma-get3rdpartyapps.sh b/ci-scripts/osx/tahoma-get3rdpartyapps.sh new file mode 100755 index 00000000..c1bd6dc4 --- /dev/null +++ b/ci-scripts/osx/tahoma-get3rdpartyapps.sh @@ -0,0 +1,20 @@ +#!/bin/bash +cd thirdparty + +if [ ! -d apps ] +then + mkdir apps +fi +cd apps +echo "*" >| .gitignore + +echo ">>> Getting FFmpeg" +wget https://github.com/tahoma2d/FFmpeg/releases/download/v4.3.1/ffmpeg-4.3.1-macos64-static-lgpl.zip +unzip ffmpeg-4.3.1-macos64-static-lgpl.zip +mv ffmpeg-4.3.1-macos64-static-lgpl ffmpeg + + +echo ">>> Getting Rhubarb Lip Sync" +wget https://github.com/tahoma2d/rhubarb-lip-sync/releases/download/v1.10.2/rhubarb-lip-sync-tahoma2d-osx.zip +unzip rhubarb-lip-sync-tahoma2d-osx.zip -d rhubarb + From 4f0e4054c660fc38c3ba477a5aa07cdc7625201f Mon Sep 17 00:00:00 2001 From: manongjohn Date: Sun, 21 Mar 2021 20:53:20 -0400 Subject: [PATCH 16/21] Switch to download and package precompiled 3rd party apps (linux) --- .github/workflows/linux_build.yml | 3 ++ ci-scripts/linux/tahoma-buildffmpeg.sh | 59 ++-------------------- ci-scripts/linux/tahoma-buildopencv.sh | 3 +- ci-scripts/linux/tahoma-buildpkg.sh | 10 ++-- ci-scripts/linux/tahoma-get3rdpartyapps.sh | 28 ++++++++++ ci-scripts/linux/tahoma-install.sh | 1 + 6 files changed, 43 insertions(+), 61 deletions(-) create mode 100755 ci-scripts/linux/tahoma-get3rdpartyapps.sh diff --git a/.github/workflows/linux_build.yml b/.github/workflows/linux_build.yml index 88562d67..b071f867 100644 --- a/.github/workflows/linux_build.yml +++ b/.github/workflows/linux_build.yml @@ -48,6 +48,9 @@ jobs: export CC="ccache ${{ matrix.cc }}" export CXX="ccache ${{ matrix.cxx }}" ci-scripts/linux/tahoma-build.sh + - name: Get 3rd Party Apps + run: | + ci-scripts/linux/tahoma-get3rdpartyapps.sh - name: Create Package run: | ci-scripts/linux/tahoma-buildpkg.sh diff --git a/ci-scripts/linux/tahoma-buildffmpeg.sh b/ci-scripts/linux/tahoma-buildffmpeg.sh index ba293bfe..656ed77a 100755 --- a/ci-scripts/linux/tahoma-buildffmpeg.sh +++ b/ci-scripts/linux/tahoma-buildffmpeg.sh @@ -1,3 +1,4 @@ +#!/bin/bash cd thirdparty echo ">>> Cloning openH264" @@ -15,10 +16,9 @@ sudo make install cd .. echo ">>> Cloning ffmpeg" -git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg -cp -R ffmpeg ffmpeg_shared +git clone https://github.com/tahoma2d/ffmpeg ffmpeg -cd ffmpeg_shared +cd ffmpeg echo "*" >| .gitignore echo ">>> Configuring to build ffmpeg (shared)" @@ -65,56 +65,3 @@ echo ">>> Installing ffmpeg (shared)" sudo make install sudo ldconfig - -echo ">>> Configuring to build ffmpeg (static)" -cd ../ffmpeg -echo "*" >| .gitignore - -export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig - -./configure --prefix=/usr/local \ - --cc="$CC" \ - --cxx="$CXX" \ - --pkg-config-flags="--static" \ - --extra-cflags="-I/usr/local/include -static" \ - --extra-ldflags="-L/usr/local/lib -static" \ - --extra-ldexeflags="-static" \ - --enable-static \ - --enable-cross-compile \ - --enable-pic \ - --disable-shared \ - --enable-libopenh264 \ - --enable-pthreads \ - --enable-version3 \ - --enable-avresample \ - --enable-libmp3lame \ - --enable-libopus \ - --enable-libsnappy \ - --enable-libtheora \ - --enable-libvorbis \ - --enable-libvpx \ - --enable-libwebp \ - --enable-lzma \ - --enable-libfreetype \ - --enable-libopencore-amrnb \ - --enable-libopencore-amrwb \ - --enable-libspeex \ - --disable-ffplay \ - --disable-htmlpages \ - --disable-manpages \ - --disable-podpages \ - --disable-txtpages \ - --disable-libjack \ - --disable-indev=jack - -echo ">>> Building ffmpeg (static)" -make - -echo ">>> Installing to tahoma2d/thirdparty/ffmpeg/bin" -if [ ! -d bin ] -then - mkdir bin -fi - -cp ffmpeg ffprobe bin/ - diff --git a/ci-scripts/linux/tahoma-buildopencv.sh b/ci-scripts/linux/tahoma-buildopencv.sh index 7574fac4..08f9fcea 100755 --- a/ci-scripts/linux/tahoma-buildopencv.sh +++ b/ci-scripts/linux/tahoma-buildopencv.sh @@ -1,7 +1,8 @@ +#!/bin/bash cd thirdparty echo ">>> Cloning opencv" -git clone https://github.com/opencv/opencv.git +git clone https://github.com/tahoma2d/opencv cd opencv echo "*" >| .gitignore diff --git a/ci-scripts/linux/tahoma-buildpkg.sh b/ci-scripts/linux/tahoma-buildpkg.sh index ca8fbeb2..b5797677 100755 --- a/ci-scripts/linux/tahoma-buildpkg.sh +++ b/ci-scripts/linux/tahoma-buildpkg.sh @@ -35,24 +35,26 @@ mv appdir/usr/share/tahoma2d/stuff Tahoma2D/tahomastuff chmod -R 777 Tahoma2D/tahomastuff rmdir appdir/usr/share/tahoma2d -if [ -d ../../thirdparty/ffmpeg/bin ] +if [ -d ../../thirdparty/apps/ffmpeg/bin ] then echo ">>> Copying FFmpeg to Tahoma2D/ffmpeg" if [ -d Tahoma2D/ffmpeg ] then rm -rf Tahoma2D/ffmpeg fi - cp -R ../../thirdparty/ffmpeg/bin Tahoma2D/ffmpeg + mkdir -p Tahoma2D/ffmpeg + cp -R ../../thirdparty/apps/ffmpeg/bin/ffmpeg ../../thirdparty/apps/ffmpeg/bin/ffprobe Tahoma2D/ffmpeg fi -if [ -d ../../thirdparty/rhubarb ] +if [ -d ../../thirdparty/apps/rhubarb ] then echo ">>> Copying Rhubarb Lip Sync to Tahoma2D/rhubarb" if [ -d Tahoma2D/rhubarb ] then rm -rf Tahoma2D/rhubarb fi - cp -R ../../thirdparty/rhubarb Tahoma2D/rhubarb + mkdir -p Tahoma2D/rhubarb + cp -R ../../thirdparty/apps/rhubarb/rhubarb ../../thirdparty/apps/rhubarb/res Tahoma2D/rhubarb fi echo ">>> Creating Tahoma2D/Tahoma2D.AppImage" diff --git a/ci-scripts/linux/tahoma-get3rdpartyapps.sh b/ci-scripts/linux/tahoma-get3rdpartyapps.sh new file mode 100755 index 00000000..8a08cfb9 --- /dev/null +++ b/ci-scripts/linux/tahoma-get3rdpartyapps.sh @@ -0,0 +1,28 @@ +#!/bin/bash +cd thirdparty + +if [ ! -d apps ] +then + mkdir apps +fi +cd apps +echo "*" >| .gitignore + +echo ">>> Getting FFmpeg" +if [ -d ffmpeg ] +then + rm -rf ffmpeg +fi +wget https://github.com/tahoma2d/FFmpeg/releases/download/v4.3.1/ffmpeg-4.3.1-linux-static-lgpl.zip +unzip ffmpeg-4.3.1-linux-static-lgpl.zip +mv ffmpeg-4.3.1-linux-static-lgpl ffmpeg + + +echo ">>> Getting Rhubarb Lip Sync" +if [ -d rhubarb ] +then + rm -rf rhubarb ] +fi +wget https://github.com/tahoma2d/rhubarb-lip-sync/releases/download/v1.10.2/rhubarb-lip-sync-tahoma2d-linux.zip +unzip rhubarb-lip-sync-tahoma2d-linux.zip -d rhubarb + diff --git a/ci-scripts/linux/tahoma-install.sh b/ci-scripts/linux/tahoma-install.sh index 542b229a..68a63d5d 100755 --- a/ci-scripts/linux/tahoma-install.sh +++ b/ci-scripts/linux/tahoma-install.sh @@ -1,3 +1,4 @@ +#!/bin/bash sudo add-apt-repository --yes ppa:beineri/opt-qt597-xenial sudo add-apt-repository --yes ppa:achadwick/mypaint-testing sudo apt-get update From c23df3a117f6222c7aa19eb290a0b03ec2c9423c Mon Sep 17 00:00:00 2001 From: manongjohn Date: Sun, 21 Mar 2021 21:03:47 -0400 Subject: [PATCH 17/21] Update macOS to use tahoma2d forks of ffmpeg and opencv --- ci-scripts/osx/tahoma-buildffmpeg.sh | 3 ++- ci-scripts/osx/tahoma-buildopencv.sh | 3 ++- ci-scripts/osx/tahoma-get3rdpartyapps.sh | 8 ++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ci-scripts/osx/tahoma-buildffmpeg.sh b/ci-scripts/osx/tahoma-buildffmpeg.sh index 54d79fee..73621bfb 100755 --- a/ci-scripts/osx/tahoma-buildffmpeg.sh +++ b/ci-scripts/osx/tahoma-buildffmpeg.sh @@ -1,3 +1,4 @@ +#!/bin/bash cd thirdparty echo ">>> Cloning aom" @@ -25,7 +26,7 @@ sudo make install cd ../.. echo ">>> Cloning ffmpeg" -git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg +git clone https://github.com/tahoma2d/ffmpeg cd ffmpeg echo "*" >| .gitignore diff --git a/ci-scripts/osx/tahoma-buildopencv.sh b/ci-scripts/osx/tahoma-buildopencv.sh index a772a6e5..874011f6 100755 --- a/ci-scripts/osx/tahoma-buildopencv.sh +++ b/ci-scripts/osx/tahoma-buildopencv.sh @@ -1,7 +1,8 @@ +#!/bin/bash cd thirdparty echo ">>> Cloning opencv" -git clone https://github.com/opencv/opencv.git +git clone https://github.com/tahoma2d/opencv cd opencv echo "*" >| .gitignore diff --git a/ci-scripts/osx/tahoma-get3rdpartyapps.sh b/ci-scripts/osx/tahoma-get3rdpartyapps.sh index c1bd6dc4..3cca0039 100755 --- a/ci-scripts/osx/tahoma-get3rdpartyapps.sh +++ b/ci-scripts/osx/tahoma-get3rdpartyapps.sh @@ -9,12 +9,20 @@ cd apps echo "*" >| .gitignore echo ">>> Getting FFmpeg" +if [ -d ffmpeg ] +then + rm -rf ffmpeg +fi wget https://github.com/tahoma2d/FFmpeg/releases/download/v4.3.1/ffmpeg-4.3.1-macos64-static-lgpl.zip unzip ffmpeg-4.3.1-macos64-static-lgpl.zip mv ffmpeg-4.3.1-macos64-static-lgpl ffmpeg echo ">>> Getting Rhubarb Lip Sync" +if [ -d rhubarb ] +then + rm -rf rhubarb +fi wget https://github.com/tahoma2d/rhubarb-lip-sync/releases/download/v1.10.2/rhubarb-lip-sync-tahoma2d-osx.zip unzip rhubarb-lip-sync-tahoma2d-osx.zip -d rhubarb From 4f3235a3384d3906022758eb4af19f00d2a63c95 Mon Sep 17 00:00:00 2001 From: manongjohn Date: Mon, 22 Mar 2021 07:56:05 -0400 Subject: [PATCH 18/21] Download and package precompiled 3rd party apps (Windows) --- appveyor.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index f2adfad5..3cd21c72 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -60,6 +60,26 @@ after_build: xcopy /Y /E ..\..\stuff "%CONFIGURATION%\Tahoma2D\tahomastuff" + curl -fsSL -o ffmpeg-4.3.1-win64-static-lgpl.zip https://github.com/tahoma2d/FFmpeg/releases/download/v4.3.1/ffmpeg-4.3.1-win64-static-lgpl.zip + + 7z x ffmpeg-4.3.1-win64-static-lgpl.zip + + copy /Y ffmpeg-4.3.1-win64-static-lgpl\bin\ffmpeg.exe %CONFIGURATION%\Tahoma2D + + copy /Y ffmpeg-4.3.1-win64-static-lgpl\bin\ffprobe.exe %CONFIGURATION%\Tahoma2D + + curl -fsSL -o rhubarb-lip-sync-tahoma2d-win.zip https://github.com/tahoma2d/rhubarb-lip-sync/releases/download/v1.10.2/rhubarb-lip-sync-tahoma2d-win.zip + + 7z x rhubarb-lip-sync-tahoma2d-win.zip + + mkdir %CONFIGURATION%\Tahoma2D\rhubarb + + copy /Y rhubarb-lip-sync-tahoma2d-win\rhubarb.exe %CONFIGURATION%\Tahoma2D\rhubarb + + mkdir %CONFIGURATION%\Tahoma2D\rhubarb\res + + xcopy /Y /E rhubarb-lip-sync-tahoma2d-win\res "%CONFIGURATION%\Tahoma2D\rhubarb\res" + artifacts: - path: toonz\$(PLATFORM)\$(CONFIGURATION) name: Tahoma2D From 7a92aa58245b09e6ebf74698ef11fbc53978b126 Mon Sep 17 00:00:00 2001 From: manongjohn Date: Mon, 22 Mar 2021 10:20:45 -0400 Subject: [PATCH 19/21] Update ccached directories --- .github/workflows/linux_build.yml | 1 - .github/workflows/macOS_build.yml | 1 - 2 files changed, 2 deletions(-) diff --git a/.github/workflows/linux_build.yml b/.github/workflows/linux_build.yml index b071f867..c1b18542 100644 --- a/.github/workflows/linux_build.yml +++ b/.github/workflows/linux_build.yml @@ -27,7 +27,6 @@ jobs: /home/runner/.ccache /home/runner/work/tahoma2d/taoma2d/thirdparty/openh264 /home/runner/work/tahoma2d/taoma2d/thirdparty/ffmpeg - /home/runner/work/tahoma2d/taoma2d/thirdparty/ffmpeg_shared /home/runner/work/tahoma2d/taoma2d/thirdparty/opencv key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }} restore-keys: | diff --git a/.github/workflows/macOS_build.yml b/.github/workflows/macOS_build.yml index 909ea39f..53d31df1 100644 --- a/.github/workflows/macOS_build.yml +++ b/.github/workflows/macOS_build.yml @@ -18,7 +18,6 @@ jobs: /Users/runner/.ccache /Users/runner/work/tahoma2d/taoma2d/thirdparty/aom /Users/runner/work/tahoma2d/taoma2d/thirdparty/ffmpeg - /Users/runner/work/tahoma2d/taoma2d/thirdparty/ffmpeg_shared /Users/runner/work/tahoma2d/taoma2d/thirdparty/opencv key: ${{ runner.os }}-${{ github.sha }} restore-keys: ${{ runner.os }}- From 34bf432ec661d98102afd42f88fabdfb6f6297a7 Mon Sep 17 00:00:00 2001 From: manongjohn Date: Mon, 22 Mar 2021 12:27:30 -0400 Subject: [PATCH 20/21] Move 3rd Party Apps lower in Preferences category list --- toonz/sources/toonz/preferencespopup.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/toonz/sources/toonz/preferencespopup.cpp b/toonz/sources/toonz/preferencespopup.cpp index d85c28df..6f3e2925 100644 --- a/toonz/sources/toonz/preferencespopup.cpp +++ b/toonz/sources/toonz/preferencespopup.cpp @@ -1271,9 +1271,9 @@ PreferencesPopup::PreferencesPopup() m_categoryList = new QListWidget(this); QStringList categories; categories << tr("General") << tr("Interface") << tr("Visualization") - << tr("Loading") << tr("Saving") << tr("3rd Party Apps") - << tr("Drawing") << tr("Tools") << tr("Scene") << tr("Animation") - << tr("Preview") << tr("Onion Skin") << tr("Colors") + << tr("Loading") << tr("Saving") << tr("Drawing") << tr("Tools") + << tr("Scene") << tr("Animation") << tr("Preview") + << tr("Onion Skin") << tr("Colors") << tr("3rd Party Apps") << tr("Version Control") << tr("Touch/Tablet Settings"); m_categoryList->addItems(categories); m_categoryList->setFixedWidth(160); @@ -1286,7 +1286,6 @@ PreferencesPopup::PreferencesPopup() m_stackedWidget->addWidget(createVisualizationPage()); m_stackedWidget->addWidget(createLoadingPage()); m_stackedWidget->addWidget(createSavingPage()); - m_stackedWidget->addWidget(createImportExportPage()); m_stackedWidget->addWidget(createDrawingPage()); m_stackedWidget->addWidget(createToolsPage()); m_stackedWidget->addWidget(createXsheetPage()); @@ -1294,6 +1293,7 @@ PreferencesPopup::PreferencesPopup() m_stackedWidget->addWidget(createPreviewPage()); m_stackedWidget->addWidget(createOnionSkinPage()); m_stackedWidget->addWidget(createColorsPage()); + m_stackedWidget->addWidget(createImportExportPage()); m_stackedWidget->addWidget(createVersionControlPage()); m_stackedWidget->addWidget(createTouchTabletPage()); // createImportPrefsPage() must always be last From 49a591fad49d6198022a68cf248402e744e6e917 Mon Sep 17 00:00:00 2001 From: manongjohn Date: Mon, 22 Mar 2021 12:27:48 -0400 Subject: [PATCH 21/21] Store ffmpeg binaries in ffmpeg subfolder (windows) --- appveyor.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 3cd21c72..7ee74333 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -64,9 +64,11 @@ after_build: 7z x ffmpeg-4.3.1-win64-static-lgpl.zip - copy /Y ffmpeg-4.3.1-win64-static-lgpl\bin\ffmpeg.exe %CONFIGURATION%\Tahoma2D + mkdir %CONFIGURATION%\Tahoma2D\ffmpeg + + copy /Y ffmpeg-4.3.1-win64-static-lgpl\bin\ffmpeg.exe %CONFIGURATION%\Tahoma2D\ffmpeg - copy /Y ffmpeg-4.3.1-win64-static-lgpl\bin\ffprobe.exe %CONFIGURATION%\Tahoma2D + copy /Y ffmpeg-4.3.1-win64-static-lgpl\bin\ffprobe.exe %CONFIGURATION%\Tahoma2D\ffmpeg curl -fsSL -o rhubarb-lip-sync-tahoma2d-win.zip https://github.com/tahoma2d/rhubarb-lip-sync/releases/download/v1.10.2/rhubarb-lip-sync-tahoma2d-win.zip