Add AssetLookup module to find assets by name.
This commit is contained in:
43
Source/Integration/AssetLookup.h
Normal file
43
Source/Integration/AssetLookup.h
Normal 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);
|
||||
};
|
||||
Reference in New Issue
Block a user