Merge pull request #204 from SHADE-DP/SP3-13-Assets-Manager

Asset recognise bugfix
Added meta generation recognisation for scene and font extension types on load up
Check for std::optional value exist
This commit is contained in:
XiaoQiDigipen 2022-11-14 18:32:48 +08:00 committed by GitHub
commit 6d227ec846
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 33 additions and 2 deletions

View File

@ -560,6 +560,34 @@ namespace SHADE
assetCollection.emplace(newAsset.id, newAsset);
SHAssetMetaHandler::WriteMetaData(newAsset);
return newAsset.id;
}
else if (ext == SCENE_EXTENSION)
{
SHAsset newAsset{
path.stem().string(),
GenerateAssetID(AssetType::SCENE),
AssetType::SCENE,
path,
false
};
assetCollection.emplace(newAsset.id, newAsset);
SHAssetMetaHandler::WriteMetaData(newAsset);
return newAsset.id;
}
else if (ext == FONT_EXTENSION)
{
SHAsset newAsset{
path.stem().string(),
GenerateAssetID(AssetType::FONT),
AssetType::FONT,
path,
false
};
assetCollection.emplace(newAsset.id, newAsset);
SHAssetMetaHandler::WriteMetaData(newAsset);
return newAsset.id;
}
}
@ -571,8 +599,11 @@ namespace SHADE
for (auto& file : toGenNew)
{
auto newID{ GenerateNewMeta(file->path).value() };
file->assetMeta = &assetCollection[newID];
auto newID{ GenerateNewMeta(file->path) };
if (newID.has_value())
{
file->assetMeta = &assetCollection[newID.value()];
}
}
for (auto& asset : std::ranges::views::values(assetCollection))