mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-09-01 14:37:25 +00:00
refactor: streamline material dumping
This commit is contained in:
@@ -1,36 +0,0 @@
|
||||
#include "DumperMaterialT6.h"
|
||||
|
||||
#include "Game/T6/Material/JsonMaterialWriterT6.h"
|
||||
#include "Game/T6/Material/MaterialConstantZoneStateT6.h"
|
||||
#include "Material/MaterialCommon.h"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
using namespace T6;
|
||||
|
||||
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 < 0x8000);
|
||||
assert(material->info.hashIndex == 0);
|
||||
assert(material->probeMipBits == 0);
|
||||
DumpMaterialAsJson(*assetFile, *material, context);
|
||||
}
|
@@ -1,17 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "Dumping/AbstractAssetDumper.h"
|
||||
#include "Game/T6/T6.h"
|
||||
|
||||
namespace T6
|
||||
{
|
||||
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 T6
|
@@ -2,12 +2,12 @@
|
||||
|
||||
#include "FontIcon/FontIconDumperT6.h"
|
||||
#include "Game/T6/GameAssetPoolT6.h"
|
||||
#include "Game/T6/Material/MaterialJsonDumperT6.h"
|
||||
#include "Game/T6/XModel/XModelDumperT6.h"
|
||||
#include "Image/ImageDumperT6.h"
|
||||
#include "Leaderboard/LeaderboardJsonDumperT6.h"
|
||||
#include "Localize/LocalizeDumperT6.h"
|
||||
#include "Maps/MapEntsDumperT6.h"
|
||||
#include "Material/DumperMaterialT6.h"
|
||||
#include "ObjWriting.h"
|
||||
#include "PhysConstraints/AssetDumperPhysConstraints.h"
|
||||
#include "PhysPreset/AssetDumperPhysPreset.h"
|
||||
@@ -51,7 +51,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