Skip to content

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

C

sort levels by foldername

Abel Youb68ec160dbf6
diff --git a/toonz/sources/toonz/exportalllevelspopup.cpp b/toonz/sources/toonz/exportalllevelspopup.cpp
index 50b9c7199..44412a3fe 100644
--- a/toonz/sources/toonz/exportalllevelspopup.cpp
+++ b/toonz/sources/toonz/exportalllevelspopup.cpp
@@ -182,25 +182,14 @@ void ExportAllLevelsPopup::showEvent(QShowEvent *se) {
// reset map
level_to_foldername.clear();
- GetSelectedSimpLevels();//also init level_to_folder
+ GetSelectedSimpLevels();//also init level_to_foldername,and sort them
-
if (outputLevels.empty()) {
QTimer::singleShot(1000, this, &ExportAllLevelsPopup::hide);
DVGui::error(tr("No Level in camera stand or null Level !"));
return;
}
- //sort
- std::sort(outputLevels.begin(), outputLevels.end(),
- [](TXshLevel *lhs, TXshLevel *rhs) {
- if (lhs->getType() ==
- rhs->getType()) { // vector first,biggest level name second
- return lhs->getName() < rhs->getName();
- } else
- return lhs->getType() > rhs->getType();
- });
-
onExportAll(isexport_all);
updateOnSelection();
}
@@ -280,6 +269,18 @@ void ExportAllLevelsPopup::GetSelectedSimpLevels() {
continue;
}
}
+
+ // sort
+ auto *p = &level_to_foldername;
+ std::sort(outputLevels.begin(), outputLevels.end(),
+ [p](TXshLevel *lhs, TXshLevel *rhs) {
+ if (lhs->getType() ==
+ rhs->getType()) { // vector first,biggest level name second
+ return p->find(lhs->getName())->second <
+ p->find(rhs->getName())->second;
+ } else
+ return lhs->getType() > rhs->getType();
+ });
}