Add AssetLookup module to find assets by name.

This commit is contained in:
2025-04-01 22:31:27 -04:00
parent b26d56048f
commit aa511b9b8c
11 changed files with 250 additions and 78 deletions

View File

@@ -18,7 +18,8 @@ DEFINE_LOG_CATEGORY(LogLuprexIntegration);
ALuprexGameModeBase::ALuprexGameModeBase()
{
TangibleManager = NewObject<UlxTangibleManager>();
TangibleManager = nullptr;
AssetLookup = nullptr;
PlayerId = 0;
EngineSeconds = 0.0;
//PrimaryActorTick.bCanEverTick = true; // Probably wrong
@@ -58,6 +59,11 @@ void ALuprexGameModeBase::ResetToInitialState()
TangibleManager = nullptr;
}
if (AssetLookup != nullptr) {
AssetLookup->ConditionalBeginDestroy();
AssetLookup = nullptr;
}
// Shut down the thread
LuprexUpdateTask.Shutdown();
@@ -301,9 +307,13 @@ void ALuprexGameModeBase::InitializeGlobalState()
LuprexUpdateTask.Startup(this);
}
// Initialize the asset lookup table.
AssetLookup = NewObject<UlxAssetLookup>(this);
AssetLookup->RebuildIndex();
// Initialize the tangible manager.
TangibleManager = NewObject<UlxTangibleManager>();
TangibleManager->Init(GetWorld(), this);
TangibleManager = NewObject<UlxTangibleManager>(this);
TangibleManager->Init(this);
// If somebody generates a log message that's severe enough, break to debugger.
BreakToDebuggerLogVerbosityDevice.Reset(
@@ -319,7 +329,7 @@ int64 ALuprexGameModeBase::GetPlayerId() {
return PlayerId;
}
ALuprexGameModeBase *ALuprexGameModeBase::FromContext(UObject *context) {
ALuprexGameModeBase *ALuprexGameModeBase::FromContext(const UObject *context) {
ALuprexGameModeBase *result = context->GetWorld()->GetAuthGameMode<ALuprexGameModeBase>();
if (result == nullptr) {
UE_LOG(LogBlueprint, Fatal, TEXT("Not currently using a Luprex Game Mode."));