Add AssetLookup module to find assets by name.
This commit is contained in:
@@ -4,56 +4,15 @@
|
||||
#include "TangibleManager.h"
|
||||
#include "Tangible.h"
|
||||
#include "LuprexGameModeBase.h"
|
||||
#include "AssetRegistry/AssetRegistryModule.h"
|
||||
#include "AssetRegistry/ARFilter.h"
|
||||
|
||||
UFunction *UlxTangibleManager::GetAnimationQueueChanged(UClass *uclass) {
|
||||
UFunction *result = uclass->FindFunctionByName(FName(TEXT("Animation Queue Changed")));
|
||||
if (result == nullptr) return nullptr;
|
||||
if (result->ParmsSize != 0) return nullptr;
|
||||
return result;
|
||||
}
|
||||
|
||||
UClass *UlxTangibleManager::GetTangibleClass(const FString &name) {
|
||||
UPackage *Pack = LoadObject<UPackage>(nullptr, TEXT("/Game/Tangibles"));
|
||||
UE_LOG(LogBlueprint, Verbose, TEXT("Pack=%ld"), int64(Pack));
|
||||
if (name.IsEmpty()) {
|
||||
return nullptr;
|
||||
}
|
||||
if (name == TEXT("unknown")) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
FString path(TEXT("/Game/Tangibles/"));
|
||||
path += TEXT("Tan");
|
||||
path += name;
|
||||
path += TCHAR('.');
|
||||
path += TEXT("Tan");
|
||||
path += name;
|
||||
path += TCHAR('_');
|
||||
path += TCHAR('C');
|
||||
UClass *result = LoadObject<UClass>(nullptr, *path);
|
||||
if (result == nullptr) {
|
||||
UE_LOG(LogBlueprint, Error, TEXT("No such UClass: %s"), *path);
|
||||
return nullptr;
|
||||
}
|
||||
if (!result->IsChildOf(AActor::StaticClass())) {
|
||||
UE_LOG(LogBlueprint, Error, TEXT("UClass is not an actor: %s"), *path);
|
||||
return nullptr;
|
||||
}
|
||||
UFunction *aqchanged = GetAnimationQueueChanged(result);
|
||||
if (aqchanged == nullptr) {
|
||||
UE_LOG(LogBlueprint, Error, TEXT("UClass does not have 'Animation Queue Changed' function: %s"), *path);
|
||||
return nullptr;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
UlxTangibleManager::UlxTangibleManager() {
|
||||
World = nullptr;
|
||||
PossessedTangible = nullptr;
|
||||
}
|
||||
|
||||
void UlxTangibleManager::Init(UWorld* world, ALuprexGameModeBase *gamemode) {
|
||||
World = world;
|
||||
void UlxTangibleManager::Init(ALuprexGameModeBase *gamemode) {
|
||||
GameMode = gamemode;
|
||||
}
|
||||
|
||||
@@ -71,7 +30,7 @@ UlxTangible* UlxTangibleManager::MakeTangible(int64 id) {
|
||||
check(id > 0);
|
||||
UlxTangible*& t = IdToTangible.FindOrAdd(id);
|
||||
if (t == nullptr) {
|
||||
t = NewObject<UlxTangible>();
|
||||
t = NewObject<UlxTangible>(this);
|
||||
t->Init(this, id);
|
||||
}
|
||||
return t;
|
||||
|
||||
Reference in New Issue
Block a user