Files
integration/Source/Integration/AssetLookup.h

78 lines
3.0 KiB
C
Raw Normal View History

#pragma once
#include "CoreMinimal.h"
#include "UObject/NoExportTypes.h"
2026-02-09 13:54:00 -05:00
#include "Common.h"
2025-11-14 02:41:44 -05:00
#include "Templates/Tuple.h"
#include "AssetLookup.generated.h"
2025-04-07 16:48:27 -04:00
class AActor;
class UUserWidget;
class UlxLookAtWidget;
class UStaticMesh;
2026-02-09 13:54:00 -05:00
class USkeletalMesh;
2025-11-14 02:41:44 -05:00
class UAnimSequence;
2025-04-07 16:48: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:
void AddAssets(const TCHAR *Path, UClass *Class, const TCHAR *NamePrefix);
static UObject *LoadAsset(const UObject *Context, UClass *Class, UClass *ChildOf, const FString &Name, bool ErrorIfNotFound);
2025-11-14 02:41:44 -05:00
public:
void RebuildIndex();
2025-04-07 16:48: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);
2026-02-09 13:54:00 -05:00
// Get a skeletal mesh by name
UFUNCTION(BlueprintCallable, meta = (WorldContext = "Context", ExpandEnumAsExecs="ReturnValue"), Category = "Luprex|Asset Loading")
static ElxValidOrNotValid LoadSkeletalMeshAsset(
USkeletalMesh *&Result,
const UObject *Context, const FString &Name, bool ErrorIfNotFound = false);
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);
};