From 48fe63d8dbda04b179d598b4d9e59e6110a14a0b Mon Sep 17 00:00:00 2001 From: Norm Nazaroff Date: Tue, 18 Dec 2018 10:55:54 -0500 Subject: [PATCH 1/2] Fixed some build errors to comply with API changes in 4.21. Also dropped support for 4.16 & 4.17 as part of removing our build dependency on Version.h. --- .../Private/HaxeExternGenerator.cpp | 13 ++----------- Source/UnrealHxGenerator/Public/HaxeTypes.h | 9 --------- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/Source/UnrealHxGenerator/Private/HaxeExternGenerator.cpp b/Source/UnrealHxGenerator/Private/HaxeExternGenerator.cpp index e7402c0..470aa7a 100644 --- a/Source/UnrealHxGenerator/Private/HaxeExternGenerator.cpp +++ b/Source/UnrealHxGenerator/Private/HaxeExternGenerator.cpp @@ -475,10 +475,7 @@ void FHaxeGenerator::generateFields(UStruct *inStruct, bool onlyProps = false) { // Delegate signatures are a weird piece of code that don't seem to be exported continue; } - auto isEditorOnly = false; -#if UE_VER >= 417 - isEditorOnly = func->HasAnyFunctionFlags(FUNC_EditorOnly); -#endif + auto isEditorOnly = func->HasAnyFunctionFlags(FUNC_EditorOnly); if (wasEditorOnlyData) { m_buf << TEXT("#end // WITH_EDITORONLY_DATA") << Newline(); wasEditorOnlyData = false; @@ -848,7 +845,7 @@ bool FHaxeGenerator::generateEnum(const EnumDescriptor *inEnum) { auto hxType = inEnum->haxeType; // comment - auto& comment = uenum->GetMetaData(TEXT("ToolTip")); + auto comment = uenum->GetMetaData(TEXT("ToolTip")); if (!comment.IsEmpty()) { m_buf << Comment(comment); } @@ -871,11 +868,7 @@ bool FHaxeGenerator::generateEnum(const EnumDescriptor *inEnum) { m_buf << Begin(TEXT(" {")); for (int i = 0; i < uenum->NumEnums(); i++) { -#if UE_VER >= 416 auto name = uenum->GetNameStringByIndex(i); -#else - auto name = uenum->GetEnumName(i); -#endif auto ecomment = uenum->GetMetaData(*(name + TEXT(".") + TEXT("ToolTip"))); auto displayName = uenum->GetMetaData(*(name + TEXT(".") + TEXT("DisplayName"))); if (!displayName.IsEmpty()) { @@ -1053,7 +1046,6 @@ bool FHaxeGenerator::upropType(UProperty* inProp, FString &outType) { return false; } return true; -#if UE_VER >= 416 } else if (inProp->IsA()) { auto enumProp = Cast(inProp); UEnum *uenum = enumProp->GetEnum(); @@ -1062,7 +1054,6 @@ bool FHaxeGenerator::upropType(UProperty* inProp, FString &outType) { return false; } return writeWithModifiers(descr->haxeType.toString(), inProp, outType); -#endif } else if (inProp->IsA()) { return writeBasicWithModifiers(TEXT("Bool"), inProp, outType); return true; diff --git a/Source/UnrealHxGenerator/Public/HaxeTypes.h b/Source/UnrealHxGenerator/Public/HaxeTypes.h index 9acb6bb..72c9f91 100644 --- a/Source/UnrealHxGenerator/Public/HaxeTypes.h +++ b/Source/UnrealHxGenerator/Public/HaxeTypes.h @@ -9,15 +9,8 @@ DECLARE_LOG_CATEGORY_EXTERN(LogHaxeExtern, Log, All); #define LOG(str,...) #endif -#include "../Launch/Resources/Version.h" -#ifndef ENGINE_MINOR_VERSION -#error "Version not found" -#endif - #define UHX_MAX_ENV_SIZE 32768 -#define UE_VER (ENGINE_MAJOR_VERSION * 100 + ENGINE_MINOR_VERSION) - enum class ETypeKind { KNone, KUObject, @@ -474,7 +467,6 @@ class FHaxeTypes { // is enum this->touchEnum(uenum, inClass); } -#if UE_VER >= 416 } else if (inProp->IsA()) { auto enumProp = Cast(inProp); UEnum *uenum = enumProp->GetEnum(); @@ -482,7 +474,6 @@ class FHaxeTypes { // is enum this->touchEnum(uenum, inClass); } -#endif } else if (inProp->IsA()) { auto prop = Cast(inProp); touchProperty(prop->Inner, inClass, inMayForward); From 69db4a44c1ba5f773724c4d3b9e01c7de46ceb9b Mon Sep 17 00:00:00 2001 From: Norm Nazaroff Date: Tue, 18 Dec 2018 12:20:51 -0500 Subject: [PATCH 2/2] Fixed warning by generating Ref<> instead of PRef<> for non-structs. --- .../Private/HaxeExternGenerator.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Source/UnrealHxGenerator/Private/HaxeExternGenerator.cpp b/Source/UnrealHxGenerator/Private/HaxeExternGenerator.cpp index 470aa7a..e2943be 100644 --- a/Source/UnrealHxGenerator/Private/HaxeExternGenerator.cpp +++ b/Source/UnrealHxGenerator/Private/HaxeExternGenerator.cpp @@ -907,7 +907,14 @@ bool FHaxeGenerator::writeWithModifiers(const FString &inName, UProperty *inProp end += TEXT(">"); } if (inProp->HasAnyPropertyFlags(CPF_ReferenceParm)) { - outType += TEXT("unreal.PRef<"); + if (inProp->IsA()) + { + outType += TEXT("unreal.PRef<"); + } + else + { + outType += TEXT("unreal.Ref<"); + } end += TEXT(">"); } } else { @@ -923,7 +930,14 @@ bool FHaxeGenerator::writeWithModifiers(const FString &inName, UProperty *inProp // we don't support UObject*& for now return false; } - outType += TEXT("unreal.PRef<"); + if (inProp->IsA()) + { + outType += TEXT("unreal.PRef<"); + } + else + { + outType += TEXT("unreal.Ref<"); + } end += TEXT(">"); } }