mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-24 21:19:46 -06:00
Don't let the meta info disappear into the void (closes #1876)
This commit is contained in:
@@ -206,9 +206,11 @@ void Asset::startSynchronizations() {
|
||||
}
|
||||
|
||||
void Asset::addIdentifier(std::string identifier) {
|
||||
if (_metaInformation.has_value()) {
|
||||
_metaInformation->identifiers.push_back(std::move(identifier));
|
||||
if (!_metaInformation.has_value()) {
|
||||
_metaInformation = MetaInformation();
|
||||
}
|
||||
|
||||
_metaInformation->identifiers.push_back(std::move(identifier));
|
||||
}
|
||||
|
||||
void Asset::load(Asset* parent) {
|
||||
|
||||
@@ -351,6 +351,16 @@ bool AssetManager::loadAsset(Asset* asset, Asset* parent) {
|
||||
meta.url = p.url.value_or("");
|
||||
meta.license = p.license.value_or("");
|
||||
meta.identifiers = p.identifiers.value_or(std::vector<std::string>());
|
||||
|
||||
// We need to do this as the asset might have 'export'ed identifiers before
|
||||
// defining the meta table. Therefore the meta information already contains some
|
||||
// identifiers that we don't want to throw away
|
||||
if (asset->metaInformation().has_value() &&
|
||||
!asset->metaInformation()->identifiers.empty())
|
||||
{
|
||||
std::vector<std::string> ids = asset->metaInformation()->identifiers;
|
||||
meta.identifiers.insert(meta.identifiers.end(), ids.begin(), ids.end());
|
||||
}
|
||||
asset->setMetaInformation(std::move(meta));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user