Skip to content

Commit 8e7b4e6

Browse files
author
Roberto De Ioris
committed
completed porting to 4.17
1 parent cab5988 commit 8e7b4e6

File tree

6 files changed

+49
-4
lines changed

6 files changed

+49
-4
lines changed

Source/UnrealEnginePython/Private/Slate/UEPyFPaintContext.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,13 @@ static PyObject *py_ue_fpaint_context_draw_line(ue_PyFPaintContext *self, PyObje
3030
points.Add(FVector2D(x1, y1));
3131
points.Add(FVector2D(x2, y2));
3232

33+
#if ENGINE_MINOR_VERSION >= 17
34+
FSlateDrawElement::MakeLines(context.OutDrawElements, context.MaxLayer, context.AllottedGeometry.ToPaintGeometry(),
35+
points, ESlateDrawEffect::None, tint, (py_antialias && !PyObject_IsTrue(py_antialias)), thickness);
36+
#else
3337
FSlateDrawElement::MakeLines(context.OutDrawElements, context.MaxLayer, context.AllottedGeometry.ToPaintGeometry(),
3438
points, context.MyClippingRect, ESlateDrawEffect::None, tint, (py_antialias && !PyObject_IsTrue(py_antialias)), thickness);
39+
#endif
3540

3641
Py_RETURN_NONE;
3742
}
@@ -73,8 +78,13 @@ static PyObject *py_ue_fpaint_context_draw_text(ue_PyFPaintContext *self, PyObje
7378

7479
context.MaxLayer++;
7580

81+
#if ENGINE_MINOR_VERSION >= 17
82+
FSlateDrawElement::MakeText(context.OutDrawElements, context.MaxLayer, context.AllottedGeometry.ToOffsetPaintGeometry(position),
83+
FText::FromString(UTF8_TO_TCHAR(text)), font, ESlateDrawEffect::None, tint);
84+
#else
7685
FSlateDrawElement::MakeText(context.OutDrawElements, context.MaxLayer, context.AllottedGeometry.ToOffsetPaintGeometry(position),
7786
FText::FromString(UTF8_TO_TCHAR(text)), font, context.MyClippingRect, ESlateDrawEffect::None, tint);
87+
#endif
7888

7989
Py_RETURN_NONE;
8090
}
@@ -104,9 +114,15 @@ static PyObject *py_ue_fpaint_context_draw_spline(ue_PyFPaintContext *self, PyOb
104114

105115
context.MaxLayer++;
106116

117+
#if ENGINE_MINOR_VERSION >= 17
118+
FSlateDrawElement::MakeSpline(context.OutDrawElements, context.MaxLayer, context.AllottedGeometry.ToPaintGeometry(),
119+
FVector2D(x1, y1), FVector2D(dx1, dy1), FVector2D(x2, y2), FVector2D(dx2, dy2),
120+
thickness, ESlateDrawEffect::None, tint);
121+
#else
107122
FSlateDrawElement::MakeSpline(context.OutDrawElements, context.MaxLayer, context.AllottedGeometry.ToPaintGeometry(),
108123
FVector2D(x1, y1), FVector2D(dx1, dy1), FVector2D(x2, y2), FVector2D(dx2, dy2),
109124
context.MyClippingRect, thickness, ESlateDrawEffect::None, tint);
125+
#endif
110126

111127
Py_RETURN_NONE;
112128
}
@@ -157,8 +173,13 @@ static PyObject *py_ue_fpaint_context_draw_lines(ue_PyFPaintContext *self, PyObj
157173

158174
context.MaxLayer++;
159175

176+
#if ENGINE_MINOR_VERSION >= 17
177+
FSlateDrawElement::MakeLines(context.OutDrawElements, context.MaxLayer, context.AllottedGeometry.ToPaintGeometry(),
178+
points, ESlateDrawEffect::None, tint, (py_antialias && !PyObject_IsTrue(py_antialias)), thickness);
179+
#else
160180
FSlateDrawElement::MakeLines(context.OutDrawElements, context.MaxLayer, context.AllottedGeometry.ToPaintGeometry(),
161181
points, context.MyClippingRect, ESlateDrawEffect::None, tint, (py_antialias && !PyObject_IsTrue(py_antialias)), thickness);
182+
#endif
162183

163184
Py_RETURN_NONE;
164185
}

Source/UnrealEnginePython/Private/Slate/UEPySWindow.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,11 @@ PyTypeObject ue_PySWindowType = {
143143
static int ue_py_swindow_init(ue_PySWindow *self, PyObject *args, PyObject *kwargs) {
144144

145145
ue_py_slate_setup_farguments(SWindow);
146-
146+
#if ENGINE_MINOR_VERSION > 15
147+
ue_py_slate_farguments_optional_enum("activation_policy", ActivationPolicy, EWindowActivationPolicy);
148+
#else
147149
ue_py_slate_farguments_optional_bool("activate_when_first_shown", ActivateWhenFirstShown);
150+
#endif
148151
#if ENGINE_MINOR_VERSION > 15
149152
ue_py_slate_farguments_optional_enum("auto_center", AutoCenter, EAutoCenter);
150153
#else

Source/UnrealEnginePython/Private/UEPyEditor.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,12 @@ PyObject *py_unreal_engine_editor_play(PyObject * self, PyObject * args) {
227227
r = rotator->rot;
228228
}
229229

230-
230+
#if ENGINE_MINOR_VERSION >= 17
231+
const FString mobile_device;
232+
GEditor->RequestPlaySession(&v, &r, false, false, mobile_device);
233+
#else
231234
GEditor->RequestPlaySession(&v, &r, false, false);
235+
#endif
232236

233237
Py_RETURN_NONE;
234238
}
@@ -1207,7 +1211,11 @@ PyObject *py_unreal_engine_blueprint_add_member_variable(PyObject * self, PyObje
12071211
#if ENGINE_MINOR_VERSION > 14
12081212
FEdGraphPinType pin;
12091213
pin.PinCategory = UTF8_TO_TCHAR(in_type);
1214+
#if ENGINE_MINOR_VERSION >= 17
1215+
pin.ContainerType = is_array ? EPinContainerType::Array : EPinContainerType::None;
1216+
#else
12101217
pin.bIsArray = is_array;
1218+
#endif
12111219
#else
12121220
FEdGraphPinType pin(UTF8_TO_TCHAR(in_type), FString(""), nullptr, is_array, false);
12131221
#endif
@@ -1656,7 +1664,7 @@ PyObject *py_unreal_engine_add_level_to_world(PyObject *self, PyObject * args) {
16561664
streaming_mode_class = ULevelStreamingAlwaysLoaded::StaticClass();
16571665
}
16581666

1659-
ULevel *level = EditorLevelUtils::AddLevelToWorld(u_world, UTF8_TO_TCHAR(name), streaming_mode_class);
1667+
ULevel *level = (ULevel *)EditorLevelUtils::AddLevelToWorld(u_world, UTF8_TO_TCHAR(name), streaming_mode_class);
16601668
if (level) {
16611669
// TODO: update levels list
16621670
}

Source/UnrealEnginePython/Private/UEPyModule.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2404,7 +2404,11 @@ PyObject *py_ue_ufunction_call(UFunction *u_function, UObject *u_obj, PyObject *
24042404
FString default_key = FString("CPP_Default_") + prop->GetName();
24052405
FString default_key_value = u_function->GetMetaData(FName(*default_key));
24062406
if (!default_key_value.IsEmpty()) {
2407+
#if ENGINE_MINOR_VERSION >= 17
2408+
prop->ImportText(*default_key_value, prop->ContainerPtrToValuePtr<uint8>(buffer), PPF_None, NULL);
2409+
#else
24072410
prop->ImportText(*default_key_value, prop->ContainerPtrToValuePtr<uint8>(buffer), PPF_Localized, NULL);
2411+
#endif
24082412
}
24092413
#endif
24102414
}
@@ -2774,7 +2778,12 @@ UFunction *unreal_engine_add_function(UClass *u_class, char *name, PyObject *py_
27742778
UE_LOG(LogPython, Warning, TEXT("REGISTERED FUNCTION %s WITH %d PARAMS (size %d) %d"), *function->GetFName().ToString(), function->NumParms, function->ParmsSize, function->PropertiesSize);
27752779
}
27762780

2781+
2782+
#if ENGINE_MINOR_VERSION >= 17
2783+
function->FunctionFlags = (EFunctionFlags)function_flags;
2784+
#else
27772785
function->FunctionFlags = function_flags;
2786+
#endif
27782787

27792788
function->SetNativeFunc((Native)&UPythonFunction::CallPythonCallable);
27802789

Source/UnrealEnginePython/Private/Wrappers/UEPyFAssetData.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,11 @@ static PyObject *py_ue_fassetdata_get_asset_name(ue_PyFAssetData *self, void *cl
3131
return PyUnicode_FromString(TCHAR_TO_UTF8(*self->asset_data.AssetName.ToString()));
3232
}
3333

34+
#if ENGINE_MINOR_VERSION < 17
3435
static PyObject *py_ue_fassetdata_get_group_names(ue_PyFAssetData *self, void *closure) {
3536
return PyUnicode_FromString(TCHAR_TO_UTF8(*self->asset_data.GroupNames.ToString()));
3637
}
38+
#endif
3739

3840
static PyObject *py_ue_fassetdata_get_object_path(ue_PyFAssetData *self, void *closure) {
3941
return PyUnicode_FromString(TCHAR_TO_UTF8(*self->asset_data.ObjectPath.ToString()));
@@ -65,7 +67,9 @@ static PyObject *py_ue_fassetdata_get_tags_and_values(ue_PyFAssetData *self, voi
6567
static PyGetSetDef ue_PyFAssetData_getseters[] = {
6668
{ (char *)"asset_class", (getter)py_ue_fassetdata_get_asset_class, nullptr, (char *)"asset_class" },
6769
{ (char *)"asset_name", (getter)py_ue_fassetdata_get_asset_name, nullptr, (char *)"asset_name" },
70+
#if ENGINE_MINOR_VERSION < 17
6871
{ (char *)"group_names", (getter)py_ue_fassetdata_get_group_names, nullptr, (char *)"group_names" },
72+
#endif
6973
{ (char *)"object_path",(getter)py_ue_fassetdata_get_object_path, nullptr, (char *)"object_path" },
7074
{ (char *)"package_flags",(getter)py_ue_fassetdata_get_package_flags, nullptr, (char *)"package_flags" },
7175
{ (char *)"package_name", (getter)py_ue_fassetdata_get_package_name, nullptr, (char *)"package_name" },

UnrealEnginePython.uplugin

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"DocsURL": "",
1111
"MarketplaceURL": "",
1212
"SupportURL": "",
13-
"EnabledByDefault": false,
13+
"EnabledByDefault": true,
1414
"CanContainContent": true,
1515
"IsBetaVersion": true,
1616
"Installed": false,

0 commit comments

Comments
 (0)