Commit e58e316f authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Fix saving project with several clip groups selected discarded those groups

parent 4075f59b
...@@ -745,10 +745,17 @@ const QString GroupsModel::toJson() const ...@@ -745,10 +745,17 @@ const QString GroupsModel::toJson() const
{ {
std::unordered_set<int> roots; std::unordered_set<int> roots;
std::transform(m_groupIds.begin(), m_groupIds.end(), std::inserter(roots, roots.begin()), std::transform(m_groupIds.begin(), m_groupIds.end(), std::inserter(roots, roots.begin()),
[&](decltype(*m_groupIds.begin()) g) { return getRootId(g.first); }); [&](decltype(*m_groupIds.begin()) g) {
const int parentId = getRootId(g.first);
if (getType(parentId) == GroupType::Selection) {
// Don't insert selection group, only its child groups
return g.first;
}
return parentId;
});
QJsonArray list; QJsonArray list;
for (int r : roots) { for (int r : roots) {
if (getType(r) != GroupType::Selection) list.push_back(toJson(r)); list.push_back(toJson(r));
} }
QJsonDocument json(list); QJsonDocument json(list);
return QString(json.toJson()); return QString(json.toJson());
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment