Implemented Animation Clip asset and animation controller #410
|
@ -164,14 +164,24 @@ namespace SHADE
|
|||
return AssetType::INVALID;
|
||||
}
|
||||
|
||||
std::optional<SHADE::SHAsset> SHAssetManager::GetAsset(AssetID id) noexcept
|
||||
SHAsset* SHAssetManager::GetAsset(AssetID id) noexcept
|
||||
{
|
||||
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
|
||||
|
|
|
@ -50,7 +50,8 @@ namespace SHADE
|
|||
* \return const& to unordered_map<AssetName, AssetID>
|
||||
****************************************************************************/
|
||||
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;
|
||||
|
||||
|
|
|
@ -378,9 +378,9 @@ namespace SHADE
|
|||
// Attempt to get the asset's data for rendering editor
|
||||
auto asset = SHAssetManager::GetAsset(value);
|
||||
std::string assetName;
|
||||
if (asset.has_value())
|
||||
if (asset)
|
||||
{
|
||||
assetName = asset.value().name;
|
||||
assetName = asset->name;
|
||||
}
|
||||
|
||||
// Editor
|
||||
|
@ -391,9 +391,9 @@ namespace SHADE
|
|||
{
|
||||
// Check if type matches
|
||||
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;
|
||||
}
|
||||
SHDragDrop::EndTarget();
|
||||
|
|
|
@ -127,8 +127,8 @@ namespace SHADE
|
|||
if (assetId.has_value())
|
||||
{
|
||||
const auto ASSET_INFO = SHAssetManager::GetAsset(assetId.value());
|
||||
if (ASSET_INFO.has_value())
|
||||
return ASSET_INFO.value().name;
|
||||
if (ASSET_INFO)
|
||||
return ASSET_INFO->name;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
|
|
@ -162,8 +162,8 @@ namespace SHADE
|
|||
if (assetId.has_value())
|
||||
{
|
||||
const auto ASSET_INFO = SHAssetManager::GetAsset(assetId.value());
|
||||
if (ASSET_INFO.has_value())
|
||||
return ASSET_INFO.value().name;
|
||||
if (ASSET_INFO)
|
||||
return ASSET_INFO->name;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue