add getAnimationDuration method

This commit is contained in:
Nick Fisher
2023-08-08 14:34:15 +08:00
parent fb53881183
commit fa8c6b1ca0
6 changed files with 40 additions and 4 deletions

View File

@@ -708,6 +708,20 @@ void AssetManager::setAnimationFrame(EntityId entity, int animationIndex, int an
asset.mAnimator->updateBoneMatrices();
}
float AssetManager::getAnimationDuration(EntityId entity, int animationIndex) {
const auto& pos = _entityIdLookup.find(entity);
unique_ptr<vector<string>> names = make_unique<vector<string>>();
if(pos == _entityIdLookup.end()) {
Log("ERROR: asset not found for entity id.");
return -1.0f;
}
auto& asset = _assets[pos->second];
return asset.mAnimator->getAnimationDuration(animationIndex);
}
unique_ptr<vector<string>> AssetManager::getAnimationNames(EntityId entity) {
const auto& pos = _entityIdLookup.find(entity);