add Save All command
This commit is contained in:
parent
93f4764414
commit
0b5f3366ed
6 changed files with 16 additions and 56 deletions
|
@ -9,6 +9,7 @@
|
|||
<command>MI_LoadScene</command>
|
||||
<command>MI_SaveScene</command>
|
||||
<command>MI_SaveSceneAs</command>
|
||||
<command>MI_SaveAll</command>
|
||||
<command>MI_OpenRecentScene</command>
|
||||
<command>MI_RevertScene</command>
|
||||
<separator/>
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
<command>MI_LoadScene</command>
|
||||
<command>MI_SaveScene</command>
|
||||
<command>MI_SaveSceneAs</command>
|
||||
<command>MI_SaveAll</command>
|
||||
<command>MI_OpenRecentScene</command>
|
||||
<command>MI_RevertScene</command>
|
||||
<separator/>
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
<command>MI_LoadFolder</command>
|
||||
<command>MI_SaveLevel</command>
|
||||
<command>MI_SaveLevelAs</command>
|
||||
<command>MI_SaveAll</command>
|
||||
<command>MI_OpenRecentLevel</command>
|
||||
<command>MI_ExportLevel</command>
|
||||
<command>MI_LevelSettings</command>
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
<command>MI_LoadScene</command>
|
||||
<command>MI_SaveScene</command>
|
||||
<command>MI_SaveSceneAs</command>
|
||||
<command>MI_SaveAll</command>
|
||||
<command>MI_OpenRecentScene</command>
|
||||
<command>MI_RevertScene</command>
|
||||
<separator/>
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
|
|
@ -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 (...) {
|
||||
|
|
Loading…
Reference in a new issue