2025-04-01 22:31:27 -04:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "CoreMinimal.h"
|
|
|
|
|
#include "UObject/NoExportTypes.h"
|
|
|
|
|
#include "CommonTypes.h"
|
2025-11-14 02:41:44 -05:00
|
|
|
#include "Templates/Tuple.h"
|
2025-04-01 22:31:27 -04:00
|
|
|
#include "AssetLookup.generated.h"
|
|
|
|
|
|
2025-04-07 16:48:27 -04:00
|
|
|
class AActor;
|
|
|
|
|
class UUserWidget;
|
|
|
|
|
class UlxLookAtWidget;
|
|
|
|
|
class UStaticMesh;
|
2025-11-14 02:41:44 -05:00
|
|
|
class UAnimSequence;
|
2025-04-07 16:48:27 -04:00
|
|
|
|
2025-04-01 22:31:27 -04:00
|
|
|
UCLASS(MinimalAPI)
|
|
|
|
|
class UlxAssetLookup : public UObject
|
|
|
|
|
{
|
|
|
|
|
GENERATED_BODY()
|
|
|
|
|
|
|
|
|
|
private:
|
2025-11-14 02:41:44 -05:00
|
|
|
//
|
|
|
|
|
// At initialization time, we scan the asset directories
|
|
|
|
|
// to see what assets are present. These maps store the
|
|
|
|
|
// result of the scan. Each entry in the map contains a
|
|
|
|
|
// classname, a short name, and a path:
|
|
|
|
|
//
|
|
|
|
|
// <UAnimSequence, Jump> -> "/Game/AnimSequences/SEQ_Jump"
|
|
|
|
|
//
|
|
|
|
|
TMap<TTuple<FString, FName>, FString> AssetPaths;
|
2025-04-07 16:48:27 -04:00
|
|
|
|
|
|
|
|
private:
|
2025-04-01 22:31:27 -04:00
|
|
|
|
2025-11-14 04:42:04 -05:00
|
|
|
void AddAssets(const TCHAR *Path, UClass *Class, const TCHAR *NamePrefix);
|
2025-04-08 16:31:16 -04:00
|
|
|
|
2025-11-14 04:42:04 -05:00
|
|
|
static UObject *LoadAsset(const UObject *Context, UClass *Class, UClass *ChildOf, const FString &Name, bool ErrorIfNotFound);
|
2025-04-01 22:31:27 -04:00
|
|
|
|
2025-11-14 02:41:44 -05:00
|
|
|
public:
|
|
|
|
|
void RebuildIndex();
|
2025-04-07 16:48:27 -04:00
|
|
|
|
2025-04-01 22:31:27 -04:00
|
|
|
// Get a static mesh by name
|
2025-11-14 02:41:44 -05:00
|
|
|
UFUNCTION(BlueprintCallable, meta = (WorldContext = "Context", ExpandEnumAsExecs="ReturnValue"), Category = "Luprex|Asset Loading")
|
|
|
|
|
static ElxValidOrNotValid LoadStaticMeshAsset(
|
|
|
|
|
UStaticMesh *&Result,
|
|
|
|
|
const UObject *Context, const FString &Name, bool ErrorIfNotFound = false);
|
2025-04-01 22:31:27 -04:00
|
|
|
|
2025-11-14 02:41:44 -05:00
|
|
|
// Get an animation sequence by name.
|
|
|
|
|
UFUNCTION(BlueprintCallable, meta = (WorldContext = "Context", ExpandEnumAsExecs="ReturnValue"), Category = "Luprex|Asset Loading")
|
|
|
|
|
static ElxValidOrNotValid LoadAnimSequenceAsset(
|
|
|
|
|
UAnimSequence *&Result,
|
|
|
|
|
const UObject *Context, const FString &Name, bool ErrorIfNotFound = false);
|
|
|
|
|
|
2025-04-07 16:48:27 -04:00
|
|
|
// Get a tangible class by name
|
2025-11-14 02:41:44 -05:00
|
|
|
UFUNCTION(BlueprintCallable, meta = (WorldContext = "Context", ExpandEnumAsExecs="ReturnValue"), Category = "Luprex|Asset Loading")
|
|
|
|
|
static ElxValidOrNotValid LoadTangibleBlueprintAsset(
|
|
|
|
|
TSubclassOf<AActor> &Result,
|
|
|
|
|
const UObject *Context, const FString &Name, bool ErrorIfNotFound = false);
|
2025-04-07 16:48:27 -04:00
|
|
|
|
|
|
|
|
// Get a widget blueprint by name
|
2025-11-14 02:41:44 -05:00
|
|
|
UFUNCTION(BlueprintCallable, meta = (WorldContext = "Context", ExpandEnumAsExecs="ReturnValue"), Category = "Luprex|Asset Loading")
|
|
|
|
|
static ElxValidOrNotValid LoadUserWidgetAsset(
|
|
|
|
|
TSubclassOf<UUserWidget> &Result,
|
|
|
|
|
const UObject *Context, const FString &Name, bool ErrorIfNotFound = false);
|
2025-04-07 16:48:27 -04:00
|
|
|
|
|
|
|
|
// Get a look-at widget blueprint by name
|
2025-11-14 02:41:44 -05:00
|
|
|
UFUNCTION(BlueprintCallable, meta = (WorldContext = "Context", ExpandEnumAsExecs="ReturnValue"), Category = "Luprex|Asset Loading")
|
|
|
|
|
static ElxValidOrNotValid LoadLuaWidgetAsset(
|
|
|
|
|
TSubclassOf<UlxLuaWidget> &Result,
|
|
|
|
|
const UObject *Context, const FString &Name, bool ErrorIfNotFound = false);
|
2025-04-01 22:31:27 -04:00
|
|
|
};
|