From 0b5f3366ed93b6e68c40d4745b062520d03697f6 Mon Sep 17 00:00:00 2001 From: shun_iwasawa Date: Apr 25 2016 07:39:15 +0000 Subject: add Save All command --- 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 7bddb5a..a9c34d0 100644 --- a/toonz/sources/toonz/iocommand.cpp +++ b/toonz/sources/toonz/iocommand.cpp @@ -1667,66 +1667,22 @@ bool IoCmd::saveLevel(TXshSimpleLevel *sl) bool IoCmd::saveAll() { -#ifdef BRAVODEMO - return false; -#else // try to save as much as possible // if anything is wrong, return false - bool result = true; - // save scene - if (!saveScene()) - { - result = false; - } + bool result = saveScene(); TApp *app = TApp::instance(); ToonzScene* scene = app->getCurrentScene()->getScene(); - TLevelSet* levelSet = scene->getLevelSet(); - int numLevels = levelSet->getLevelCount(); - // save levels of scene - for (int i = 0; i < numLevels; ++i) - { - TXshLevel* level = levelSet->getLevel(i); - TXshSimpleLevel *sl = level->getSimpleLevel(); - if (sl) - { - if (sl->getPath() == TFilePath()) - { - result = false; - continue; - } - - TFilePath path = scene->decodeFilePath(sl->getPath()); - if (path == TFilePath()) - { - result = false; - continue; - } - if (path.getWideString()[0] == L'+') - { - result = false; - continue; - } - if (!path.isAbsolute()) - { - result = false; - continue; - } - if (!saveLevel(path, sl, true)) - { - result = false; - continue; - } - sl->setDirtyFlag(false); - } - } - + + SceneResources resources(scene, 0); + resources.save(scene->getScenePath()); + resources.updatePaths(); + // for update title bar - // should we call this for all the levels? - app->getCurrentLevel()->notifyLevelChange(); + app->getCurrentLevel()->notifyLevelTitleChange(); + app->getCurrentPalette()->notifyPaletteTitleChanged(); return result; -#endif } //=========================================================================== 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 (...) {