diff --git a/stuff/profiles/layouts/OpenToonz/menubar_template.xml b/stuff/profiles/layouts/OpenToonz/menubar_template.xml
index 8b96152..7b9c58b 100644
--- a/stuff/profiles/layouts/OpenToonz/menubar_template.xml
+++ b/stuff/profiles/layouts/OpenToonz/menubar_template.xml
@@ -4,6 +4,7 @@
MI_LoadScene
MI_SaveScene
MI_SaveSceneAs
+ MI_SaveAll
MI_OpenRecentScene
MI_RevertScene
diff --git a/stuff/profiles/layouts/OpenToonz/room1_menubar.xml b/stuff/profiles/layouts/OpenToonz/room1_menubar.xml
index 13bae22..373e4b1 100644
--- a/stuff/profiles/layouts/OpenToonz/room1_menubar.xml
+++ b/stuff/profiles/layouts/OpenToonz/room1_menubar.xml
@@ -9,6 +9,7 @@
MI_LoadScene
MI_SaveScene
MI_SaveSceneAs
+ MI_SaveAll
MI_OpenRecentScene
MI_RevertScene
diff --git a/stuff/profiles/layouts/OpenToonz/room2_menubar.xml b/stuff/profiles/layouts/OpenToonz/room2_menubar.xml
index d503306..64f3972 100644
--- a/stuff/profiles/layouts/OpenToonz/room2_menubar.xml
+++ b/stuff/profiles/layouts/OpenToonz/room2_menubar.xml
@@ -16,6 +16,7 @@
MI_LoadScene
MI_SaveScene
MI_SaveSceneAs
+ MI_SaveAll
MI_OpenRecentScene
MI_RevertScene
diff --git a/stuff/profiles/layouts/OpenToonz/room3_menubar.xml b/stuff/profiles/layouts/OpenToonz/room3_menubar.xml
index 6b15f61..b090854 100644
--- a/stuff/profiles/layouts/OpenToonz/room3_menubar.xml
+++ b/stuff/profiles/layouts/OpenToonz/room3_menubar.xml
@@ -4,6 +4,7 @@
MI_LoadFolder
MI_SaveLevel
MI_SaveLevelAs
+ MI_SaveAll
MI_OpenRecentLevel
MI_ExportLevel
MI_LevelSettings
diff --git a/stuff/profiles/layouts/OpenToonz/room4_menubar.xml b/stuff/profiles/layouts/OpenToonz/room4_menubar.xml
index b37b517..544b309 100644
--- a/stuff/profiles/layouts/OpenToonz/room4_menubar.xml
+++ b/stuff/profiles/layouts/OpenToonz/room4_menubar.xml
@@ -3,6 +3,7 @@
MI_LoadScene
MI_SaveScene
MI_SaveSceneAs
+ MI_SaveAll
MI_OpenRecentScene
MI_RevertScene
diff --git a/toonz/sources/toonz/iocommand.cpp b/toonz/sources/toonz/iocommand.cpp
index 9bb224b..c4bb86d 100644
--- a/toonz/sources/toonz/iocommand.cpp
+++ b/toonz/sources/toonz/iocommand.cpp
@@ -1662,6 +1662,30 @@ bool IoCmd::saveLevel(TXshSimpleLevel *sl)
}
//===========================================================================
+// IoCmd::saveAll() save current scene and all of its levels
+//---------------------------------------------------------------------------
+
+bool IoCmd::saveAll()
+{
+ // try to save as much as possible
+ // if anything is wrong, return false
+ bool result = saveScene();
+
+ TApp *app = TApp::instance();
+ ToonzScene* scene = app->getCurrentScene()->getScene();
+
+ SceneResources resources(scene, 0);
+ resources.save(scene->getScenePath());
+ resources.updatePaths();
+
+ // for update title bar
+ app->getCurrentLevel()->notifyLevelTitleChange();
+ app->getCurrentPalette()->notifyPaletteTitleChanged();
+
+ return result;
+}
+
+//===========================================================================
// IoCmd::saveSound(soundPath, soundColumn, overwrite)
//---------------------------------------------------------------------------
@@ -2829,3 +2853,17 @@ public:
TApp::instance()->getPaletteController()->getCurrentLevelPalette()->notifyPaletteDirtyFlagChanged();
}
} overwritePaletteCommandHandler;
+
+
+//=============================================================================
+// Save scene and levels
+//-----------------------------------------------------------------------------
+class SaveAllCommandHandler : public MenuItemHandler
+{
+public:
+ SaveAllCommandHandler() : MenuItemHandler(MI_SaveAll) {}
+ void execute()
+ {
+ IoCmd::saveAll();
+ }
+} saveAllCommandHandler;
diff --git a/toonz/sources/toonz/iocommand.h b/toonz/sources/toonz/iocommand.h
index 825b8ad..00dac2a 100644
--- a/toonz/sources/toonz/iocommand.h
+++ b/toonz/sources/toonz/iocommand.h
@@ -173,6 +173,8 @@ bool saveLevel();
bool saveLevel(const TFilePath &fp, TXshSimpleLevel *sl, bool overwrite);
bool saveLevel(TXshSimpleLevel *sl);
+bool saveAll();
+
bool saveSound(const TFilePath &fp, TXshSoundLevel *sc, bool overwrite);
bool saveSound(TXshSoundLevel *sc);
diff --git a/toonz/sources/toonz/mainwindow.cpp b/toonz/sources/toonz/mainwindow.cpp
index e076360..c766ecd 100644
--- a/toonz/sources/toonz/mainwindow.cpp
+++ b/toonz/sources/toonz/mainwindow.cpp
@@ -1579,6 +1579,7 @@ void MainWindow::defineActions()
createMenuFileAction(MI_LoadScene, tr("&Load Scene..."), "Ctrl+L");
createMenuFileAction(MI_SaveScene, tr("&Save Scene"), "Ctrl+S");
createMenuFileAction(MI_SaveSceneAs, tr("&Save Scene As..."), "Ctrl+Shift+S");
+ createMenuFileAction(MI_SaveAll, tr("&Save All"), "");
createMenuFileAction(MI_RevertScene, tr("&Revert Scene"), "");
QAction *act = CommandManager::instance()->getAction(MI_RevertScene);
diff --git a/toonz/sources/toonz/menubar.cpp b/toonz/sources/toonz/menubar.cpp
index 02de277..f21a7a3 100644
--- a/toonz/sources/toonz/menubar.cpp
+++ b/toonz/sources/toonz/menubar.cpp
@@ -403,6 +403,7 @@ QMenuBar* StackedMenuBar::createCleanupMenuBar()
addMenuItem(filesMenu, MI_LoadScene);
addMenuItem(filesMenu, MI_SaveScene);
addMenuItem(filesMenu, MI_SaveSceneAs);
+ addMenuItem(filesMenu, MI_SaveAll);
addMenuItem(filesMenu, MI_OpenRecentScene);
addMenuItem(filesMenu, MI_RevertScene);
filesMenu->addSeparator();
@@ -535,6 +536,7 @@ QMenuBar* StackedMenuBar::createPltEditMenuBar()
addMenuItem(filesMenu, MI_LoadScene);
addMenuItem(filesMenu, MI_SaveScene);
addMenuItem(filesMenu, MI_SaveSceneAs);
+ addMenuItem(filesMenu, MI_SaveAll);
addMenuItem(filesMenu, MI_OpenRecentScene);
addMenuItem(filesMenu, MI_RevertScene);
filesMenu->addSeparator();
@@ -707,6 +709,7 @@ QMenuBar* StackedMenuBar::createInknPaintMenuBar()
addMenuItem(filesMenu, MI_LoadScene);
addMenuItem(filesMenu, MI_SaveScene);
addMenuItem(filesMenu, MI_SaveSceneAs);
+ addMenuItem(filesMenu, MI_SaveAll);
addMenuItem(filesMenu, MI_OpenRecentScene);
filesMenu->addSeparator();
addMenuItem(filesMenu, MI_NewScene);
@@ -857,6 +860,7 @@ QMenuBar* StackedMenuBar::createXsheetMenuBar()
addMenuItem(xsheetMenu, MI_LoadScene);
addMenuItem(xsheetMenu, MI_SaveScene);
addMenuItem(xsheetMenu, MI_SaveSceneAs);
+ addMenuItem(xsheetMenu, MI_SaveAll);
addMenuItem(xsheetMenu, MI_OpenRecentScene);
addMenuItem(xsheetMenu, MI_RevertScene);
xsheetMenu->addSeparator();
@@ -1109,6 +1113,7 @@ QMenuBar* StackedMenuBar::createFullMenuBar()
addMenuItem(fileMenu, MI_NewScene);
addMenuItem(fileMenu, MI_LoadScene);
addMenuItem(fileMenu, MI_SaveScene);
+ addMenuItem(fileMenu, MI_SaveAll);
addMenuItem(fileMenu, MI_SaveSceneAs);
addMenuItem(fileMenu, MI_OpenRecentScene);
addMenuItem(fileMenu, MI_RevertScene);
diff --git a/toonz/sources/toonz/menubarcommandids.h b/toonz/sources/toonz/menubarcommandids.h
index ec9f0c8..9c1a0e3 100644
--- a/toonz/sources/toonz/menubarcommandids.h
+++ b/toonz/sources/toonz/menubarcommandids.h
@@ -15,6 +15,7 @@
#define MI_LoadScene "MI_LoadScene"
#define MI_SaveScene "MI_SaveScene"
#define MI_SaveSceneAs "MI_SaveSceneAs"
+#define MI_SaveAll "MI_SaveAll"
#define MI_RevertScene "MI_RevertScene"
#define MI_LoadSubSceneFile "MI_LoadSubSceneFile"
diff --git a/toonz/sources/toonzlib/sceneresources.cpp b/toonz/sources/toonzlib/sceneresources.cpp
index 98d3758..97ec48c 100644
--- a/toonz/sources/toonzlib/sceneresources.cpp
+++ b/toonz/sources/toonzlib/sceneresources.cpp
@@ -256,13 +256,13 @@ void SceneLevel::save()
//Questo controllo viene fatto qui e non nella copia o nel salvataggio del livello perche' in generale
//non si vuole che il livello unpainted venga copiato con il livello.
if (actualFp.getType() == "tlv") {
- TFilePath oldUnpaintedLevelPath = oldActualPath.getParentDir() + TFilePath(oldActualPath.getName() + "-unpainted." + oldActualPath.getType());
- TFilePath unpaintedLevelPath = actualFp.getParentDir() + TFilePath(actualFp.getName() + "-unpainted." + actualFp.getType());
- if (TSystem::doesExistFileOrLevel(oldUnpaintedLevelPath) && !TSystem::doesExistFileOrLevel(unpaintedLevelPath))
+ TFilePath oldUnpaintedLevelPath = oldActualPath.getParentDir() + "nopaint\\" + TFilePath(oldActualPath.getName() + "_np." + oldActualPath.getType());
+ TFilePath unpaintedLevelPath = actualFp.getParentDir() + "nopaint\\" + TFilePath(actualFp.getName() + "_np." + actualFp.getType());
+ if (TSystem::doesExistFileOrLevel(oldUnpaintedLevelPath) && !TSystem::doesExistFileOrLevel(unpaintedLevelPath) && TSystem::touchParentDir(unpaintedLevelPath))
TSystem::copyFile(unpaintedLevelPath, oldUnpaintedLevelPath);
TFilePath oldUnpaintedPalettePath = oldUnpaintedLevelPath.withType("tpl");
TFilePath unpaintedPalettePath = unpaintedLevelPath.withType("tpl");
- if (TSystem::doesExistFileOrLevel(oldUnpaintedPalettePath) && !TSystem::doesExistFileOrLevel(unpaintedPalettePath))
+ if (TSystem::doesExistFileOrLevel(oldUnpaintedPalettePath) && !TSystem::doesExistFileOrLevel(unpaintedPalettePath) && TSystem::touchParentDir(unpaintedPalettePath))
TSystem::copyFile(unpaintedPalettePath, oldUnpaintedPalettePath);
}
} catch (...) {