Implemented Animation Clip asset and animation controller #410

Merged
XiaoQiDigipen merged 66 commits from SP3-22-AnimationController into main 2023-03-09 16:19:40 +08:00
2 changed files with 18 additions and 4 deletions
Showing only changes of commit 615a5796f0 - Show all commits

View File

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

View File

@ -249,13 +249,26 @@ namespace SHADE
{ {
std::vector<Handle<SHAnimationClip>> animClips; std::vector<Handle<SHAnimationClip>> animClips;
const auto ALL_ANIM_CLIPS = SHAssetManager::GetAllRecordOfType(AssetType::ANIM_CLIP); //const auto ALL_ANIM_CLIPS = SHAssetManager::GetAllRecordOfType(AssetType::ANIM_CLIP);
for (auto asset : ALL_ANIM_CLIPS) //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) 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));
}
} }
} }