Reduce coupling in the unreal side

This commit is contained in:
2026-02-25 14:48:14 -05:00
parent 948de31f71
commit b149714f20
13 changed files with 161 additions and 162 deletions

View File

@@ -3,7 +3,7 @@
#include "AssetRegistry/IAssetRegistry.h"
#include "AssetRegistry/AssetData.h"
#include "AssetRegistry/AssetRegistryState.h"
#include "LuprexGameModeBase.h"
#include "Kismet/GameplayStatics.h"
#include "Components/Widget.h"
#include "WidgetBlueprint.h"
#include "Blueprint/UserWidget.h"
@@ -15,6 +15,12 @@
const ElxValidOrNotValid NotValid = ElxValidOrNotValid::NotValid;
const ElxValidOrNotValid Valid = ElxValidOrNotValid::Valid;
void UlxAssetLookup::Initialize(FSubsystemCollectionBase& Collection)
{
Super::Initialize(Collection);
RebuildIndex();
}
void UlxAssetLookup::RebuildIndex()
{
IAssetRegistry::GetChecked().WaitForCompletion();
@@ -63,7 +69,7 @@ void UlxAssetLookup::ReportFailedLoad(const FString &ClassName, const FString &N
UObject *UlxAssetLookup::LoadAsset(const UObject *Context, UClass *Class, UClass *ChildOf, const FString &Name)
{
const UlxAssetLookup *Lookup = ALuprexGameModeBase::FromContext(Context)->GetAssetLookup();
const UlxAssetLookup *Lookup = UGameplayStatics::GetGameInstance(Context)->GetSubsystem<UlxAssetLookup>();
const FString *Path = Lookup->AssetPaths.Find(MakeTuple(Class->GetName(), FName(Name)));
if (Path == nullptr)
{