2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2026-01-13 20:21:48 +00:00

chore: expose marker classes as asset specializations

This commit is contained in:
Jan Laupetin
2025-12-18 13:27:44 +00:00
parent 0ef4979873
commit 1aa4cd9127
10 changed files with 248 additions and 46 deletions

View File

@@ -145,7 +145,7 @@ namespace
LINE("")
LINEF("#include \"{0}_load_db.h\"", Lower(m_env.m_asset->m_definition->m_name))
LINE("")
LINEF("#include \"{0}_mark_db.h\"", Lower(m_env.m_asset->m_definition->m_name))
LINEF("#include \"Game/{0}/AssetMarker{0}.h\"", m_env.m_game)
LINE("")
LINE("#include \"Loading/AssetInfoCollector.h\"")
@@ -238,11 +238,6 @@ namespace
return std::format("Loader_{0}", asset->m_definition->m_name);
}
static std::string MarkerClassName(const StructureInformation* asset)
{
return std::format("Marker_{0}", asset->m_definition->m_name);
}
static std::string VariableDecl(const DataDefinition* def)
{
return std::format("{0}* var{1};", def->GetFullName(), MakeSafeTypeName(def));
@@ -2158,7 +2153,7 @@ namespace
LINE("assert(pAsset != nullptr);")
LINE("")
LINE("AssetInfoCollector assetInfo(m_zone);")
LINEF("{0} marker(assetInfo);", MarkerClassName(m_env.m_asset))
LINEF("AssetMarker<{0}> marker(assetInfo);", m_env.m_asset->m_asset_name)
LINE("marker.Mark(*pAsset);")
LINE("")
LINEF("auto* reallocatedAsset = m_zone.Memory().Alloc<{0}>();", info->m_definition->GetFullName())

View File

@@ -32,7 +32,7 @@ namespace
LINE("#pragma once")
LINE("")
LINEF("#include \"Game/{0}/{0}.h\"", m_env.m_game)
LINE("#include \"Marking/AssetMarker.h\"")
LINE("#include \"Marking/BaseAssetMarker.h\"")
LINE("#include \"Marking/AssetVisitor.h\"")
LINE("")
LINE("#include <string>")
@@ -40,7 +40,7 @@ namespace
LINEF("namespace {0}", m_env.m_game)
LINE("{")
m_intendation++;
LINEF("class {0} final : public AssetMarker", MarkerClassName(m_env.m_asset))
LINEF("class {0} final : public BaseAssetMarker", MarkerClassName(m_env.m_asset))
LINE("{")
m_intendation++;
@@ -107,6 +107,8 @@ namespace
LINE("};")
m_intendation--;
LINE("}")
LINE("")
LINEF("DEFINE_MARKER_CLASS_FOR_ASSET({0}::{1}, {0}::{2})", m_env.m_game, m_env.m_asset->m_asset_name, MarkerClassName(m_env.m_asset))
}
void Source()
@@ -233,7 +235,7 @@ namespace
LINEF("{0}::{0}(AssetVisitor& visitor)", MarkerClassName(m_env.m_asset))
m_intendation++;
LINE(": AssetMarker(visitor)")
LINE(": BaseAssetMarker(visitor)")
m_intendation--;
LINE("{")