Skip to content

Commit 5163174

Browse files
author
Roberto De Ioris
committed
fixed warnings in 4.18
1 parent f699943 commit 5163174

5 files changed

Lines changed: 45 additions & 7 deletions

File tree

Source/PythonEditor/Private/PYRichTextSyntaxHighlighterTextLayoutMarshaller.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,11 @@ void FPYRichTextSyntaxHighlighterTextLayoutMarshaller::ParseTokens(const FString
311311
FRunInfo RunInfo(TEXT("SyntaxHighlight.PY.Normal"));
312312
FTextBlockStyle TextBlockStyle = SyntaxTextStyle.NormalTextStyle;
313313

314+
#if ENGINE_MINOR_VERSION
315+
const bool bIsWhitespace = FString(TokenText).TrimEnd().IsEmpty();
316+
#else
314317
const bool bIsWhitespace = FString(TokenText).TrimTrailing().IsEmpty();
318+
#endif
315319
if(!bIsWhitespace)
316320
{
317321
bool bHasMatchedSyntax = false;

Source/UnrealEnginePython/Private/PyCommandlet.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ int32 UPyCommandlet::Main(const FString& CommandLine)
3030
const FRegexPattern myPattern(RegexString);
3131
FRegexMatcher myMatcher(myPattern, *CommandLine);
3232
myMatcher.FindNext();
33+
#if ENGINE_MINOR_VERSION >= 18
34+
FString PyCommandLine = myMatcher.GetCaptureGroup(0).TrimStart().TrimEnd();
35+
#else
3336
FString PyCommandLine = myMatcher.GetCaptureGroup(0).Trim().TrimTrailing();
37+
#endif
3438

3539
TArray<FString> PyArgv;
3640
PyArgv.Add(FString());

Source/UnrealEnginePython/Private/UEPyEngine.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
#include "PackageTools.h"
1212
#endif
1313

14+
#if ENGINE_MINOR_VERSION >= 18
15+
#include "HAL/PlatformApplicationMisc.h"
16+
#endif
17+
1418

1519
PyObject *py_unreal_engine_log(PyObject * self, PyObject * args)
1620
{
@@ -165,12 +169,20 @@ PyObject *py_unreal_engine_get_up_vector(PyObject * self, PyObject * args)
165169

166170
PyObject *py_unreal_engine_get_content_dir(PyObject * self, PyObject * args)
167171
{
172+
#if ENGINE_MINOR_VERSION >= 18
173+
return PyUnicode_FromString(TCHAR_TO_UTF8(*FPaths::ProjectContentDir()));
174+
#else
168175
return PyUnicode_FromString(TCHAR_TO_UTF8(*FPaths::GameContentDir()));
176+
#endif
169177
}
170178

171179
PyObject *py_unreal_engine_get_game_saved_dir(PyObject * self, PyObject * args)
172180
{
181+
#if ENGINE_MINOR_VERSION >= 18
182+
return PyUnicode_FromString(TCHAR_TO_UTF8(*FPaths::ProjectSavedDir()));
183+
#else
173184
return PyUnicode_FromString(TCHAR_TO_UTF8(*FPaths::GameSavedDir()));
185+
#endif
174186
}
175187

176188
PyObject * py_unreal_engine_get_game_user_developer_dir(PyObject *, PyObject *)
@@ -1237,13 +1249,21 @@ PyObject *py_unreal_engine_clipboard_copy(PyObject * self, PyObject * args)
12371249
return nullptr;
12381250
}
12391251

1252+
#if ENGINE_MINOR_VERSION >= 18
1253+
FPlatformApplicationMisc::ClipboardCopy(UTF8_TO_TCHAR(text));
1254+
#else
12401255
FGenericPlatformMisc::ClipboardCopy(UTF8_TO_TCHAR(text));
1256+
#endif
12411257
Py_RETURN_NONE;
12421258
}
12431259

12441260
PyObject *py_unreal_engine_clipboard_paste(PyObject * self, PyObject * args)
12451261
{
12461262
FString clipboard;
1263+
#if ENGINE_MINOR_VERSION >= 18
1264+
FPlatformApplicationMisc::ClipboardPaste(clipboard);
1265+
#else
12471266
FGenericPlatformMisc::ClipboardPaste(clipboard);
1267+
#endif
12481268
return PyUnicode_FromString(TCHAR_TO_UTF8(*clipboard));
12491269
}

Source/UnrealEnginePython/Private/UObject/UEPyPhysics.cpp

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,13 @@ PyObject *py_ue_add_angular_impulse(ue_PyUObject * self, PyObject * args)
137137
if (py_obj_b_vel_change && PyObject_IsTrue(py_obj_b_vel_change))
138138
b_vel_change = true;
139139

140+
#if ENGINE_MINOR_VERSION >= 18
141+
primitive->AddAngularImpulseInRadians(impulse, f_bone_name, b_vel_change);
142+
#else
140143
primitive->AddAngularImpulse(impulse, f_bone_name, b_vel_change);
144+
#endif
141145

142-
Py_INCREF(Py_None);
143-
return Py_None;
146+
Py_RETURN_NONE;
144147
}
145148

146149

@@ -237,10 +240,13 @@ PyObject *py_ue_add_torque(ue_PyUObject * self, PyObject * args)
237240
if (py_obj_b_accel_change && PyObject_IsTrue(py_obj_b_accel_change))
238241
b_accel_change = true;
239242

243+
#if ENGINE_MINOR_VERSION >= 18
244+
primitive->AddTorqueInRadians(torque, f_bone_name, b_accel_change);
245+
#else
240246
primitive->AddTorque(torque, f_bone_name, b_accel_change);
247+
#endif
241248

242-
Py_INCREF(Py_None);
243-
return Py_None;
249+
Py_RETURN_NONE;
244250
}
245251

246252

@@ -369,10 +375,13 @@ PyObject *py_ue_set_physics_angular_velocity(ue_PyUObject * self, PyObject * arg
369375
f_bone_name = FName(UTF8_TO_TCHAR(bone_name));
370376
}
371377

378+
#if ENGINE_MINOR_VERSION >= 18
379+
primitive->SetPhysicsAngularVelocityInDegrees(new_ang_vel, add_to_current, f_bone_name);
380+
#else
372381
primitive->SetPhysicsAngularVelocity(new_ang_vel, add_to_current, f_bone_name);
382+
#endif
373383

374-
Py_INCREF(Py_None);
375-
return Py_None;
384+
Py_RETURN_NONE;
376385
}
377386

378387
PyObject *py_ue_get_physics_angular_velocity(ue_PyUObject * self, PyObject * args)

Source/UnrealEnginePython/UnrealEnginePython.Build.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ public UnrealEnginePython(TargetInfo Target)
125125
"RenderCore",
126126
"MovieSceneCapture",
127127
"Landscape",
128-
"Foliage"
128+
"Foliage",
129+
"ApplicationCore"
129130
// ... add private dependencies that you statically link with here ...
130131
}
131132
);

0 commit comments

Comments
 (0)