Mercurial > hg > svapp
diff framework/Document.cpp @ 589:cce97b00663a
Write aggregate models to .sv file when saving document. They still are not reloaded, but I think this is far as I'm prepared to go for 3.0.
author | Chris Cannam |
---|---|
date | Mon, 27 Feb 2017 16:52:47 +0000 |
parents | d122d3595a32 |
children | b23bebfdfaba |
line wrap: on
line diff
--- a/framework/Document.cpp Mon Feb 27 16:26:37 2017 +0000 +++ b/framework/Document.cpp Mon Feb 27 16:52:47 2017 +0000 @@ -1290,11 +1290,38 @@ for (LayerViewMap::const_iterator i = m_layerViewMap.begin(); i != m_layerViewMap.end(); ++i) { - if (i->first && !i->second.empty() && i->first->getModel()) { - used.insert(i->first->getModel()); + if (i->first && !i->second.empty()) { // Layer exists, is in views + Model *m = i->first->getModel(); + if (m) { + used.insert(m); + if (m->getSourceModel()) { + used.insert(m->getSourceModel()); + } + } } } + // Write aggregate models first, so that when re-reading + // derivations we already know about their existence. But only + // those that are actually used + + for (std::set<Model *>::iterator i = m_aggregateModels.begin(); + i != m_aggregateModels.end(); ++i) { + + SVDEBUG << "checking aggregate model " << *i << endl; + + AggregateWaveModel *aggregate = qobject_cast<AggregateWaveModel *>(*i); + if (!aggregate) continue; + if (used.find(aggregate) == used.end()) { + SVDEBUG << "(unused, skipping)" << endl; + continue; + } + + SVDEBUG << "(used, writing)" << endl; + + aggregate->toXml(out, indent + " "); + } + std::set<Model *> written; for (ModelMap::const_iterator i = m_models.begin(); @@ -1353,7 +1380,7 @@ .arg(XmlExportable::getObjectExportId(model))); } } - + //!!! // We should write out the alignment models here. AlignmentModel