mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-12-27 12:31:50 +00:00
chore: adjust asset data when taking from global asset pools
This commit is contained in:
43
src/ObjLoading/Asset/GlobalAssetPoolsLoader.cpp
Normal file
43
src/ObjLoading/Asset/GlobalAssetPoolsLoader.cpp
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
#include "GlobalAssetPoolsLoader.h"
|
||||||
|
|
||||||
|
GlobalAssetPoolsAssetStealer::GlobalAssetPoolsAssetStealer(GenericAssetRegistration& registration, Zone& zone, Zone& foreignZone, AssetCreationContext& context)
|
||||||
|
: m_registration(registration),
|
||||||
|
m_zone(zone),
|
||||||
|
m_foreign_zone(foreignZone),
|
||||||
|
m_context(context),
|
||||||
|
m_failure(false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<XAssetInfoGeneric*> GlobalAssetPoolsAssetStealer::Visit_Dependency(const asset_type_t assetType, const char* assetName)
|
||||||
|
{
|
||||||
|
auto assetNameToLoad = assetName;
|
||||||
|
if (assetNameToLoad && assetNameToLoad[0] == ',')
|
||||||
|
assetNameToLoad = &assetNameToLoad[1];
|
||||||
|
|
||||||
|
auto* newDependency = m_context.LoadDependencyGeneric(assetType, assetNameToLoad);
|
||||||
|
if (!newDependency)
|
||||||
|
{
|
||||||
|
m_failure = true;
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_registration.AddDependency(newDependency);
|
||||||
|
return newDependency;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<scr_string_t> GlobalAssetPoolsAssetStealer::Visit_ScriptString(scr_string_t scriptString)
|
||||||
|
{
|
||||||
|
// Make sure any used script string is available in the created zone
|
||||||
|
return m_zone.m_script_strings.AddOrGetScriptString(m_foreign_zone.m_script_strings.CValue(scriptString));
|
||||||
|
}
|
||||||
|
|
||||||
|
void GlobalAssetPoolsAssetStealer::Visit_IndirectAssetRef(const asset_type_t assetType, const char* assetName)
|
||||||
|
{
|
||||||
|
m_registration.AddIndirectAssetReference(m_context.LoadIndirectAssetReferenceGeneric(assetType, assetName));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GlobalAssetPoolsAssetStealer::Failed() const
|
||||||
|
{
|
||||||
|
return m_failure;
|
||||||
|
}
|
||||||
@@ -1,7 +1,30 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Asset/IAssetCreator.h"
|
#include "Asset/IAssetCreator.h"
|
||||||
|
#include "Marking/AssetVisitor.h"
|
||||||
|
#include "Marking/BaseAssetMarker.h"
|
||||||
#include "Pool/GlobalAssetPool.h"
|
#include "Pool/GlobalAssetPool.h"
|
||||||
|
|
||||||
|
class GlobalAssetPoolsAssetStealer : public AssetVisitor
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GlobalAssetPoolsAssetStealer(GenericAssetRegistration& registration, Zone& zone, Zone& foreignZone, AssetCreationContext& context);
|
||||||
|
|
||||||
|
std::optional<XAssetInfoGeneric*> Visit_Dependency(asset_type_t assetType, const char* assetName) override;
|
||||||
|
std::optional<scr_string_t> Visit_ScriptString(scr_string_t scriptString) override;
|
||||||
|
void Visit_IndirectAssetRef(asset_type_t assetType, const char* assetName) override;
|
||||||
|
|
||||||
|
[[nodiscard]] bool Failed() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
GenericAssetRegistration& m_registration;
|
||||||
|
Zone& m_zone;
|
||||||
|
Zone& m_foreign_zone;
|
||||||
|
AssetCreationContext& m_context;
|
||||||
|
|
||||||
|
bool m_failure;
|
||||||
|
};
|
||||||
|
|
||||||
template<typename AssetType> class GlobalAssetPoolsLoader : public AssetCreator<AssetType>
|
template<typename AssetType> class GlobalAssetPoolsLoader : public AssetCreator<AssetType>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -21,28 +44,12 @@ public:
|
|||||||
|
|
||||||
AssetRegistration<AssetType> registration(assetName, existingAsset->Asset());
|
AssetRegistration<AssetType> registration(assetName, existingAsset->Asset());
|
||||||
|
|
||||||
for (const auto* dependency : existingAsset->m_dependencies)
|
GlobalAssetPoolsAssetStealer stealer(registration, m_zone, *existingAsset->m_zone, context);
|
||||||
{
|
AssetMarker<AssetType> marker(stealer);
|
||||||
auto* newDependency = context.LoadDependencyGeneric(dependency->m_type, dependency->m_name);
|
marker.Mark(existingAsset->Asset());
|
||||||
if (newDependency)
|
|
||||||
registration.AddDependency(newDependency);
|
|
||||||
else
|
|
||||||
return AssetCreationResult::Failure();
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const auto& indirectAssetReference : existingAsset->m_indirect_asset_references)
|
|
||||||
registration.AddIndirectAssetReference(context.LoadIndirectAssetReferenceGeneric(indirectAssetReference.m_type, indirectAssetReference.m_name));
|
|
||||||
|
|
||||||
// Make sure any used script string is available in the created zone
|
|
||||||
// The replacement of the scr_string_t values will be done upon writing
|
|
||||||
for (const auto scrString : existingAsset->m_used_script_strings)
|
|
||||||
m_zone.m_script_strings.AddOrGetScriptString(existingAsset->m_zone->m_script_strings.CValue(scrString));
|
|
||||||
|
|
||||||
auto* newAsset = context.AddAsset(std::move(registration));
|
auto* newAsset = context.AddAsset(std::move(registration));
|
||||||
|
|
||||||
// Make sure we remember this asset came from another zone
|
|
||||||
newAsset->m_zone = existingAsset->m_zone;
|
|
||||||
|
|
||||||
return AssetCreationResult::Success(newAsset);
|
return AssetCreationResult::Success(newAsset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "ObjLoaderIW3.h"
|
#include "ObjLoaderIW3.h"
|
||||||
|
|
||||||
#include "Asset/GlobalAssetPoolsLoader.h"
|
#include "Asset/GlobalAssetPoolsLoader.h"
|
||||||
|
#include "Game/IW3/AssetMarkerIW3.h"
|
||||||
#include "Game/IW3/GameIW3.h"
|
#include "Game/IW3/GameIW3.h"
|
||||||
#include "Game/IW3/IW3.h"
|
#include "Game/IW3/IW3.h"
|
||||||
#include "Game/IW3/XModel/LoaderXModelIW3.h"
|
#include "Game/IW3/XModel/LoaderXModelIW3.h"
|
||||||
@@ -65,7 +66,7 @@ namespace
|
|||||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetSound>>(zone));
|
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetSound>>(zone));
|
||||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetSoundCurve>>(zone));
|
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetSoundCurve>>(zone));
|
||||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetLoadedSound>>(zone));
|
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetLoadedSound>>(zone));
|
||||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetClipMap>>(zone));
|
// collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetClipMap>>(zone));
|
||||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetClipMapPvs>>(zone));
|
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetClipMapPvs>>(zone));
|
||||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetComWorld>>(zone));
|
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetComWorld>>(zone));
|
||||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetGameWorldSp>>(zone));
|
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetGameWorldSp>>(zone));
|
||||||
@@ -78,7 +79,7 @@ namespace
|
|||||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetMenu>>(zone));
|
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetMenu>>(zone));
|
||||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetLocalize>>(zone));
|
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetLocalize>>(zone));
|
||||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetWeapon>>(zone));
|
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetWeapon>>(zone));
|
||||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetSoundDriverGlobals>>(zone));
|
// collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetSoundDriverGlobals>>(zone));
|
||||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetFx>>(zone));
|
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetFx>>(zone));
|
||||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetImpactFx>>(zone));
|
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetImpactFx>>(zone));
|
||||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetRawFile>>(zone));
|
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetRawFile>>(zone));
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "ObjLoaderIW4.h"
|
#include "ObjLoaderIW4.h"
|
||||||
|
|
||||||
#include "Asset/GlobalAssetPoolsLoader.h"
|
#include "Asset/GlobalAssetPoolsLoader.h"
|
||||||
|
#include "Game/IW4/AssetMarkerIW4.h"
|
||||||
#include "Game/IW4/GameIW4.h"
|
#include "Game/IW4/GameIW4.h"
|
||||||
#include "Game/IW4/IW4.h"
|
#include "Game/IW4/IW4.h"
|
||||||
#include "Game/IW4/XModel/LoaderXModelIW4.h"
|
#include "Game/IW4/XModel/LoaderXModelIW4.h"
|
||||||
@@ -79,7 +80,7 @@ namespace
|
|||||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetPhysPreset>>(zone));
|
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetPhysPreset>>(zone));
|
||||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetPhysCollMap>>(zone));
|
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetPhysCollMap>>(zone));
|
||||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetXAnim>>(zone));
|
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetXAnim>>(zone));
|
||||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetXModelSurfs>>(zone));
|
// collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetXModelSurfs>>(zone));
|
||||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetXModel>>(zone));
|
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetXModel>>(zone));
|
||||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetMaterial>>(zone));
|
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetMaterial>>(zone));
|
||||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetPixelShader>>(zone));
|
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetPixelShader>>(zone));
|
||||||
@@ -90,7 +91,7 @@ namespace
|
|||||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetSound>>(zone));
|
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetSound>>(zone));
|
||||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetSoundCurve>>(zone));
|
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetSoundCurve>>(zone));
|
||||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetLoadedSound>>(zone));
|
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetLoadedSound>>(zone));
|
||||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetClipMapSp>>(zone));
|
// collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetClipMapSp>>(zone));
|
||||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetClipMapMp>>(zone));
|
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetClipMapMp>>(zone));
|
||||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetComWorld>>(zone));
|
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetComWorld>>(zone));
|
||||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetGameWorldSp>>(zone));
|
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetGameWorldSp>>(zone));
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "ObjLoaderIW5.h"
|
#include "ObjLoaderIW5.h"
|
||||||
|
|
||||||
#include "Asset/GlobalAssetPoolsLoader.h"
|
#include "Asset/GlobalAssetPoolsLoader.h"
|
||||||
|
#include "Game/IW5/AssetMarkerIW5.h"
|
||||||
#include "Game/IW5/GameIW5.h"
|
#include "Game/IW5/GameIW5.h"
|
||||||
#include "Game/IW5/IW5.h"
|
#include "Game/IW5/IW5.h"
|
||||||
#include "Game/IW5/XModel/LoaderXModelIW5.h"
|
#include "Game/IW5/XModel/LoaderXModelIW5.h"
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "ObjLoaderT5.h"
|
#include "ObjLoaderT5.h"
|
||||||
|
|
||||||
#include "Asset/GlobalAssetPoolsLoader.h"
|
#include "Asset/GlobalAssetPoolsLoader.h"
|
||||||
|
#include "Game/T5/AssetMarkerT5.h"
|
||||||
#include "Game/T5/GameT5.h"
|
#include "Game/T5/GameT5.h"
|
||||||
#include "Game/T5/T5.h"
|
#include "Game/T5/T5.h"
|
||||||
#include "Game/T5/XModel/LoaderXModelT5.h"
|
#include "Game/T5/XModel/LoaderXModelT5.h"
|
||||||
@@ -71,7 +72,7 @@ namespace
|
|||||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetImage>>(zone));
|
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetImage>>(zone));
|
||||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetSoundBank>>(zone));
|
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetSoundBank>>(zone));
|
||||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetSoundPatch>>(zone));
|
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetSoundPatch>>(zone));
|
||||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetClipMap>>(zone));
|
// collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetClipMap>>(zone));
|
||||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetClipMapPvs>>(zone));
|
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetClipMapPvs>>(zone));
|
||||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetComWorld>>(zone));
|
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetComWorld>>(zone));
|
||||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetGameWorldSp>>(zone));
|
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetGameWorldSp>>(zone));
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include "Asset/GlobalAssetPoolsLoader.h"
|
#include "Asset/GlobalAssetPoolsLoader.h"
|
||||||
#include "FontIcon/CsvLoaderFontIconT6.h"
|
#include "FontIcon/CsvLoaderFontIconT6.h"
|
||||||
#include "FontIcon/JsonLoaderFontIconT6.h"
|
#include "FontIcon/JsonLoaderFontIconT6.h"
|
||||||
|
#include "Game/T6/AssetMarkerT6.h"
|
||||||
#include "Game/T6/CommonT6.h"
|
#include "Game/T6/CommonT6.h"
|
||||||
#include "Game/T6/GameAssetPoolT6.h"
|
#include "Game/T6/GameAssetPoolT6.h"
|
||||||
#include "Game/T6/GameT6.h"
|
#include "Game/T6/GameT6.h"
|
||||||
@@ -340,7 +341,7 @@ namespace T6
|
|||||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetImage>>(zone));
|
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetImage>>(zone));
|
||||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetSoundBank>>(zone));
|
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetSoundBank>>(zone));
|
||||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetSoundPatch>>(zone));
|
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetSoundPatch>>(zone));
|
||||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetClipMap>>(zone));
|
// collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetClipMap>>(zone));
|
||||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetClipMapPvs>>(zone));
|
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetClipMapPvs>>(zone));
|
||||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetComWorld>>(zone));
|
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetComWorld>>(zone));
|
||||||
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetGameWorldSp>>(zone));
|
collection.AddAssetCreator(std::make_unique<GlobalAssetPoolsLoader<AssetGameWorldSp>>(zone));
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ function ZoneCommon:include(includes)
|
|||||||
ObjCommon:include(includes)
|
ObjCommon:include(includes)
|
||||||
Parser:include(includes)
|
Parser:include(includes)
|
||||||
Cryptography:include(includes)
|
Cryptography:include(includes)
|
||||||
|
ZoneCode:include(includes)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -21,6 +22,7 @@ function ZoneCommon:link(links)
|
|||||||
links:linkto(Parser)
|
links:linkto(Parser)
|
||||||
links:linkto(Utils)
|
links:linkto(Utils)
|
||||||
links:linkto(lzx)
|
links:linkto(lzx)
|
||||||
|
ZoneCode:use()
|
||||||
end
|
end
|
||||||
|
|
||||||
function ZoneCommon:use()
|
function ZoneCommon:use()
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class AssetVisitor
|
|||||||
public:
|
public:
|
||||||
virtual ~AssetVisitor() = default;
|
virtual ~AssetVisitor() = default;
|
||||||
|
|
||||||
virtual std::optional<XAssetInfoGeneric> Visit_Dependency(asset_type_t assetType, const char* assetName)
|
virtual std::optional<XAssetInfoGeneric*> Visit_Dependency(asset_type_t assetType, const char* assetName)
|
||||||
{
|
{
|
||||||
// Do nothing by default
|
// Do nothing by default
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
|
|||||||
@@ -25,6 +25,9 @@ void BaseAssetMarker::MarkArray_ScriptString(scr_string_t* scriptStringArray, co
|
|||||||
|
|
||||||
void BaseAssetMarker::Mark_IndirectAssetRef(const asset_type_t assetType, const char* assetName) const
|
void BaseAssetMarker::Mark_IndirectAssetRef(const asset_type_t assetType, const char* assetName) const
|
||||||
{
|
{
|
||||||
|
if (!assetName)
|
||||||
|
return;
|
||||||
|
|
||||||
m_visitor.Visit_IndirectAssetRef(assetType, assetName);
|
m_visitor.Visit_IndirectAssetRef(assetType, assetName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ protected:
|
|||||||
|
|
||||||
const auto result = m_visitor.Visit_Dependency(AssetType::EnumEntry, AssetName<AssetType>(*asset));
|
const auto result = m_visitor.Visit_Dependency(AssetType::EnumEntry, AssetName<AssetType>(*asset));
|
||||||
if (result.has_value())
|
if (result.has_value())
|
||||||
asset = static_cast<std::add_pointer_t<typename AssetType::Type>>(result->m_ptr);
|
asset = static_cast<std::add_pointer_t<typename AssetType::Type>>((*result)->m_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mark_ScriptString(scr_string_t& scriptString) const;
|
void Mark_ScriptString(scr_string_t& scriptString) const;
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ std::vector<IndirectAssetReference> AssetInfoCollector::GetIndirectAssetReferenc
|
|||||||
return assetReferences;
|
return assetReferences;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<XAssetInfoGeneric> AssetInfoCollector::Visit_Dependency(const asset_type_t assetType, const char* assetName)
|
std::optional<XAssetInfoGeneric*> AssetInfoCollector::Visit_Dependency(const asset_type_t assetType, const char* assetName)
|
||||||
{
|
{
|
||||||
auto* assetInfo = m_zone.m_pools->GetAsset(assetType, assetName);
|
auto* assetInfo = m_zone.m_pools->GetAsset(assetType, assetName);
|
||||||
if (assetInfo == nullptr)
|
if (assetInfo == nullptr)
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public:
|
|||||||
[[nodiscard]] std::vector<scr_string_t> GetUsedScriptStrings() const;
|
[[nodiscard]] std::vector<scr_string_t> GetUsedScriptStrings() const;
|
||||||
[[nodiscard]] std::vector<IndirectAssetReference> GetIndirectAssetReferences() const;
|
[[nodiscard]] std::vector<IndirectAssetReference> GetIndirectAssetReferences() const;
|
||||||
|
|
||||||
std::optional<XAssetInfoGeneric> Visit_Dependency(asset_type_t assetType, const char* assetName) override;
|
std::optional<XAssetInfoGeneric*> Visit_Dependency(asset_type_t assetType, const char* assetName) override;
|
||||||
std::optional<scr_string_t> Visit_ScriptString(scr_string_t scriptString) override;
|
std::optional<scr_string_t> Visit_ScriptString(scr_string_t scriptString) override;
|
||||||
void Visit_IndirectAssetRef(asset_type_t assetType, const char* assetName) override;
|
void Visit_IndirectAssetRef(asset_type_t assetType, const char* assetName) override;
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,9 @@ scr_string_t AssetWriter::UseScriptString(const scr_string_t scrString) const
|
|||||||
if (m_asset->m_zone == &m_zone)
|
if (m_asset->m_zone == &m_zone)
|
||||||
return scrString;
|
return scrString;
|
||||||
|
|
||||||
|
// This swap should have already been performed in GlobalAssetPoolsLoader
|
||||||
|
assert(false);
|
||||||
|
|
||||||
const auto strValue = m_asset->m_zone->m_script_strings.CValue(scrString);
|
const auto strValue = m_asset->m_zone->m_script_strings.CValue(scrString);
|
||||||
return m_zone.m_script_strings.GetScriptString(strValue);
|
return m_zone.m_script_strings.GetScriptString(strValue);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user