mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-15 01:07:58 -05:00
refactor: make LoadDependency and LoadIndirectAssetReference functions work with Asset template types
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include "AssetLoadingContext.h"
|
||||
#include "Game/IAsset.h"
|
||||
#include "Pool/XAssetInfo.h"
|
||||
#include "Utils/ClassUtils.h"
|
||||
#include "Zone/ZoneTypes.h"
|
||||
@ -50,6 +51,21 @@ public:
|
||||
assetType, assetName, asset, std::move(dependencies), std::move(usedScriptStrings), std::move(indirectAssetReferences)));
|
||||
}
|
||||
|
||||
template<typename AssetType> XAssetInfo<typename AssetType::Type>* LoadDependency(const std::string& assetName)
|
||||
{
|
||||
static_assert(std::is_base_of_v<IAssetBase, AssetType>);
|
||||
|
||||
return static_cast<XAssetInfo<typename AssetType::Type>*>(LoadDependency(AssetType::EnumEntry, assetName));
|
||||
}
|
||||
|
||||
template<typename AssetType> IndirectAssetReference LoadIndirectAssetReference(const std::string& assetName)
|
||||
{
|
||||
static_assert(std::is_base_of_v<IAssetBase, AssetType>);
|
||||
|
||||
return LoadIndirectAssetReference(AssetType::EnumEntry, assetName);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual XAssetInfoGeneric* LoadDependency(asset_type_t assetType, const std::string& assetName) = 0;
|
||||
virtual IndirectAssetReference LoadIndirectAssetReference(asset_type_t assetType, const std::string& assetName) = 0;
|
||||
};
|
||||
|
Reference in New Issue
Block a user