Skip to content

Commit ed1e6d8

Browse files
committed
added support for UEnums in function args and return values
1 parent 378fe7d commit ed1e6d8

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Source/UnrealEnginePython/Private/UEPyModule.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3214,6 +3214,14 @@ UFunction *unreal_engine_add_function(UClass *u_class, char *name, PyObject *py_
32143214
prop = prop_base;
32153215
}
32163216
}
3217+
else if (py_obj->ue_object->IsA<UEnum>())
3218+
{
3219+
UEnumProperty *prop_enum = NewObject<UEnumProperty>(function, UTF8_TO_TCHAR(p_name), RF_Public);
3220+
UNumericProperty *prop_underlying = NewObject<UByteProperty>(prop_enum, TEXT("UnderlyingType"), RF_Public);
3221+
prop_enum->SetEnum((UEnum*)py_obj->ue_object);
3222+
prop_enum->AddCppProperty(prop_underlying);
3223+
prop = prop_enum;
3224+
}
32173225
}
32183226

32193227
if (prop)
@@ -3321,6 +3329,14 @@ UFunction *unreal_engine_add_function(UClass *u_class, char *name, PyObject *py_
33213329
prop = prop_base;
33223330
}
33233331
}
3332+
else if (py_obj->ue_object->IsA<UEnum>())
3333+
{
3334+
UEnumProperty *prop_enum = NewObject<UEnumProperty>(function, UTF8_TO_TCHAR(p_name), RF_Public);
3335+
UNumericProperty *prop_underlying = NewObject<UByteProperty>(prop_enum, TEXT("UnderlyingType"), RF_Public);
3336+
prop_enum->SetEnum((UEnum*)py_obj->ue_object);
3337+
prop_enum->AddCppProperty(prop_underlying);
3338+
prop = prop_enum;
3339+
}
33243340
}
33253341

33263342
if (prop)

0 commit comments

Comments
 (0)