diff --git a/toonz/sources/toonz/iocommand.cpp b/toonz/sources/toonz/iocommand.cpp index 907bfc24..26602336 100644 --- a/toonz/sources/toonz/iocommand.cpp +++ b/toonz/sources/toonz/iocommand.cpp @@ -1402,6 +1402,7 @@ void IoCmd::newScene() { bool IoCmd::saveScene(const TFilePath &path, int flags) { bool overwrite = (flags & SILENTLY_OVERWRITE) != 0; bool saveSubxsheet = (flags & SAVE_SUBXSHEET) != 0; + bool isAutosave = (flags & AUTO_SAVE) != 0; TApp *app = TApp::instance(); assert(!path.isEmpty()); @@ -1442,7 +1443,7 @@ bool IoCmd::saveScene(const TFilePath &path, int flags) { if (saveSubxsheet) xsheet = TApp::instance()->getCurrentXsheet()->getXsheet(); // Automatically remove unused levels - if (!saveSubxsheet && + if (!saveSubxsheet && !isAutosave && Preferences::instance()->isAutoRemoveUnusedLevelsEnabled()) { if (LevelCmd::removeUnusedLevelsFromCast(false)) DVGui::info( @@ -1556,7 +1557,7 @@ bool IoCmd::saveScene(const TFilePath &path, int flags) { // IoCmd::saveScene() //--------------------------------------------------------------------------- -bool IoCmd::saveScene() { +bool IoCmd::saveScene(int flags) { TSelection *oldSelection = TApp::instance()->getCurrentSelection()->getSelection(); ToonzScene *scene = TApp::instance()->getCurrentScene()->getScene(); @@ -1574,7 +1575,7 @@ bool IoCmd::saveScene() { } else { TFilePath fp = scene->getScenePath(); // salva la scena con il nome fp. se fp esiste gia' lo sovrascrive - return saveScene(fp, SILENTLY_OVERWRITE); + return saveScene(fp, SILENTLY_OVERWRITE | flags); } } @@ -1719,10 +1720,10 @@ bool IoCmd::saveLevel(TXshSimpleLevel *sl) { // IoCmd::saveAll() //--------------------------------------------------------------------------- -bool IoCmd::saveAll() { +bool IoCmd::saveAll(int flags) { // try to save as much as possible // if anything is wrong, return false - bool result = saveScene(); + bool result = saveScene(flags); TApp *app = TApp::instance(); ToonzScene *scene = app->getCurrentScene()->getScene(); diff --git a/toonz/sources/toonz/iocommand.h b/toonz/sources/toonz/iocommand.h index 63487820..b72a8545 100644 --- a/toonz/sources/toonz/iocommand.h +++ b/toonz/sources/toonz/iocommand.h @@ -186,6 +186,7 @@ bool loadSubScene(const TFilePath &scenePath); enum SaveSceneFlags { SILENTLY_OVERWRITE = 0x1, SAVE_SUBXSHEET = 0x2, + AUTO_SAVE = 0x4 }; // ritorna true sse la scena e' stata salvata @@ -196,7 +197,7 @@ enum SaveSceneFlags { // 0 salva comunque // tutta la scena, altrimenti solo il sottoxsheet bool saveScene(const TFilePath &fp, int flags); -bool saveScene(); +bool saveScene(int flags = 0); bool saveLevel(const TFilePath &fp); bool saveLevel(); @@ -204,7 +205,7 @@ bool saveLevel(); bool saveLevel(const TFilePath &fp, TXshSimpleLevel *sl, bool overwrite); bool saveLevel(TXshSimpleLevel *sl); -bool saveAll(); +bool saveAll(int flags = 0); void saveNonSceneFiles(); diff --git a/toonz/sources/toonz/tapp.cpp b/toonz/sources/toonz/tapp.cpp index f9ab4179..4afc63ea 100644 --- a/toonz/sources/toonz/tapp.cpp +++ b/toonz/sources/toonz/tapp.cpp @@ -745,9 +745,9 @@ void TApp::autosave() { // pb.show(); Preferences *pref = Preferences::instance(); if (pref->isAutosaveSceneEnabled() && pref->isAutosaveOtherFilesEnabled()) { - IoCmd::saveAll(); + IoCmd::saveAll(IoCmd::AUTO_SAVE); } else if (pref->isAutosaveSceneEnabled()) { - IoCmd::saveScene(); + IoCmd::saveScene(IoCmd::AUTO_SAVE); } else if (pref->isAutosaveOtherFilesEnabled()) { IoCmd::saveNonSceneFiles(); }