Skip to content

Commit 6879ca9

Browse files
committed
ported to 4.21
1 parent acdfc18 commit 6879ca9

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

Source/UnrealEnginePython/Private/UObject/UEPyDataTable.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,11 @@ PyObject *py_ue_data_table_as_dict(ue_PyUObject * self, PyObject * args)
108108

109109
PyObject *py_dict = PyDict_New();
110110

111+
#if ENGINE_MINOR_VERSION > 20
112+
for (TMap<FName, uint8*>::TConstIterator RowMapIter(data_table->GetRowMap().CreateConstIterator()); RowMapIter; ++RowMapIter)
113+
#else
111114
for (TMap<FName, uint8*>::TConstIterator RowMapIter(data_table->RowMap.CreateConstIterator()); RowMapIter; ++RowMapIter)
115+
#endif
112116
{
113117
PyDict_SetItemString(py_dict, TCHAR_TO_UTF8(*RowMapIter->Key.ToString()), py_ue_new_owned_uscriptstruct(data_table->RowStruct, RowMapIter->Value));
114118
}
@@ -152,7 +156,11 @@ PyObject *py_ue_data_table_find_row(ue_PyUObject * self, PyObject * args)
152156
return PyErr_Format(PyExc_Exception, "uobject is not a UDataTable");
153157

154158
uint8 **data = nullptr;
159+
#if ENGINE_MINOR_VERSION > 20
160+
data = (uint8 **)data_table->GetRowMap().Find(FName(UTF8_TO_TCHAR(name)));
161+
#else
155162
data = data_table->RowMap.Find(FName(UTF8_TO_TCHAR(name)));
163+
#endif
156164
if (!data)
157165
{
158166
return PyErr_Format(PyExc_Exception, "key not found in UDataTable");
@@ -172,7 +180,11 @@ PyObject *py_ue_data_table_get_all_rows(ue_PyUObject * self, PyObject * args)
172180

173181
PyObject *py_list = PyList_New(0);
174182

183+
#if ENGINE_MINOR_VERSION > 20
184+
for (TMap<FName, uint8*>::TConstIterator RowMapIter(data_table->GetRowMap().CreateConstIterator()); RowMapIter; ++RowMapIter)
185+
#else
175186
for (TMap<FName, uint8*>::TConstIterator RowMapIter(data_table->RowMap.CreateConstIterator()); RowMapIter; ++RowMapIter)
187+
#endif
176188
{
177189
PyList_Append(py_list, py_ue_new_owned_uscriptstruct(data_table->RowStruct, RowMapIter->Value));
178190
}

Source/UnrealEnginePython/Private/UObject/UEPySkeletal.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
#include "Developer/MeshUtilities/Public/MeshUtilities.h"
66
#include "Wrappers/UEPyFMorphTargetDelta.h"
77
#include "Wrappers/UEPyFSoftSkinVertex.h"
8+
#if ENGINE_MINOR_VERSION > 20
9+
#include "Runtime/Engine/Public/Rendering/SkeletalMeshLODImporterData.h"
10+
#endif
811
#if ENGINE_MINOR_VERSION > 18
912
#include "Runtime/Engine/Public/Rendering/SkeletalMeshModel.h"
1013
#endif
@@ -953,9 +956,15 @@ PyObject *py_ue_skeletal_mesh_build_lod(ue_PyUObject *self, PyObject * args, PyO
953956
TArray<FSoftSkinVertex> soft_vertices;
954957

955958
TArray<FVector> points;
959+
#if ENGINE_MINOR_VERSION > 20
960+
TArray<SkeletalMeshImportData::FMeshWedge> wedges;
961+
TArray<SkeletalMeshImportData::FMeshFace> faces;
962+
TArray<SkeletalMeshImportData::FVertInfluence> influences;
963+
#else
956964
TArray<FMeshWedge> wedges;
957965
TArray<FMeshFace> faces;
958966
TArray<FVertInfluence> influences;
967+
#endif
959968
TArray<int32> points_to_map;
960969

961970
TArray<FVector> tangentsX;
@@ -976,7 +985,7 @@ PyObject *py_ue_skeletal_mesh_build_lod(ue_PyUObject *self, PyObject * args, PyO
976985

977986
points_to_map.Add(vertex_index);
978987

979-
FMeshWedge wedge;
988+
SkeletalMeshImportData::FMeshWedge wedge;
980989
wedge.iVertex = vertex_index;
981990
wedge.Color = ss_vertex->ss_vertex.Color;
982991
for (int32 i = 0; i < MAX_TEXCOORDS; i++)
@@ -987,7 +996,7 @@ PyObject *py_ue_skeletal_mesh_build_lod(ue_PyUObject *self, PyObject * args, PyO
987996

988997
for (int32 i = 0; i < MAX_TOTAL_INFLUENCES; i++)
989998
{
990-
FVertInfluence influence;
999+
SkeletalMeshImportData::FVertInfluence influence;
9911000
influence.VertIndex = wedge_index;
9921001
influence.BoneIndex = ss_vertex->ss_vertex.InfluenceBones[i];
9931002
influence.Weight = ss_vertex->ss_vertex.InfluenceWeights[i] / 255.f;
@@ -1009,7 +1018,7 @@ PyObject *py_ue_skeletal_mesh_build_lod(ue_PyUObject *self, PyObject * args, PyO
10091018

10101019
for (int32 i = 0; i < wedges.Num(); i += 3)
10111020
{
1012-
FMeshFace face;
1021+
SkeletalMeshImportData::FMeshFace face;
10131022
face.iWedge[0] = i;
10141023
face.iWedge[1] = i + 1;
10151024
face.iWedge[2] = i + 2;

Source/UnrealEnginePython/Private/UObject/UEPyWorld.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ PyObject *py_ue_quit_game(ue_PyUObject *self, PyObject * args)
4343
if (!controller)
4444
return PyErr_Format(PyExc_Exception, "unable to retrieve the first controller");
4545

46+
#if ENGINE_MINOR_VERSION > 20
47+
UKismetSystemLibrary::QuitGame(world, controller, EQuitPreference::Quit, false);
48+
#else
4649
UKismetSystemLibrary::QuitGame(world, controller, EQuitPreference::Quit);
50+
#endif
4751

4852
Py_RETURN_NONE;
4953
}

0 commit comments

Comments
 (0)