Skip to content

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

C

Refactor standAlone flag check

Abel You726bdb1d8706
diff --git a/toonz/sources/include/toonz/tproject.h b/toonz/sources/include/toonz/tproject.h
index 9377e26bc..eb2fdb3d6 100644
--- a/toonz/sources/include/toonz/tproject.h
+++ b/toonz/sources/include/toonz/tproject.h
@@ -151,7 +151,7 @@ public:
TFilePath getProjectPathByProjectFolder(const TFilePath &projectFolder);
std::shared_ptr<TProject> loadSceneProject(const TFilePath &scenePath,
- bool* sceneStandAlone = 0);
+ bool* notFound = 0);
void getFolderNames(std::vector<std::string> &names);
void addListener(Listener *listener);
diff --git a/toonz/sources/toonzlib/toonzscene.cpp b/toonz/sources/toonzlib/toonzscene.cpp
index cef8ee317..f702a192a 100644
--- a/toonz/sources/toonzlib/toonzscene.cpp
+++ b/toonz/sources/toonzlib/toonzscene.cpp
@@ -386,10 +386,8 @@ void ToonzScene::loadNoResources(const TFilePath &fp) {
clear();
TProjectManager *pm = TProjectManager::instance();
- bool sceneStandAlone = false;
- auto sceneProject = pm->loadSceneProject(fp, &sceneStandAlone);
+ auto sceneProject = pm->loadSceneProject(fp, &m_standAlone);
if (!sceneProject) return;
- if (sceneStandAlone) m_standAlone = true;
loadTnzFile(fp);
getXsheet()->updateFrameCount();
diff --git a/toonz/sources/toonzlib/tproject.cpp b/toonz/sources/toonzlib/tproject.cpp
index 660cb499a..6635438b2 100644
--- a/toonz/sources/toonzlib/tproject.cpp
+++ b/toonz/sources/toonzlib/tproject.cpp
@@ -1027,9 +1027,9 @@ std::shared_ptr<TProject> TProjectManager::getCurrentProject() {
folder of a project root.
\note \b scenePath must be an absolute path.\n
Creates a new TProject. The caller gets ownership.
- Sets *sceneStandAlone to true if scenes.xml not found */
+ Sets *notFound to true if scenes.xml not found */
std::shared_ptr<TProject> TProjectManager::loadSceneProject(const TFilePath &scenePath,
- bool* sceneStandAlone) {
+ bool* notFound) {
// cerca il file scenes.xml nella stessa directory della scena
// oppure in una
// directory superiore
@@ -1046,6 +1046,7 @@ std::shared_ptr<TProject> TProjectManager::loadSceneProject(const TFilePath &sce
}
folder = folder.getParentDir();
}
+ if (notFound) *notFound = !found;
// legge il path (o il nome) del progetto
TFilePath projectPath;
@@ -1071,10 +1072,8 @@ std::shared_ptr<TProject> TProjectManager::loadSceneProject(const TFilePath &sce
}
if (projectPath == TFilePath()) return 0;
}
- else {
- if (sceneStandAlone) *sceneStandAlone = true;
+ else
projectPath = getSandboxProjectPath();
- }
if (!TProject::isAProjectPath(projectPath)) {
// in Toonz 5.1 e precedenti era un project name