Files
integration/Source/Integration/AssetLookup.h

65 lines
2.2 KiB
C++

#pragma once
#include "CoreMinimal.h"
#include "UObject/NoExportTypes.h"
#include "CommonTypes.h"
#include "AssetLookup.generated.h"
class AActor;
class UUserWidget;
class UlxLookAtWidget;
class UStaticMesh;
UCLASS(MinimalAPI)
class UlxAssetLookup : public UObject
{
GENERATED_BODY()
private:
// 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;
// Map from asset name to full loadable path.
UPROPERTY()
TMap<FName, FString> CachedWidgets;
private:
void ScanTangibles();
void ScanStaticMeshes();
void ScanWidgets();
public:
void RebuildIndex();
// Get the full LoadObject path of a Tangible.
FString TangibleLoadPath(const FName &AssetName) const;
// Get the full LoadObject path of a Static Mesh.
FString StaticMeshLoadPath(const FName &AssetName) const;
// Get the full LoadObject path of a Widget Blueprint.
FString WidgetLoadPath(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, bool ErrorIfNotFound = false, bool ErrorIfInvalid = true);
// Get a tangible class by name
UFUNCTION(BlueprintPure, meta = (WorldContext = "Context"), Category = "Luprex|Miscellaneous")
static TSubclassOf<AActor> GetTangibleClassByName(const UObject *Context, const FString &Name, bool ErrorIfNotFound = false, bool ErrorIfInvalid = true);
// Get a widget blueprint by name
UFUNCTION(BlueprintPure, meta = (WorldContext = "Context"), Category = "Luprex|Miscellaneous")
static TSubclassOf<UUserWidget> GetWidgetByName(const UObject *Context, const FString &Name, bool ErrorIfNotFound = false, bool ErrorIfInvalid = true);
// Get a look-at widget blueprint by name
UFUNCTION(BlueprintPure, meta = (WorldContext = "Context"), Category = "Luprex|Miscellaneous")
static TSubclassOf<UlxLookAtWidget> GetLookAtWidgetByName(const UObject *Context, const FString &Name, bool ErrorIfNotFound = false, bool ErrorIfInvalid = true);
};