Skip to content

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

C

Fix: Recognize Tahoma2D project files

Rodney029c2a1fba10
diff --git a/toonz/sources/toonzlib/tproject.cpp b/toonz/sources/toonzlib/tproject.cpp
index 01e1d99c7..08a0ace6b 100644
--- a/toonz/sources/toonzlib/tproject.cpp
+++ b/toonz/sources/toonzlib/tproject.cpp
@@ -38,6 +38,7 @@ using namespace std;
const std::wstring prjSuffix[4] = {L"_otprj", L"_prj63ml", L"_prj6", L"_prj"};
const std::wstring xmlExt = L".xml";
const int prjSuffixCount = 4;
+const std::wstring tahomaProjectFileName = L"tahomaproject.xml";
//===================================================================
/*! Default inputs folder: is used to save all scanned immage.*/
@@ -137,6 +138,13 @@ TFilePath getProjectFile(const TFilePath &fp) {
if (prjfiles.size()) return fp + TFilePath(prjfiles[0]);
}
+ // Tahoma2D stores otherwise-compatible project metadata in a fixed
+ // tahomaproject.xml file. Keep OpenToonz project files as the preferred
+ // discovery result when both formats are present, but accept a Tahoma2D
+ // project in place when it is the available project descriptor.
+ TFilePath tahomaProjectPath = fp + tahomaProjectFileName;
+ if (TFileStatus(tahomaProjectPath).doesExist()) return tahomaProjectPath;
+
return TFilePath();
}
@@ -214,7 +222,6 @@ void hideOlderProjectFiles(const TFilePath &folderPath) {
//
// TProject
//
-
//-------------------------------------------------------------------
/*! \class TProject tproject.h
@@ -710,6 +717,7 @@ void TProject::load(const TFilePath &projectPath) {
bool TProject::isAProjectPath(const TFilePath &fp) {
if (fp.isAbsolute() && fp.getType() == "xml") {
const std::wstring &fpName = fp.getWideName();
+ if (fpName == L"tahomaproject") return true;
for (int i = 0; i < prjSuffixCount; ++i)
if (fpName.find(prjSuffix[i]) != std::wstring::npos) return true;
}
@@ -1195,4 +1203,4 @@ TFilePath TProjectManager::getSandboxProjectPath() {
bool TProjectManager::isProject(const TFilePath &projectFolder) {
TFilePath projectPath = projectFolderToProjectPath(projectFolder);
return TFileStatus(projectPath).doesExist();
-}
+}
\ No newline at end of file