Added line to add subasset meta to parent asset

Rewrote loading of all animation clips into resource manager
This commit is contained in:
Xiao Qi 2023-03-07 22:51:40 +08:00
parent 4d64dd34d8
commit 615a5796f0
2 changed files with 18 additions and 4 deletions

View File

@ -308,6 +308,7 @@ namespace SHADE
auto& newClip {animContainer->clips.emplace_back()};
newClip.name = name;
assetCollection.emplace(id, asset);
assetCollection[parent].subAssets.push_back(&assetCollection[id]);
assetData.emplace(id, &newClip);
return id;
}

View File

@ -249,13 +249,26 @@ namespace SHADE
{
std::vector<Handle<SHAnimationClip>> animClips;
const auto ALL_ANIM_CLIPS = SHAssetManager::GetAllRecordOfType(AssetType::ANIM_CLIP);
for (auto asset : ALL_ANIM_CLIPS)
//const auto ALL_ANIM_CLIPS = SHAssetManager::GetAllRecordOfType(AssetType::ANIM_CLIP);
//for (auto asset : ALL_ANIM_CLIPS)
//{
// const SHAnimClipAsset* ANIM_CLIP = SHAssetManager::GetData<SHAnimClipAsset>(asset.id);
// if (ANIM_CLIP->animRawDataAssetId == rawAnimId)
// {
// animClips.emplace_back(SHResourceManager::LoadOrGet<SHAnimationClip>(asset.id));
// }
//}
const auto ALL_ANIM_CLIPS = SHAssetManager::GetAllRecordOfType(AssetType::ANIM_CONTAINER);
for (auto const& asset : ALL_ANIM_CLIPS)
{
const SHAnimClipAsset* ANIM_CLIP = SHAssetManager::GetData<SHAnimClipAsset>(asset.id);
auto const ANIM_CLIP {SHAssetManager::GetData<SHAnimClipContainerAsset>(asset.id)};
if (ANIM_CLIP->animRawDataAssetId == rawAnimId)
{
animClips.emplace_back(SHResourceManager::LoadOrGet<SHAnimationClip>(asset.id));
for (auto const& subAsset : asset.subAssets)
{
animClips.emplace_back(SHResourceManager::LoadOrGet<SHAnimationClip>(subAsset->id));
}
}
}