Skip to content

Commit dbc34a7

Browse files
committed
- Fixed deprecation warnings
1 parent 52b6d17 commit dbc34a7

File tree

9 files changed

+81
-12
lines changed

9 files changed

+81
-12
lines changed

Source/PythonAutomation/PythonAutomation.Build.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public PythonAutomation(TargetInfo Target)
1313
{
1414
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
1515
string enableUnityBuild = System.Environment.GetEnvironmentVariable("UEP_ENABLE_UNITY_BUILD");
16-
bFasterWithoutUnity = string.IsNullOrEmpty(enableUnityBuild);
16+
bUseUnity = string.IsNullOrEmpty(enableUnityBuild);
1717

1818
PrivateIncludePaths.AddRange(
1919
new string[] {

Source/PythonConsole/PythonConsole.Build.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public PythonConsole(TargetInfo Target)
1313
{
1414
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
1515
string enableUnityBuild = System.Environment.GetEnvironmentVariable("UEP_ENABLE_UNITY_BUILD");
16-
bFasterWithoutUnity = string.IsNullOrEmpty(enableUnityBuild);
16+
bUseUnity = string.IsNullOrEmpty(enableUnityBuild);
1717

1818
PrivateIncludePaths.AddRange(
1919
new string[] {

Source/PythonEditor/PythonEditor.Build.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public PythonEditor(TargetInfo Target)
1313

1414
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
1515
string enableUnityBuild = System.Environment.GetEnvironmentVariable("UEP_ENABLE_UNITY_BUILD");
16-
bFasterWithoutUnity = string.IsNullOrEmpty(enableUnityBuild);
16+
bUseUnity = string.IsNullOrEmpty(enableUnityBuild);
1717

1818
PrivateIncludePaths.AddRange(
1919
new string[] {

Source/UnrealEnginePython/Private/UObject/UEPyActor.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,11 @@ PyObject *py_ue_actor_create_default_subobject(ue_PyUObject * self, PyObject * a
649649
UObject *ret_obj = nullptr;
650650

651651
Py_BEGIN_ALLOW_THREADS;
652+
#if ENGINE_MINOR_VERSION >= 24
653+
ret_obj = actor->CreateDefaultSubobject(FName(UTF8_TO_TCHAR(name)), UObject::StaticClass(), u_class, false, true);
654+
#else
652655
ret_obj = actor->CreateDefaultSubobject(FName(UTF8_TO_TCHAR(name)), UObject::StaticClass(), u_class, false, false, true);
656+
#endif
653657
Py_END_ALLOW_THREADS;
654658

655659
if (!ret_obj)
@@ -795,7 +799,14 @@ PyObject *py_ue_get_actor_components_by_type(ue_PyUObject * self, PyObject * arg
795799

796800
PyObject *components = PyList_New(0);
797801

802+
#if ENGINE_MINOR_VERSION >= 24
803+
TArray<UActorComponent*> compArray;
804+
actor->GetComponents(u_class, compArray);
805+
806+
for (UActorComponent *component : compArray)
807+
#else
798808
for (UActorComponent *component : actor->GetComponentsByClass(u_class))
809+
#endif
799810
{
800811
ue_PyUObject *item = ue_get_python_uobject(component);
801812
if (item)

Source/UnrealEnginePython/Private/UObject/UEPyMaterial.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,11 @@ PyObject *py_ue_static_mesh_set_collision_for_lod(ue_PyUObject *self, PyObject *
511511
FMeshSectionInfo info = mesh->SectionInfoMap.Get(lod_index, material_index);
512512
#endif
513513
info.bEnableCollision = enabled;
514+
#if ENGINE_MINOR_VERSION >= 23
515+
mesh->GetSectionInfoMap().Set(lod_index, material_index, info);
516+
#else
514517
mesh->SectionInfoMap.Set(lod_index, material_index, info);
518+
#endif
515519

516520
mesh->MarkPackageDirty();
517521

@@ -545,9 +549,17 @@ PyObject *py_ue_static_mesh_set_shadow_for_lod(ue_PyUObject *self, PyObject * ar
545549
enabled = true;
546550
}
547551

552+
#if ENGINE_MINOR_VERSION >= 23
553+
FMeshSectionInfo info = mesh->GetSectionInfoMap().Get(lod_index, material_index);
554+
#else
548555
FMeshSectionInfo info = mesh->SectionInfoMap.Get(lod_index, material_index);
556+
#endif
549557
info.bCastShadow = enabled;
558+
#if ENGINE_MINOR_VERSION >= 23
559+
mesh->GetSectionInfoMap().Set(lod_index, material_index, info);
560+
#else
550561
mesh->SectionInfoMap.Set(lod_index, material_index, info);
562+
#endif
551563

552564
mesh->MarkPackageDirty();
553565

Source/UnrealEnginePython/Private/UObject/UEPySequencer.cpp

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,10 +230,20 @@ PyObject *py_ue_sequencer_changed(ue_PyUObject *self, PyObject * args)
230230
if (py_bool && PyObject_IsTrue(py_bool))
231231
{
232232
// try to open the editor for the asset
233+
#if ENGINE_MINOR_VERSION >= 24
234+
UAssetEditorSubsystem* AssetEditorSubsystem = GEditor->GetEditorSubsystem<UAssetEditorSubsystem>();
235+
AssetEditorSubsystem->OpenEditorForAsset(seq);
236+
#else
233237
FAssetEditorManager::Get().OpenEditorForAsset(seq);
238+
#endif
234239
}
235240

241+
#if ENGINE_MINOR_VERSION >= 24
242+
UAssetEditorSubsystem* AssetEditorSubsystem = GEditor->GetEditorSubsystem<UAssetEditorSubsystem>();
243+
IAssetEditorInstance *editor = AssetEditorSubsystem->FindEditorForAsset(seq, true);
244+
#else
236245
IAssetEditorInstance *editor = FAssetEditorManager::Get().FindEditorForAsset(seq, true);
246+
#endif
237247
if (editor)
238248
{
239249
FLevelSequenceEditorToolkit *toolkit = (FLevelSequenceEditorToolkit *)editor;
@@ -464,9 +474,15 @@ PyObject *py_ue_sequencer_add_actor(ue_PyUObject *self, PyObject * args)
464474
actors.Add((AActor *)py_ue_obj->ue_object);
465475

466476
// try to open the editor for the asset
477+
#if ENGINE_MINOR_VERSION >= 24
478+
UAssetEditorSubsystem* AssetEditorSubsystem = GEditor->GetEditorSubsystem<UAssetEditorSubsystem>();
479+
AssetEditorSubsystem->OpenEditorForAsset(seq);
480+
IAssetEditorInstance *editor = AssetEditorSubsystem->FindEditorForAsset(seq, true);
481+
#else
467482
FAssetEditorManager::Get().OpenEditorForAsset(seq);
468-
469483
IAssetEditorInstance *editor = FAssetEditorManager::Get().FindEditorForAsset(seq, true);
484+
#endif
485+
470486
if (editor)
471487
{
472488
FLevelSequenceEditorToolkit *toolkit = (FLevelSequenceEditorToolkit *)editor;
@@ -519,9 +535,15 @@ PyObject *py_ue_sequencer_add_actor_component(ue_PyUObject *self, PyObject * arg
519535
UActorComponent* actorComponent = (UActorComponent *)py_ue_obj->ue_object;
520536

521537
// try to open the editor for the asset
538+
#if ENGINE_MINOR_VERSION >= 24
539+
UAssetEditorSubsystem* AssetEditorSubsystem = GEditor->GetEditorSubsystem<UAssetEditorSubsystem>();
540+
AssetEditorSubsystem->OpenEditorForAsset(seq);
541+
IAssetEditorInstance *editor = AssetEditorSubsystem->FindEditorForAsset(seq, true);
542+
#else
522543
FAssetEditorManager::Get().OpenEditorForAsset(seq);
523-
524544
IAssetEditorInstance *editor = FAssetEditorManager::Get().FindEditorForAsset(seq, true);
545+
#endif
546+
525547
FGuid new_guid;
526548
if (editor)
527549
{
@@ -568,9 +590,15 @@ PyObject *py_ue_sequencer_make_new_spawnable(ue_PyUObject *self, PyObject * args
568590
ULevelSequence *seq = (ULevelSequence *)self->ue_object;
569591

570592
// try to open the editor for the asset
593+
#if ENGINE_MINOR_VERSION >= 24
594+
UAssetEditorSubsystem* AssetEditorSubsystem = GEditor->GetEditorSubsystem<UAssetEditorSubsystem>();
595+
AssetEditorSubsystem->OpenEditorForAsset(seq);
596+
IAssetEditorInstance *editor = AssetEditorSubsystem->FindEditorForAsset(seq, true);
597+
#else
571598
FAssetEditorManager::Get().OpenEditorForAsset(seq);
572-
573599
IAssetEditorInstance *editor = FAssetEditorManager::Get().FindEditorForAsset(seq, true);
600+
#endif
601+
574602
if (!editor)
575603
{
576604
return PyErr_Format(PyExc_Exception, "unable to access sequencer");

Source/UnrealEnginePython/Private/UObject/UEPyStaticMesh.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,18 @@ PyObject *py_ue_static_mesh_get_raw_mesh(ue_PyUObject *self, PyObject * args)
124124

125125
FRawMesh raw_mesh;
126126

127+
#if ENGINE_MINOR_VERSION >= 24
128+
if (lod_index < 0 || lod_index >= mesh->GetSourceModels().Num())
129+
#else
127130
if (lod_index < 0 || lod_index >= mesh->SourceModels.Num())
131+
#endif
128132
return PyErr_Format(PyExc_Exception, "invalid LOD index");
129133

134+
#if ENGINE_MINOR_VERSION >= 24
135+
mesh->GetSourceModel(lod_index).RawMeshBulkData->LoadRawMesh(raw_mesh);
136+
#else
130137
mesh->SourceModels[lod_index].RawMeshBulkData->LoadRawMesh(raw_mesh);
138+
#endif
131139

132140
return py_ue_new_fraw_mesh(raw_mesh);
133141
}

Source/UnrealEnginePython/Private/UObject/UEPyTransform.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,11 @@ PyObject *py_ue_get_relative_location(ue_PyUObject *self, PyObject * args)
466466
ue_py_check(self);
467467
if (self->ue_object->IsA<USceneComponent>())
468468
{
469+
#if ENGINE_MINOR_VERSION >= 24
470+
FVector vec3 = ((USceneComponent *)self->ue_object)->GetRelativeLocation();
471+
#else
469472
FVector vec3 = ((USceneComponent *)self->ue_object)->RelativeLocation;
473+
#endif
470474
return py_ue_new_fvector(vec3);
471475
}
472476
return PyErr_Format(PyExc_Exception, "uobject is not a USceneComponent");
@@ -477,7 +481,11 @@ PyObject *py_ue_get_relative_rotation(ue_PyUObject *self, PyObject * args)
477481
ue_py_check(self);
478482
if (self->ue_object->IsA<USceneComponent>())
479483
{
484+
#if ENGINE_MINOR_VERSION >= 24
485+
FRotator rot = ((USceneComponent *)self->ue_object)->GetRelativeRotation();
486+
#else
480487
FRotator rot = ((USceneComponent *)self->ue_object)->RelativeRotation;
488+
#endif
481489
return py_ue_new_frotator(rot);
482490
}
483491
return PyErr_Format(PyExc_Exception, "uobject is not a USceneComponent");
@@ -488,7 +496,11 @@ PyObject *py_ue_get_relative_scale(ue_PyUObject *self, PyObject * args)
488496
ue_py_check(self);
489497
if (self->ue_object->IsA<USceneComponent>())
490498
{
499+
#if ENGINE_MINOR_VERSION >= 24
500+
FVector vec3 = ((USceneComponent *)self->ue_object)->GetRelativeScale3D();
501+
#else
491502
FVector vec3 = ((USceneComponent *)self->ue_object)->RelativeScale3D;
503+
#endif
492504
return py_ue_new_fvector(vec3);
493505
}
494506
return PyErr_Format(PyExc_Exception, "uobject is not a USceneComponent");

Source/UnrealEnginePython/UnrealEnginePython.Build.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public UnrealEnginePython(TargetInfo Target)
9696

9797
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
9898
string enableUnityBuild = System.Environment.GetEnvironmentVariable("UEP_ENABLE_UNITY_BUILD");
99-
bFasterWithoutUnity = string.IsNullOrEmpty(enableUnityBuild);
99+
bUseUnity = string.IsNullOrEmpty(enableUnityBuild);
100100

101101
PublicIncludePaths.AddRange(
102102
new string[] {
@@ -213,7 +213,6 @@ public UnrealEnginePython(TargetInfo Target)
213213
System.Console.WriteLine("Using Python at: " + pythonHome);
214214
PublicIncludePaths.Add(pythonHome);
215215
string libPath = GetWindowsPythonLibFile(pythonHome);
216-
PublicLibraryPaths.Add(Path.GetDirectoryName(libPath));
217216
PublicAdditionalLibraries.Add(libPath);
218217
}
219218
else if (Target.Platform == UnrealTargetPlatform.Mac)
@@ -229,7 +228,7 @@ public UnrealEnginePython(TargetInfo Target)
229228
System.Console.WriteLine("Using Python at: " + pythonHome);
230229
PublicIncludePaths.Add(pythonHome);
231230
string libPath = GetMacPythonLibFile(pythonHome);
232-
PublicLibraryPaths.Add(Path.GetDirectoryName(libPath));
231+
PublicAdditionalLibraries.Add(libPath);
233232
PublicDelayLoadDLLs.Add(libPath);
234233
}
235234
else if (Target.Platform == UnrealTargetPlatform.Linux)
@@ -261,12 +260,11 @@ public UnrealEnginePython(TargetInfo Target)
261260
else if (Target.Platform == UnrealTargetPlatform.Android)
262261
{
263262
PublicIncludePaths.Add(System.IO.Path.Combine(ModuleDirectory, "../../android/python35/include"));
264-
PublicLibraryPaths.Add(System.IO.Path.Combine(ModuleDirectory, "../../android/armeabi-v7a"));
265-
PublicAdditionalLibraries.Add("python3.5m");
263+
PublicAdditionalLibraries.Add(System.IO.Path.Combine(ModuleDirectory, "../../android/armeabi-v7a", "python3.5m"));
266264

267265
string APLName = "UnrealEnginePython_APL.xml";
268266
string RelAPLPath = Utils.MakePathRelativeTo(System.IO.Path.Combine(ModuleDirectory, APLName), Target.RelativeEnginePath);
269-
AdditionalPropertiesForReceipt.Add(new ReceiptProperty("AndroidPlugin", RelAPLPath));
267+
AdditionalPropertiesForReceipt.Add("AndroidPlugin", RelAPLPath);
270268
}
271269
#endif
272270

0 commit comments

Comments
 (0)