2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2025-11-29 15:57:48 +00:00

feat: report on unlinking progress

This commit is contained in:
Jan Laupetin
2025-10-14 23:20:56 +01:00
parent 9fa41ca0d3
commit c6e9cbedda
159 changed files with 686 additions and 802 deletions

View File

@@ -560,9 +560,9 @@ namespace
}
}
void DumpObjMtl(const XModelCommon& common, const AssetDumpingContext& context, const XAssetInfo<XModel>* asset)
void DumpObjMtl(const XModelCommon& common, const AssetDumpingContext& context, const XAssetInfo<XModel>& asset)
{
const auto* model = asset->Asset();
const auto* model = asset.Asset();
const auto mtlFile = context.OpenAssetFile(std::format("model_export/{}.mtl", model->name));
if (!mtlFile)
@@ -575,9 +575,9 @@ namespace
writer->Write(common);
}
void DumpObjLod(const XModelCommon& common, const AssetDumpingContext& context, const XAssetInfo<XModel>* asset, const unsigned lod)
void DumpObjLod(const XModelCommon& common, const AssetDumpingContext& context, const XAssetInfo<XModel>& asset, const unsigned lod)
{
const auto* model = asset->Asset();
const auto* model = asset.Asset();
const auto assetFile = context.OpenAssetFile(GetFileNameForLod(model->name, lod, ".obj"));
if (!assetFile)
@@ -591,9 +591,9 @@ namespace
writer->Write(common);
}
void DumpXModelExportLod(const XModelCommon& common, const AssetDumpingContext& context, const XAssetInfo<XModel>* asset, const unsigned lod)
void DumpXModelExportLod(const XModelCommon& common, const AssetDumpingContext& context, const XAssetInfo<XModel>& asset, const unsigned lod)
{
const auto* model = asset->Asset();
const auto* model = asset.Asset();
const auto assetFile = context.OpenAssetFile(GetFileNameForLod(model->name, lod, ".xmodel_export"));
if (!assetFile)
@@ -604,9 +604,9 @@ namespace
writer->Write(common);
}
void DumpXModelBinLod(const XModelCommon& common, const AssetDumpingContext& context, const XAssetInfo<XModel>* asset, const unsigned lod)
void DumpXModelBinLod(const XModelCommon& common, const AssetDumpingContext& context, const XAssetInfo<XModel>& asset, const unsigned lod)
{
const auto* model = asset->Asset();
const auto* model = asset.Asset();
const auto assetFile = context.OpenAssetFile(GetFileNameForLod(model->name, lod, ".xmodel_bin"));
if (!assetFile)
@@ -619,9 +619,9 @@ namespace
template<typename T>
void DumpGltfLod(
const XModelCommon& common, const AssetDumpingContext& context, const XAssetInfo<XModel>* asset, const unsigned lod, const std::string& extension)
const XModelCommon& common, const AssetDumpingContext& context, const XAssetInfo<XModel>& asset, const unsigned lod, const std::string& extension)
{
const auto* model = asset->Asset();
const auto* model = asset.Asset();
const auto assetFile = context.OpenAssetFile(GetFileNameForLod(model->name, lod, extension));
if (!assetFile)
@@ -634,14 +634,14 @@ namespace
writer->Write(common);
}
void DumpXModelSurfs(const AssetDumpingContext& context, const XAssetInfo<XModel>* asset)
void DumpXModelSurfs(const AssetDumpingContext& context, const XAssetInfo<XModel>& asset)
{
const auto* model = asset->Asset();
const auto* model = asset.Asset();
for (auto currentLod = 0u; currentLod < model->numLods; currentLod++)
{
XModelCommon common;
PopulateXModelWriter(common, context, currentLod, asset->Asset());
PopulateXModelWriter(common, context, currentLod, asset.Asset());
switch (ObjWriting::Configuration.ModelOutputFormat)
{
@@ -841,25 +841,20 @@ namespace
std::ostream& m_stream;
};
void DumpXModelJson(AssetDumpingContext& context, XAssetInfo<XModel>* asset)
void DumpXModelJson(AssetDumpingContext& context, const XAssetInfo<XModel>& asset)
{
const auto assetFile = context.OpenAssetFile(xmodel::GetJsonFileNameForAssetName(asset->m_name));
const auto assetFile = context.OpenAssetFile(xmodel::GetJsonFileNameForAssetName(asset.m_name));
if (!assetFile)
return;
const JsonDumper dumper(context, *assetFile);
dumper.Dump(asset->Asset());
dumper.Dump(asset.Asset());
}
} // namespace
namespace xmodel
{
bool CLASS_NAME::ShouldDump(XAssetInfo<XModel>* asset)
{
return !asset->m_name.empty() && asset->m_name[0] != ',';
}
void CLASS_NAME::DumpAsset(AssetDumpingContext& context, XAssetInfo<XModel>* asset)
void CLASS_NAME::DumpAsset(AssetDumpingContext& context, const XAssetInfo<XModel>& asset)
{
DumpXModelJson(context, asset);
DumpXModelSurfs(context, asset);

View File

@@ -20,7 +20,6 @@ namespace xmodel
class CLASS_NAME final : public AbstractAssetDumper<GAME::XModel>
{
protected:
bool ShouldDump(XAssetInfo<GAME::XModel>* asset) override;
void DumpAsset(AssetDumpingContext& context, XAssetInfo<GAME::XModel>* asset) override;
void DumpAsset(AssetDumpingContext& context, const XAssetInfo<GAME::XModel>& asset) override;
};
} // namespace xmodel