93 lines
3.1 KiB
C++
93 lines
3.1 KiB
C++
////////////////////////////////////////////////////////////
|
|
//
|
|
// AssetLookup.h
|
|
//
|
|
// Provides asset loading by short name. At
|
|
// initialization, scans asset directories and builds
|
|
// a lookup table mapping (class, short name) pairs
|
|
// to full asset paths. Blueprint-callable functions
|
|
// let blueprints load assets by short name.
|
|
//
|
|
////////////////////////////////////////////////////////////
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "UObject/NoExportTypes.h"
|
|
#include "Common.h"
|
|
#include "Templates/Tuple.h"
|
|
#include "AssetLookup.generated.h"
|
|
|
|
class AActor;
|
|
class UUserWidget;
|
|
class UlxLookAtWidget;
|
|
class UStaticMesh;
|
|
class USkeletalMesh;
|
|
class UAnimSequence;
|
|
|
|
////////////////////////////////////////////////////////////
|
|
//
|
|
// UlxAssetLookup
|
|
//
|
|
////////////////////////////////////////////////////////////
|
|
|
|
UCLASS(MinimalAPI)
|
|
class UlxAssetLookup : public UObject
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
private:
|
|
TMap<TTuple<FString, FName>, FString> AssetPaths;
|
|
|
|
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);
|
|
|
|
public:
|
|
void RebuildIndex();
|
|
|
|
// Get a static mesh by name.
|
|
//
|
|
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);
|
|
|
|
// 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);
|
|
|
|
// 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);
|
|
|
|
// Get a tangible class by name.
|
|
//
|
|
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);
|
|
|
|
// Get a widget blueprint by name.
|
|
//
|
|
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);
|
|
|
|
// Get a look-at widget blueprint by name.
|
|
//
|
|
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);
|
|
};
|