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

@@ -0,0 +1,43 @@
#pragma once
#include "CoreMinimal.h"
#include "UObject/NoExportTypes.h"
#include "CommonTypes.h"
#include "AssetLookup.generated.h"
UCLASS(MinimalAPI)
class UlxAssetLookup : public UObject
{
GENERATED_BODY()
private:
mutable FCriticalSection Mutex;
// Map from asset name to full loadable path.
UPROPERTY()
TMap<FName, FString> CachedTangibles;
// Map from asset name to to full loadable path.
UPROPERTY()
TMap<FName, FString> CachedStaticMeshes;
public:
void RebuildIndex();
void ScanTangibles();
void ScanStaticMeshes();
// Get the full path name of a
FString TangibleLoadPath(const FName &AssetName) const;
// Get a static mesh by its asset name.
FString StaticMeshLoadPath(const FName &AssetName) const;
// Get a static mesh by name
UFUNCTION(BlueprintPure, meta = (WorldContext = "Context"), Category = "Luprex|Miscellaneous")
static UStaticMesh *GetStaticMeshByName(const UObject *Context, const FString &Name);
// Get a static mesh by name
UFUNCTION(BlueprintPure, meta = (WorldContext = "Context"), Category = "Luprex|Miscellaneous")
static UClass *GetTangibleClassByName(const UObject *Context, const FString &Name);
};