Got the whole look-at demo up and running.
This commit is contained in:
BIN
Content/Luprex/lxGameMode.uasset
LFS
BIN
Content/Luprex/lxGameMode.uasset
LFS
Binary file not shown.
@@ -93,85 +93,87 @@ FString UlxAssetLookup::WidgetLoadPath(const FName &AssetName) const
|
|||||||
return *Result;
|
return *Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
UStaticMesh *UlxAssetLookup::GetStaticMeshByName(const UObject *Context, const FString &Name)
|
UStaticMesh *UlxAssetLookup::GetStaticMeshByName(const UObject *Context, const FString &Name, bool ErrorIfNotFound, bool ErrorIfInvalid)
|
||||||
{
|
{
|
||||||
ALuprexGameModeBase *mode = ALuprexGameModeBase::FromContext(Context);
|
ALuprexGameModeBase *mode = ALuprexGameModeBase::FromContext(Context);
|
||||||
FString Path = mode->GetAssetLookup()->StaticMeshLoadPath(FName(FString("SM_") + Name));
|
FString Path = mode->GetAssetLookup()->StaticMeshLoadPath(FName(FString("SM_") + Name));
|
||||||
if (Path.IsEmpty())
|
if (Path.IsEmpty())
|
||||||
{
|
{
|
||||||
UE_LOG(LogLuprexIntegration, Error, TEXT("Static mesh not on search path: %s"), *Name);
|
if (ErrorIfNotFound) UE_LOG(LogLuprexIntegration, Error, TEXT("Static mesh not on search path: %s"), *Name);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
UStaticMesh *Result = LoadObject<UStaticMesh>(nullptr, *Path);
|
UStaticMesh *Result = LoadObject<UStaticMesh>(nullptr, *Path);
|
||||||
if (Result == nullptr) {
|
if (Result == nullptr) {
|
||||||
UE_LOG(LogLuprexIntegration, Error, TEXT("Cannot load static mesh: %s"), *Path);
|
if (ErrorIfInvalid) UE_LOG(LogLuprexIntegration, Error, TEXT("Cannot load static mesh: %s"), *Path);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
TSubclassOf<AActor> UlxAssetLookup::GetTangibleClassByName(const UObject *Context, const FString &Name) {
|
TSubclassOf<AActor> UlxAssetLookup::GetTangibleClassByName(const UObject *Context, const FString &Name, bool ErrorIfNotFound, bool ErrorIfInvalid) {
|
||||||
ALuprexGameModeBase *mode = ALuprexGameModeBase::FromContext(Context);
|
ALuprexGameModeBase *mode = ALuprexGameModeBase::FromContext(Context);
|
||||||
FString Path = mode->GetAssetLookup()->TangibleLoadPath(FName(FString("TAN_") + Name));
|
FString Path = mode->GetAssetLookup()->TangibleLoadPath(FName(FString("TAN_") + Name));
|
||||||
if (Path.IsEmpty())
|
if (Path.IsEmpty())
|
||||||
{
|
{
|
||||||
UE_LOG(LogLuprexIntegration, Error, TEXT("Tangible not on search path: %s"), *Name);
|
if (ErrorIfNotFound) UE_LOG(LogLuprexIntegration, Error, TEXT("Tangible not on search path: %s"), *Name);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
UClass *Result = LoadObject<UClass>(nullptr, *Path);
|
UClass *Result = LoadObject<UClass>(nullptr, *Path);
|
||||||
if (Result == nullptr) {
|
if (Result == nullptr) {
|
||||||
UE_LOG(LogLuprexIntegration, Error, TEXT("Cannot load tangible class: %s"), *Path);
|
if (ErrorIfInvalid) UE_LOG(LogLuprexIntegration, Error, TEXT("Cannot load tangible class: %s"), *Path);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (!Result->IsChildOf(AActor::StaticClass())) {
|
if (!Result->IsChildOf(AActor::StaticClass())) {
|
||||||
UE_LOG(LogLuprexIntegration, Error, TEXT("Tangible class is not an actor: %s"), *Path);
|
if (ErrorIfInvalid) UE_LOG(LogLuprexIntegration, Error, TEXT("Tangible class is not an actor: %s"), *Path);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
UFunction *aqchanged = Result->FindFunctionByName(FName(TEXT("Animation Queue Changed")));
|
UFunction *aqchanged = Result->FindFunctionByName(FName(TEXT("Animation Queue Changed")));
|
||||||
if ((aqchanged == nullptr)||(aqchanged->ParmsSize != 0))
|
if ((aqchanged == nullptr)||(aqchanged->ParmsSize != 0))
|
||||||
{
|
{
|
||||||
UE_LOG(LogLuprexIntegration, Error, TEXT("Tangible does not have 'Animation Queue Changed' function: %s"), *Path);
|
if (ErrorIfInvalid) UE_LOG(LogLuprexIntegration, Error, TEXT("Tangible does not have 'Animation Queue Changed' function: %s"), *Path);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
TSubclassOf<UUserWidget> UlxAssetLookup::GetWidgetByName(const UObject *Context, const FString &Name) {
|
TSubclassOf<UUserWidget> UlxAssetLookup::GetWidgetByName(const UObject *Context, const FString &Name, bool ErrorIfNotFound, bool ErrorIfInvalid) {
|
||||||
ALuprexGameModeBase *mode = ALuprexGameModeBase::FromContext(Context);
|
ALuprexGameModeBase *mode = ALuprexGameModeBase::FromContext(Context);
|
||||||
FString Path = mode->GetAssetLookup()->WidgetLoadPath(FName(FString("WB_") + Name));
|
FString Path = mode->GetAssetLookup()->WidgetLoadPath(FName(FString("WB_") + Name));
|
||||||
if (Path.IsEmpty())
|
if (Path.IsEmpty())
|
||||||
{
|
{
|
||||||
UE_LOG(LogLuprexIntegration, Error, TEXT("Widget not on search path: %s"), *Name);
|
if (ErrorIfNotFound) UE_LOG(LogLuprexIntegration, Error, TEXT("Widget not on search path: %s"), *Name);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
UClass *Result = LoadObject<UClass>(nullptr, *Path);
|
UClass *Result = LoadObject<UClass>(nullptr, *Path);
|
||||||
if (Result == nullptr) {
|
if (Result == nullptr) {
|
||||||
UE_LOG(LogLuprexIntegration, Error, TEXT("Cannot load widget blueprint: %s"), *Path);
|
if (ErrorIfInvalid) UE_LOG(LogLuprexIntegration, Error, TEXT("Cannot load widget blueprint: %s"), *Path);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (!Result->IsChildOf(UUserWidget::StaticClass())) {
|
if (!Result->IsChildOf(UUserWidget::StaticClass()))
|
||||||
UE_LOG(LogLuprexIntegration, Error, TEXT("Blueprint is not a Widget Blueprint: %s"), *Path);
|
{
|
||||||
|
if (ErrorIfInvalid) UE_LOG(LogLuprexIntegration, Error, TEXT("Blueprint is not a Widget Blueprint: %s"), *Path);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
TSubclassOf<UlxLookAtWidget> UlxAssetLookup::GetLookAtWidgetByName(const UObject *Context, const FString &Name) {
|
TSubclassOf<UlxLookAtWidget> UlxAssetLookup::GetLookAtWidgetByName(const UObject *Context, const FString &Name, bool ErrorIfNotFound, bool ErrorIfInvalid) {
|
||||||
ALuprexGameModeBase *mode = ALuprexGameModeBase::FromContext(Context);
|
ALuprexGameModeBase *mode = ALuprexGameModeBase::FromContext(Context);
|
||||||
FString Path = mode->GetAssetLookup()->WidgetLoadPath(FName(FString("WB_") + Name));
|
FString Path = mode->GetAssetLookup()->WidgetLoadPath(FName(FString("WB_") + Name));
|
||||||
if (Path.IsEmpty())
|
if (Path.IsEmpty())
|
||||||
{
|
{
|
||||||
UE_LOG(LogLuprexIntegration, Error, TEXT("Widget not on search path: %s"), *Name);
|
if (ErrorIfNotFound) UE_LOG(LogLuprexIntegration, Error, TEXT("Widget not on search path: %s"), *Name);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
UClass *Result = LoadObject<UClass>(nullptr, *Path);
|
UClass *Result = LoadObject<UClass>(nullptr, *Path);
|
||||||
if (Result == nullptr) {
|
if (Result == nullptr) {
|
||||||
UE_LOG(LogLuprexIntegration, Error, TEXT("Cannot load widget blueprint: %s"), *Path);
|
if (ErrorIfInvalid) UE_LOG(LogLuprexIntegration, Error, TEXT("Cannot load widget blueprint: %s"), *Path);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (!Result->IsChildOf(UlxLookAtWidget::StaticClass())) {
|
if (!Result->IsChildOf(UlxLookAtWidget::StaticClass()))
|
||||||
UE_LOG(LogLuprexIntegration, Error, TEXT("Blueprint is not a Luprex Look-At Widget: %s"), *Path);
|
{
|
||||||
|
if (ErrorIfInvalid) UE_LOG(LogLuprexIntegration, Error, TEXT("Blueprint is not a Luprex Look-At Widget: %s"), *Path);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return Result;
|
return Result;
|
||||||
|
|||||||
@@ -48,17 +48,17 @@ public:
|
|||||||
|
|
||||||
// Get a static mesh by name
|
// Get a static mesh by name
|
||||||
UFUNCTION(BlueprintPure, meta = (WorldContext = "Context"), Category = "Luprex|Miscellaneous")
|
UFUNCTION(BlueprintPure, meta = (WorldContext = "Context"), Category = "Luprex|Miscellaneous")
|
||||||
static UStaticMesh *GetStaticMeshByName(const UObject *Context, const FString &Name);
|
static UStaticMesh *GetStaticMeshByName(const UObject *Context, const FString &Name, bool ErrorIfNotFound = false, bool ErrorIfInvalid = true);
|
||||||
|
|
||||||
// Get a tangible class by name
|
// Get a tangible class by name
|
||||||
UFUNCTION(BlueprintPure, meta = (WorldContext = "Context"), Category = "Luprex|Miscellaneous")
|
UFUNCTION(BlueprintPure, meta = (WorldContext = "Context"), Category = "Luprex|Miscellaneous")
|
||||||
static TSubclassOf<AActor> GetTangibleClassByName(const UObject *Context, const FString &Name);
|
static TSubclassOf<AActor> GetTangibleClassByName(const UObject *Context, const FString &Name, bool ErrorIfNotFound = false, bool ErrorIfInvalid = true);
|
||||||
|
|
||||||
// Get a widget blueprint by name
|
// Get a widget blueprint by name
|
||||||
UFUNCTION(BlueprintPure, meta = (WorldContext = "Context"), Category = "Luprex|Miscellaneous")
|
UFUNCTION(BlueprintPure, meta = (WorldContext = "Context"), Category = "Luprex|Miscellaneous")
|
||||||
static TSubclassOf<UUserWidget> GetWidgetByName(const UObject *Context, const FString &Name);
|
static TSubclassOf<UUserWidget> GetWidgetByName(const UObject *Context, const FString &Name, bool ErrorIfNotFound = false, bool ErrorIfInvalid = true);
|
||||||
|
|
||||||
// Get a look-at widget blueprint by name
|
// Get a look-at widget blueprint by name
|
||||||
UFUNCTION(BlueprintPure, meta = (WorldContext = "Context"), Category = "Luprex|Miscellaneous")
|
UFUNCTION(BlueprintPure, meta = (WorldContext = "Context"), Category = "Luprex|Miscellaneous")
|
||||||
static TSubclassOf<UlxLookAtWidget> GetLookAtWidgetByName(const UObject *Context, const FString &Name);
|
static TSubclassOf<UlxLookAtWidget> GetLookAtWidgetByName(const UObject *Context, const FString &Name, bool ErrorIfNotFound = false, bool ErrorIfInvalid = true);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -505,78 +505,100 @@ FString UlxLuaValues::DebugString() const
|
|||||||
return Output.ToString();
|
return Output.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UlxLuaValues::CheckType(ElxLuaValueType Type, ElxLuaValueType Desired)
|
ElxSuccessOrError UlxLuaValues::CheckType(ElxLuaValueType Type, ElxLuaValueType Desired)
|
||||||
{
|
{
|
||||||
if (Type != Desired)
|
if (Type != Desired)
|
||||||
{
|
{
|
||||||
FString TypeName = StaticEnum<ElxLuaValueType>()->GetDisplayNameTextByValue(int64(Type)).ToString();
|
FString TypeName = StaticEnum<ElxLuaValueType>()->GetDisplayNameTextByValue(int64(Type)).ToString();
|
||||||
FString DesiredName = StaticEnum<ElxLuaValueType>()->GetDisplayNameTextByValue(int64(Desired)).ToString();
|
FString DesiredName = StaticEnum<ElxLuaValueType>()->GetDisplayNameTextByValue(int64(Desired)).ToString();
|
||||||
UE_LOG(LogBlueprint, Error, TEXT("Expected a value of type %s, but found %s instead."), *DesiredName, *TypeName);
|
UE_LOG(LogBlueprint, Error, TEXT("Expected a value of type %s, but found %s instead."), *DesiredName, *TypeName);
|
||||||
return false;
|
return ElxSuccessOrError::Error;
|
||||||
}
|
}
|
||||||
return true;
|
return ElxSuccessOrError::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
ElxLuaValueType UlxLuaValues::GetType(int n) const
|
ElxLuaValueType UlxLuaValues::NextType() const
|
||||||
{
|
{
|
||||||
if (n < 0) return ElxLuaValueType::None;
|
if (Cursor < 0) return ElxLuaValueType::None;
|
||||||
if (n >= Types.Num()) return ElxLuaValueType::None;
|
if (Cursor >= Types.Num()) return ElxLuaValueType::None;
|
||||||
return Types[Cursor];
|
return Types[Cursor];
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
void UlxLuaValues::ReadString(ElxSuccessOrError &Status, FString &Result)
|
||||||
// Get the Nth value in the array. Array bounds-checking
|
|
||||||
// is handled by 'GetType', which returns 'None' for out-of-bounds
|
|
||||||
// accesses.
|
|
||||||
//
|
|
||||||
|
|
||||||
FString UlxLuaValues::GetString(int n) const
|
|
||||||
{
|
{
|
||||||
if (!CheckType(GetType(n), ElxLuaValueType::String)) return FString();
|
Status = CheckType(NextType(), ElxLuaValueType::String);
|
||||||
FlxStreamBuffer Decoder(Data[n]);
|
if (Status == ElxSuccessOrError::Error)
|
||||||
return Decoder.read_fstring();
|
{
|
||||||
|
Result.Empty(); return;
|
||||||
|
}
|
||||||
|
Result = FlxStreamBuffer(Data[Cursor++]).read_fstring();
|
||||||
}
|
}
|
||||||
|
|
||||||
FName UlxLuaValues::GetName(int n) const
|
void UlxLuaValues::ReadName(ElxSuccessOrError &Status, FName &Result)
|
||||||
{
|
{
|
||||||
if (!CheckType(GetType(n), ElxLuaValueType::Name)) return FName();
|
Status = CheckType(NextType(), ElxLuaValueType::Name);
|
||||||
FlxStreamBuffer Decoder(Data[n]);
|
if (Status == ElxSuccessOrError::Error)
|
||||||
return Decoder.read_fname();
|
{
|
||||||
|
Result = FName(); return;
|
||||||
|
}
|
||||||
|
Result = FlxStreamBuffer(Data[Cursor++]).read_fname();
|
||||||
}
|
}
|
||||||
|
|
||||||
double UlxLuaValues::GetFloat(int n) const
|
void UlxLuaValues::ReadFloat(ElxSuccessOrError &Status, double &Result)
|
||||||
{
|
{
|
||||||
if (!CheckType(GetType(n), ElxLuaValueType::Float)) return 0.0;
|
Status = CheckType(NextType(), ElxLuaValueType::Float);
|
||||||
FlxStreamBuffer Decoder(Data[n]);
|
if (Status == ElxSuccessOrError::Error)
|
||||||
return Decoder.read_double();
|
{
|
||||||
|
Result = 0.0; return;
|
||||||
|
}
|
||||||
|
Result = FlxStreamBuffer(Data[Cursor++]).read_double();
|
||||||
}
|
}
|
||||||
|
|
||||||
int UlxLuaValues::GetInt(int n) const
|
void UlxLuaValues::ReadInt(ElxSuccessOrError &Status, int &Result)
|
||||||
{
|
{
|
||||||
if (!CheckType(GetType(n), ElxLuaValueType::Float)) return 0;
|
Status = CheckType(NextType(), ElxLuaValueType::Float);
|
||||||
FlxStreamBuffer Decoder(Data[n]);
|
if (Status == ElxSuccessOrError::Error)
|
||||||
return int(Decoder.read_double());
|
{
|
||||||
|
Result = 0.0; return;
|
||||||
|
}
|
||||||
|
double dvalue = FlxStreamBuffer(Data[Cursor++]).read_double();
|
||||||
|
Result = int(dvalue);
|
||||||
|
if (double(Result) != dvalue)
|
||||||
|
{
|
||||||
|
Result = 0; Status = ElxSuccessOrError::Error; return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FVector UlxLuaValues::GetVector(int n) const
|
void UlxLuaValues::ReadVector(ElxSuccessOrError &Status, FVector &Result)
|
||||||
{
|
{
|
||||||
if (!CheckType(GetType(n), ElxLuaValueType::Vector)) return FVector();
|
Status = CheckType(NextType(), ElxLuaValueType::Vector);
|
||||||
FlxStreamBuffer Decoder(Data[n]);
|
if (Status == ElxSuccessOrError::Error)
|
||||||
return Decoder.read_fvector();
|
{
|
||||||
|
Result = FVector(); return;
|
||||||
|
}
|
||||||
|
Result = FlxStreamBuffer(Data[Cursor++]).read_fvector();
|
||||||
}
|
}
|
||||||
|
|
||||||
FVector2D UlxLuaValues::GetVector2D(int n) const
|
void UlxLuaValues::ReadVector2D(ElxSuccessOrError &Status, FVector2D &Result)
|
||||||
{
|
{
|
||||||
if (!CheckType(GetType(n), ElxLuaValueType::Vector)) return FVector2D();
|
Status = CheckType(NextType(), ElxLuaValueType::Vector);
|
||||||
FlxStreamBuffer Decoder(Data[n]);
|
if (Status == ElxSuccessOrError::Error)
|
||||||
FVector v = Decoder.read_fvector();
|
{
|
||||||
return FVector2D(v.X, v.Y);
|
Result = FVector2D(); return;
|
||||||
|
}
|
||||||
|
FVector VValue = FlxStreamBuffer(Data[Cursor++]).read_fvector();
|
||||||
|
Result = FVector2D(VValue.X, VValue.Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UlxLuaValues::GetBoolean(int n) const
|
void UlxLuaValues::ReadBoolean(ElxSuccessOrError &Status, bool &Result)
|
||||||
{
|
{
|
||||||
if (!CheckType(GetType(n), ElxLuaValueType::Boolean)) return false;
|
Status = CheckType(NextType(), ElxLuaValueType::Boolean);
|
||||||
FlxStreamBuffer Decoder(Data[n]);
|
if (Status == ElxSuccessOrError::Error)
|
||||||
return Decoder.read_bool();
|
{
|
||||||
|
Result = false; return;
|
||||||
|
}
|
||||||
|
Result = FlxStreamBuffer(Data[Cursor++]).read_bool();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,36 @@
|
|||||||
|
|
||||||
class UlxLuaValues;
|
class UlxLuaValues;
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// These are the types that can actually be packed into
|
||||||
|
// a serialized buffer.
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
UENUM(BlueprintType)
|
||||||
|
enum class ElxLuaValueType : uint8 {
|
||||||
|
None,
|
||||||
|
String,
|
||||||
|
Name,
|
||||||
|
Float,
|
||||||
|
Boolean,
|
||||||
|
Vector
|
||||||
|
};
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// A general-purpose 'success or error' type.
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
UENUM(BlueprintType)
|
||||||
|
enum class ElxSuccessOrError : uint8 {
|
||||||
|
Success,
|
||||||
|
Error,
|
||||||
|
};
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// This is a little parser that parses Lua function 'prototypes'.
|
// This is a little parser that parses Lua function 'prototypes'.
|
||||||
@@ -177,24 +207,6 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// These are the types that can actually be packed into
|
|
||||||
// a serialized buffer.
|
|
||||||
//
|
|
||||||
/////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
UENUM(BlueprintType)
|
|
||||||
enum class ElxLuaValueType : uint8 {
|
|
||||||
None,
|
|
||||||
String,
|
|
||||||
Name,
|
|
||||||
Float,
|
|
||||||
Boolean,
|
|
||||||
Vector
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
@@ -231,7 +243,7 @@ private:
|
|||||||
|
|
||||||
// Compare two types. If they aren't equal, log an error and return false.
|
// Compare two types. If they aren't equal, log an error and return false.
|
||||||
//
|
//
|
||||||
static bool CheckType(ElxLuaValueType Type, ElxLuaValueType Desired);
|
static ElxSuccessOrError CheckType(ElxLuaValueType Type, ElxLuaValueType Desired);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UlxLuaValues() { Cursor = 0; }
|
UlxLuaValues() { Cursor = 0; }
|
||||||
@@ -253,68 +265,33 @@ public:
|
|||||||
UFUNCTION(BlueprintCallable, Category = "Luprex|Lua Value Array")
|
UFUNCTION(BlueprintCallable, Category = "Luprex|Lua Value Array")
|
||||||
void SetCursor(int n) { Cursor = n; }
|
void SetCursor(int n) { Cursor = n; }
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
//
|
|
||||||
// Functions that get values from the array, random access.
|
|
||||||
//
|
|
||||||
|
|
||||||
UFUNCTION(BlueprintPure, Category = "Luprex|Lua Value Array")
|
UFUNCTION(BlueprintPure, Category = "Luprex|Lua Value Array")
|
||||||
ElxLuaValueType GetType(int n) const;
|
ElxLuaValueType NextType() const;
|
||||||
|
|
||||||
UFUNCTION(BlueprintPure, Category = "Luprex|Lua Value Array")
|
|
||||||
bool IsType(int n, ElxLuaValueType Type) const { return GetType(n) == Type; }
|
|
||||||
|
|
||||||
UFUNCTION(BlueprintPure, Category = "Luprex|Lua Value Array")
|
|
||||||
FString GetString(int n) const;
|
|
||||||
|
|
||||||
UFUNCTION(BlueprintPure, Category = "Luprex|Lua Value Array")
|
UFUNCTION(BlueprintPure, Category = "Luprex|Lua Value Array")
|
||||||
FName GetName(int n) const;
|
bool IsNextType(ElxLuaValueType Type) const { return NextType() == Type; }
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintCallable, meta = (ExpandEnumAsExecs = "ReturnValue"), Category = "Luprex|Lua Value Array")
|
||||||
|
ElxLuaValueType SwitchNextType() const { return NextType(); }
|
||||||
|
|
||||||
UFUNCTION(BlueprintPure, Category = "Luprex|Lua Value Array")
|
UFUNCTION(BlueprintCallable, meta = (ExpandEnumAsExecs = "Status"), Category = "Luprex|Lua Value Array")
|
||||||
double GetFloat(int n) const;
|
void ReadString(ElxSuccessOrError &Status, FString &Result);
|
||||||
|
|
||||||
UFUNCTION(BlueprintPure, Category = "Luprex|Lua Value Array")
|
|
||||||
int GetInt(int n) const;
|
|
||||||
|
|
||||||
UFUNCTION(BlueprintPure, Category = "Luprex|Lua Value Array")
|
|
||||||
FVector GetVector(int n) const;
|
|
||||||
|
|
||||||
UFUNCTION(BlueprintPure, Category = "Luprex|Lua Value Array")
|
|
||||||
FVector2D GetVector2D(int n) const;
|
|
||||||
|
|
||||||
UFUNCTION(BlueprintPure, Category = "Luprex|Lua Value Array")
|
|
||||||
bool GetBoolean(int n) const;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Functions that get values from the array using the cursor.
|
|
||||||
//
|
|
||||||
|
|
||||||
public:
|
|
||||||
UFUNCTION(BlueprintPure, Category = "Luprex|Lua Value Array")
|
|
||||||
ElxLuaValueType NextType() const { return GetType(Cursor); }
|
|
||||||
|
|
||||||
UFUNCTION(BlueprintPure, Category = "Luprex|Lua Value Array")
|
|
||||||
bool IsNextType(ElxLuaValueType Type) const { return IsType(Cursor, Type); }
|
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable, Category = "Luprex|Lua Value Array")
|
|
||||||
FString ReadString() { return GetString(Cursor++); }
|
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable, Category = "Luprex|Lua Value Array")
|
UFUNCTION(BlueprintCallable, meta = (ExpandEnumAsExecs = "Status"), Category = "Luprex|Lua Value Array")
|
||||||
FName ReadName() { return GetName(Cursor++); }
|
void ReadName(ElxSuccessOrError &Status, FName &Result);
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable, Category = "Luprex|Lua Value Array")
|
UFUNCTION(BlueprintCallable, meta = (ExpandEnumAsExecs = "Status"), Category = "Luprex|Lua Value Array")
|
||||||
double ReadFloat() { return GetFloat(Cursor++); }
|
void ReadFloat(ElxSuccessOrError &Status, double &Result);
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable, Category = "Luprex|Lua Value Array")
|
UFUNCTION(BlueprintCallable, meta = (ExpandEnumAsExecs = "Status"), Category = "Luprex|Lua Value Array")
|
||||||
int ReadInt() { return GetInt(Cursor++); }
|
void ReadInt(ElxSuccessOrError &Status, int &Result);
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable, Category = "Luprex|Lua Value Array")
|
UFUNCTION(BlueprintCallable, meta = (ExpandEnumAsExecs = "Status"), Category = "Luprex|Lua Value Array")
|
||||||
FVector ReadVector() { return GetVector(Cursor++); }
|
void ReadVector(ElxSuccessOrError &Status, FVector &Result);
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable, Category = "Luprex|Lua Value Array")
|
UFUNCTION(BlueprintCallable, meta = (ExpandEnumAsExecs = "Status"), Category = "Luprex|Lua Value Array")
|
||||||
FVector2D ReadVector2D() { return GetVector2D(Cursor++); }
|
void ReadVector2D(ElxSuccessOrError &Status, FVector2D &Result);
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable, Category = "Luprex|Lua Value Array")
|
UFUNCTION(BlueprintCallable, meta = (ExpandEnumAsExecs = "Status"), Category = "Luprex|Lua Value Array")
|
||||||
bool ReadBoolean() { return GetBoolean(Cursor++); }
|
void ReadBoolean(ElxSuccessOrError &Status, bool &Result);
|
||||||
};
|
};
|
||||||
0
Source/Integration/LuprexWidgets.cpp
Normal file
0
Source/Integration/LuprexWidgets.cpp
Normal file
@@ -234,20 +234,17 @@ LuaDefine(tangible_setclass, "tan,class",
|
|||||||
return LS.result();
|
return LS.result();
|
||||||
}
|
}
|
||||||
|
|
||||||
LuaDefine(tangible_getclass, "tan",
|
LuaDefine(tangible_getclassname, "tan",
|
||||||
"|Get the class of the tangible, if any."
|
"|Get the classname of the tangible, if any."
|
||||||
"|"
|
"|"
|
||||||
"|The return value is a string, the class name, not"
|
"|The return value is a string (or nil)."
|
||||||
"|the class table."
|
|
||||||
"|") {
|
"|") {
|
||||||
LuaArg tanobj;
|
LuaArg tanobj;
|
||||||
LuaVar classtab;
|
|
||||||
LuaRet classname;
|
LuaRet classname;
|
||||||
LuaDefStack LS(L, tanobj, classtab, classname);
|
LuaDefStack LS(L, tanobj, classname);
|
||||||
World *w = World::fetch_global_pointer(L);
|
World *w = World::fetch_global_pointer(L);
|
||||||
w->tangible_get(LS, tanobj, false);
|
w->tangible_get(LS, tanobj, false);
|
||||||
LS.tangetclass(classtab, tanobj);
|
eng::string name = LS.classname(tanobj);
|
||||||
eng::string name = LS.classname(classtab);
|
|
||||||
if (name == "") {
|
if (name == "") {
|
||||||
LS.set(classname, LuaNil);
|
LS.set(classname, LuaNil);
|
||||||
} else {
|
} else {
|
||||||
@@ -256,6 +253,20 @@ LuaDefine(tangible_getclass, "tan",
|
|||||||
return LS.result();
|
return LS.result();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LuaDefine(tangible_getclass, "tan",
|
||||||
|
"|Get the class of the tangible, if any."
|
||||||
|
"|"
|
||||||
|
"|The return value is a class table (or nil)."
|
||||||
|
"|") {
|
||||||
|
LuaArg tanobj;
|
||||||
|
LuaRet classtab;
|
||||||
|
LuaDefStack LS(L, tanobj, classtab);
|
||||||
|
World *w = World::fetch_global_pointer(L);
|
||||||
|
w->tangible_get(LS, tanobj, false);
|
||||||
|
LS.tangetclass(classtab, tanobj);
|
||||||
|
return LS.result();
|
||||||
|
}
|
||||||
|
|
||||||
LuaDefine(tangible_delete, "tan",
|
LuaDefine(tangible_delete, "tan",
|
||||||
"|Delete the specified tangible."
|
"|Delete the specified tangible."
|
||||||
"|"
|
"|"
|
||||||
|
|||||||
@@ -27,8 +27,13 @@ function sphere.getlookat()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function engio.getlookat()
|
function engio.getlookat()
|
||||||
local place = tangible.place()
|
local class = tangible.getclass(tangible.place())
|
||||||
local class = tangible.getclass(place)
|
if class ~= nil then
|
||||||
return class.getlookat()
|
local getlookat = class.getlookat
|
||||||
|
if getlookat ~= nil then
|
||||||
|
return getlookat()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return ""
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user