mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-11-27 15:02:06 +00:00
The FinalizeZone step can now fail and the zone link will not ouput a fastfile if the FinalizeZone step fails.
This commit is contained in:
@@ -79,10 +79,15 @@ AssetCreationResult AssetCreatorCollection::CreateDefaultAsset(const asset_type_
|
||||
return AssetCreationResult::NoAction();
|
||||
}
|
||||
|
||||
void AssetCreatorCollection::FinalizeZone(AssetCreationContext& context) const
|
||||
bool AssetCreatorCollection::FinalizeZone(AssetCreationContext& context) const
|
||||
{
|
||||
for (const auto& creator : m_asset_creators)
|
||||
creator->FinalizeZone(context);
|
||||
{
|
||||
if (!creator->FinalizeZone(context))
|
||||
return false;
|
||||
}
|
||||
for (const auto& postProcessor : m_asset_post_processors)
|
||||
postProcessor->FinalizeZone(context);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public:
|
||||
|
||||
AssetCreationResult CreateAsset(asset_type_t assetType, const std::string& assetName, AssetCreationContext& context) const;
|
||||
AssetCreationResult CreateDefaultAsset(asset_type_t assetType, const std::string& assetName, AssetCreationContext& context) const;
|
||||
void FinalizeZone(AssetCreationContext& context) const;
|
||||
bool FinalizeZone(AssetCreationContext& context) const;
|
||||
|
||||
private:
|
||||
std::vector<std::vector<IAssetCreator*>> m_asset_creators_by_type;
|
||||
|
||||
@@ -25,7 +25,11 @@ public:
|
||||
|
||||
[[nodiscard]] virtual std::optional<asset_type_t> GetHandlingAssetType() const = 0;
|
||||
virtual AssetCreationResult CreateAsset(const std::string& assetName, AssetCreationContext& context) = 0;
|
||||
virtual void FinalizeZone(AssetCreationContext& context) {};
|
||||
|
||||
virtual bool FinalizeZone(AssetCreationContext& context)
|
||||
{
|
||||
return true;
|
||||
};
|
||||
};
|
||||
|
||||
template<typename AssetType> class AssetCreator : public IAssetCreator
|
||||
|
||||
@@ -73,9 +73,11 @@ namespace
|
||||
return AssetCreationResult::Success(context.AddAsset(std::move(registration)));
|
||||
}
|
||||
|
||||
void FinalizeZone(AssetCreationContext& context) override
|
||||
bool FinalizeZone(AssetCreationContext& context) override
|
||||
{
|
||||
context.GetZoneAssetCreationState<MenuConversionZoneState>().FinalizeSupportingData();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -73,9 +73,11 @@ namespace
|
||||
return AssetCreationResult::Success(context.AddAsset(std::move(registration)));
|
||||
}
|
||||
|
||||
void FinalizeZone(AssetCreationContext& context) override
|
||||
bool FinalizeZone(AssetCreationContext& context) override
|
||||
{
|
||||
context.GetZoneAssetCreationState<MenuConversionZoneState>().FinalizeSupportingData();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -30,23 +30,18 @@ namespace
|
||||
return AssetCreationResult::NoAction();
|
||||
}
|
||||
|
||||
void FinalizeZone(AssetCreationContext& context) override
|
||||
bool FinalizeZone(AssetCreationContext& context) override
|
||||
{
|
||||
// custom maps must have a map_gfx file
|
||||
std::string mapGfxFileName = "map_gfx.fbx";
|
||||
auto mapGfxFile = m_search_path.Open(BSPUtil::getFileNameForBSPAsset(mapGfxFileName));
|
||||
if (!mapGfxFile.IsOpen())
|
||||
return;
|
||||
|
||||
std::unique_ptr<BSPData> bsp = BSP::createBSPData(m_zone.m_name, m_search_path);
|
||||
if (bsp == nullptr)
|
||||
return;
|
||||
return false;
|
||||
|
||||
BSPLinker linker(m_memory, m_search_path, context);
|
||||
if (!linker.linkBSP(bsp.get()))
|
||||
bool result = linker.linkBSP(bsp.get());
|
||||
if (!result)
|
||||
con::error("BSP link has failed.");
|
||||
|
||||
return;
|
||||
return result;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user