Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 18 additions & 13 deletions Source/UnrealHxGenerator/Private/HaxeExternGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand All @@ -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()) {
Expand Down Expand Up @@ -914,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<UStructProperty>())
{
outType += TEXT("unreal.PRef<");
}
else
{
outType += TEXT("unreal.Ref<");
}
end += TEXT(">");
}
} else {
Expand All @@ -930,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<UStructProperty>())
{
outType += TEXT("unreal.PRef<");
}
else
{
outType += TEXT("unreal.Ref<");
}
end += TEXT(">");
}
}
Expand Down Expand Up @@ -1053,7 +1060,6 @@ bool FHaxeGenerator::upropType(UProperty* inProp, FString &outType) {
return false;
}
return true;
#if UE_VER >= 416
} else if (inProp->IsA<UEnumProperty>()) {
auto enumProp = Cast<UEnumProperty>(inProp);
UEnum *uenum = enumProp->GetEnum();
Expand All @@ -1062,7 +1068,6 @@ bool FHaxeGenerator::upropType(UProperty* inProp, FString &outType) {
return false;
}
return writeWithModifiers(descr->haxeType.toString(), inProp, outType);
#endif
} else if (inProp->IsA<UBoolProperty>()) {
return writeBasicWithModifiers(TEXT("Bool"), inProp, outType);
return true;
Expand Down
9 changes: 0 additions & 9 deletions Source/UnrealHxGenerator/Public/HaxeTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -474,15 +467,13 @@ class FHaxeTypes {
// is enum
this->touchEnum(uenum, inClass);
}
#if UE_VER >= 416
} else if (inProp->IsA<UEnumProperty>()) {
auto enumProp = Cast<UEnumProperty>(inProp);
UEnum *uenum = enumProp->GetEnum();
if (nullptr != uenum) {
// is enum
this->touchEnum(uenum, inClass);
}
#endif
} else if (inProp->IsA<UArrayProperty>()) {
auto prop = Cast<UArrayProperty>(inProp);
touchProperty(prop->Inner, inClass, inMayForward);
Expand Down