mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-10-30 10:06:57 +00:00
refactor: streamline material dumping
This commit is contained in:
@@ -1,35 +0,0 @@
|
||||
#include "DumperMaterialT5.h"
|
||||
|
||||
#include "Game/T5/Material/JsonMaterialWriterT5.h"
|
||||
#include "Game/T5/Material/MaterialConstantZoneStateT5.h"
|
||||
#include "Material/MaterialCommon.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
using namespace T5;
|
||||
|
||||
void AssetDumperMaterial::DumpPool(AssetDumpingContext& context, AssetPool<Material>* pool)
|
||||
{
|
||||
auto* materialConstantState = context.GetZoneAssetDumperState<MaterialConstantZoneState>();
|
||||
materialConstantState->ExtractNamesFromZone();
|
||||
|
||||
AbstractAssetDumper::DumpPool(context, pool);
|
||||
}
|
||||
|
||||
bool AssetDumperMaterial::ShouldDump(XAssetInfo<Material>* asset)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void AssetDumperMaterial::DumpAsset(AssetDumpingContext& context, XAssetInfo<Material>* asset)
|
||||
{
|
||||
const auto assetFile = context.OpenAssetFile(material::GetFileNameForAssetName(asset->m_name));
|
||||
|
||||
if (!assetFile)
|
||||
return;
|
||||
|
||||
const auto* material = asset->Asset();
|
||||
assert(material->info.gameFlags < 0x400);
|
||||
assert(material->maxStreamedMips == 0);
|
||||
DumpMaterialAsJson(*assetFile, *material, context);
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/T5/T5.h"
|
||||
|
||||
namespace T5
|
||||
{
|
||||
class AssetDumperMaterial final : public AbstractAssetDumper<Material>
|
||||
{
|
||||
public:
|
||||
void DumpPool(AssetDumpingContext& context, AssetPool<Material>* pool) override;
|
||||
|
||||
protected:
|
||||
bool ShouldDump(XAssetInfo<Material>* asset) override;
|
||||
void DumpAsset(AssetDumpingContext& context, XAssetInfo<Material>* asset) override;
|
||||
};
|
||||
} // namespace T5
|
||||
@@ -1,10 +1,10 @@
|
||||
#include "ObjWriterT5.h"
|
||||
|
||||
#include "Game/T5/GameAssetPoolT5.h"
|
||||
#include "Game/T5/Material/MaterialJsonDumperT5.h"
|
||||
#include "Game/T5/XModel/XModelDumperT5.h"
|
||||
#include "Image/ImageDumperT5.h"
|
||||
#include "Localize/LocalizeDumperT5.h"
|
||||
#include "Material/DumperMaterialT5.h"
|
||||
#include "ObjWriting.h"
|
||||
#include "PhysConstraints/AssetDumperPhysConstraints.h"
|
||||
#include "PhysPreset/AssetDumperPhysPreset.h"
|
||||
@@ -31,7 +31,7 @@ bool ObjWriter::DumpZone(AssetDumpingContext& context) const
|
||||
// DUMP_ASSET_POOL(AssetDumperDestructibleDef, m_destructible_def, ASSET_TYPE_DESTRUCTIBLEDEF)
|
||||
// DUMP_ASSET_POOL(AssetDumperXAnimParts, m_xanim_parts, ASSET_TYPE_XANIMPARTS)
|
||||
DUMP_ASSET_POOL(AssetDumperXModel, m_xmodel, ASSET_TYPE_XMODEL)
|
||||
DUMP_ASSET_POOL(AssetDumperMaterial, m_material, ASSET_TYPE_MATERIAL)
|
||||
DUMP_ASSET_POOL(material::JsonDumper, m_material, ASSET_TYPE_MATERIAL)
|
||||
// DUMP_ASSET_POOL(AssetDumperTechniqueSet, m_technique_set, ASSET_TYPE_TECHNIQUE_SET)
|
||||
DUMP_ASSET_POOL(image::Dumper, m_image, ASSET_TYPE_IMAGE)
|
||||
// DUMP_ASSET_POOL(AssetDumperSndBank, m_sound_bank, ASSET_TYPE_SOUND)
|
||||
|
||||
Reference in New Issue
Block a user