2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2026-03-03 03:23:03 +00:00

refactor: introduce subasset loading

This commit is contained in:
Jan Laupetin
2026-02-05 16:25:00 +00:00
parent 1be411b371
commit aa47ffa629
255 changed files with 1668 additions and 3132 deletions

View File

@@ -29,13 +29,36 @@ public:
virtual void FinalizeZone(AssetCreationContext& context) {}
};
template<typename AssetType> class AssetCreator : public IAssetCreator
class ISubAssetCreator
{
public:
static_assert(std::is_base_of_v<IAssetBase, AssetType>);
ISubAssetCreator() = default;
virtual ~ISubAssetCreator() = default;
ISubAssetCreator(const ISubAssetCreator& other) = default;
ISubAssetCreator(ISubAssetCreator&& other) noexcept = default;
ISubAssetCreator& operator=(const ISubAssetCreator& other) = default;
ISubAssetCreator& operator=(ISubAssetCreator&& other) noexcept = default;
[[nodiscard]] virtual std::optional<asset_type_t> GetHandlingSubAssetType() const = 0;
virtual AssetCreationResult CreateSubAsset(const std::string& subAssetName, AssetCreationContext& context) = 0;
virtual void FinalizeZone(AssetCreationContext& context) {}
};
template<AssetDefinition Asset_t> class AssetCreator : public IAssetCreator
{
public:
[[nodiscard]] std::optional<asset_type_t> GetHandlingAssetType() const override
{
return AssetType::EnumEntry;
};
return Asset_t::EnumEntry;
}
};
template<SubAssetDefinition SubAsset_t> class SubAssetCreator : public ISubAssetCreator
{
public:
[[nodiscard]] std::optional<asset_type_t> GetHandlingSubAssetType() const override
{
return SubAsset_t::EnumEntry;
}
};