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
5 changed files with 23 additions and 12 deletions
Showing only changes of commit 2692db1ed3 - Show all commits

View File

@ -164,14 +164,24 @@ namespace SHADE
return AssetType::INVALID; return AssetType::INVALID;
} }
std::optional<SHADE::SHAsset> SHAssetManager::GetAsset(AssetID id) noexcept SHAsset* SHAssetManager::GetAsset(AssetID id) noexcept
{ {
if (assetCollection.contains(id)) if (assetCollection.contains(id))
{ {
return assetCollection[id]; return &assetCollection[id];
} }
return {}; return nullptr;
}
SHAsset const* SHAssetManager::GetAssetConst(AssetID id) noexcept
{
if (assetCollection.contains(id))
{
return &assetCollection[id];
}
return nullptr;
} }
AssetID SHAssetManager::GetAssetIDFromPath(AssetPath const& path) noexcept AssetID SHAssetManager::GetAssetIDFromPath(AssetPath const& path) noexcept

View File

@ -50,7 +50,8 @@ namespace SHADE
* \return const& to unordered_map<AssetName, AssetID> * \return const& to unordered_map<AssetName, AssetID>
****************************************************************************/ ****************************************************************************/
static std::vector<SHAsset> GetAllAssets() noexcept; static std::vector<SHAsset> GetAllAssets() noexcept;
static std::optional<SHAsset> GetAsset(AssetID id) noexcept; static SHAsset* GetAsset(AssetID id) noexcept;
static SHAsset const* GetAssetConst(AssetID id) noexcept;
static AssetType GetType(AssetID id) noexcept; static AssetType GetType(AssetID id) noexcept;

View File

@ -378,9 +378,9 @@ namespace SHADE
// Attempt to get the asset's data for rendering editor // Attempt to get the asset's data for rendering editor
auto asset = SHAssetManager::GetAsset(value); auto asset = SHAssetManager::GetAsset(value);
std::string assetName; std::string assetName;
if (asset.has_value()) if (asset)
{ {
assetName = asset.value().name; assetName = asset->name;
} }
// Editor // Editor
@ -391,9 +391,9 @@ namespace SHADE
{ {
// Check if type matches // Check if type matches
auto draggedAsset = SHAssetManager::GetAsset(*payload); auto draggedAsset = SHAssetManager::GetAsset(*payload);
if (draggedAsset.has_value() && draggedAsset.value().type == type) if (draggedAsset && draggedAsset->type == type)
{ {
value = draggedAsset.value().id; value = draggedAsset->id;
changed = true; changed = true;
} }
SHDragDrop::EndTarget(); SHDragDrop::EndTarget();

View File

@ -127,8 +127,8 @@ namespace SHADE
if (assetId.has_value()) if (assetId.has_value())
{ {
const auto ASSET_INFO = SHAssetManager::GetAsset(assetId.value()); const auto ASSET_INFO = SHAssetManager::GetAsset(assetId.value());
if (ASSET_INFO.has_value()) if (ASSET_INFO)
return ASSET_INFO.value().name; return ASSET_INFO->name;
} }
return {}; return {};
} }

View File

@ -162,8 +162,8 @@ namespace SHADE
if (assetId.has_value()) if (assetId.has_value())
{ {
const auto ASSET_INFO = SHAssetManager::GetAsset(assetId.value()); const auto ASSET_INFO = SHAssetManager::GetAsset(assetId.value());
if (ASSET_INFO.has_value()) if (ASSET_INFO)
return ASSET_INFO.value().name; return ASSET_INFO->name;
} }
return {}; return {};
} }