Skip to content

Commit 3d814dc

Browse files
committed
Updated variable types to new FObject style, rather than UObject style
1 parent 1a18e22 commit 3d814dc

File tree

10 files changed

+301
-258
lines changed

10 files changed

+301
-258
lines changed

Source/UnrealEnginePython/Private/PythonDelegate.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "PythonDelegate.h"
33
#include "UEPyModule.h"
44
#include "UEPyCallable.h"
5+
#include "UObject/UEPyUPropertyBackwardsCompatibility.h"
56

67
UPythonDelegate::UPythonDelegate()
78
{
@@ -37,10 +38,10 @@ void UPythonDelegate::ProcessEvent(UFunction *function, void *Parms)
3738
py_args = PyTuple_New(signature->NumParms);
3839
Py_ssize_t argn = 0;
3940

40-
TFieldIterator<UProperty> PArgs(signature);
41+
TFieldIterator<FProperty> PArgs(signature);
4142
for (; PArgs && argn < signature->NumParms && ((PArgs->PropertyFlags & (CPF_Parm | CPF_ReturnParm)) == CPF_Parm); ++PArgs)
4243
{
43-
UProperty *prop = *PArgs;
44+
FProperty *prop = *PArgs;
4445
PyObject *arg = ue_py_convert_property(prop, (uint8 *)Parms, 0);
4546
if (!arg)
4647
{
@@ -63,7 +64,7 @@ void UPythonDelegate::ProcessEvent(UFunction *function, void *Parms)
6364
// currently useless as events do not return a value
6465
/*
6566
if (signature_set) {
66-
UProperty *return_property = signature->GetReturnProperty();
67+
FProperty *return_property = signature->GetReturnProperty();
6768
if (return_property && signature->ReturnValueOffset != MAX_uint16) {
6869
if (!ue_py_convert_pyobject(ret, return_property, (uint8 *)Parms)) {
6970
UE_LOG(LogPython, Error, TEXT("Invalid return value type for delegate"));

Source/UnrealEnginePython/Private/PythonFunction.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11

22
#include "PythonFunction.h"
33
#include "UEPyModule.h"
4+
#include "UObject/UEPyUPropertyBackwardsCompatibility.h"
45

56

67
void UPythonFunction::SetPyCallable(PyObject *callable)
@@ -30,7 +31,7 @@ void UPythonFunction::CallPythonCallable(FFrame& Stack, RESULT_DECL)
3031

3132
// count the number of arguments
3233
Py_ssize_t argn = (Context && !is_static) ? 1 : 0;
33-
TFieldIterator<UProperty> IArgs(function);
34+
TFieldIterator<FProperty> IArgs(function);
3435
for (; IArgs && ((IArgs->PropertyFlags & (CPF_Parm | CPF_ReturnParm)) == CPF_Parm); ++IArgs) {
3536
argn++;
3637
}
@@ -56,7 +57,7 @@ void UPythonFunction::CallPythonCallable(FFrame& Stack, RESULT_DECL)
5657

5758
// is it a blueprint call ?
5859
if (*Stack.Code == EX_EndFunctionParms) {
59-
for (UProperty *prop = (UProperty *)function->Children; prop; prop = (UProperty *)prop->Next) {
60+
for (FProperty *prop = (FProperty *)function->Children; prop; prop = (FProperty *)prop->Next) {
6061
if (prop->PropertyFlags & CPF_ReturnParm)
6162
continue;
6263
if (!on_error) {
@@ -75,7 +76,7 @@ void UPythonFunction::CallPythonCallable(FFrame& Stack, RESULT_DECL)
7576
//UE_LOG(LogPython, Warning, TEXT("BLUEPRINT CALL"));
7677
frame = (uint8 *)FMemory_Alloca(function->PropertiesSize);
7778
FMemory::Memzero(frame, function->PropertiesSize);
78-
for (UProperty *prop = (UProperty *)function->Children; *Stack.Code != EX_EndFunctionParms; prop = (UProperty *)prop->Next) {
79+
for (FProperty *prop = (FProperty *)function->Children; *Stack.Code != EX_EndFunctionParms; prop = (FProperty *)prop->Next) {
7980
Stack.Step(Stack.Object, prop->ContainerPtrToValuePtr<uint8>(frame));
8081
if (prop->PropertyFlags & CPF_ReturnParm)
8182
continue;
@@ -107,7 +108,7 @@ void UPythonFunction::CallPythonCallable(FFrame& Stack, RESULT_DECL)
107108
}
108109

109110
// get return value (if required)
110-
UProperty *return_property = function->GetReturnProperty();
111+
FProperty *return_property = function->GetReturnProperty();
111112
if (return_property && function->ReturnValueOffset != MAX_uint16) {
112113
#if defined(UEPY_MEMORY_DEBUG)
113114
UE_LOG(LogPython, Warning, TEXT("FOUND RETURN VALUE"));

Source/UnrealEnginePython/Private/UEPyAssetUserData.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ PyObject *py_ue_asset_import_data(ue_PyUObject * self, PyObject * args)
88
ue_py_check(self);
99

1010
UStruct *u_struct = (UStruct *)self->ue_object->GetClass();
11-
UClassProperty *u_property = (UClassProperty *)u_struct->FindPropertyByName(TEXT("AssetImportData"));
11+
FClassProperty *u_property = (FClassProperty *)u_struct->FindPropertyByName(TEXT("AssetImportData"));
1212
if (!u_property)
1313
{
1414
return PyErr_Format(PyExc_Exception, "UObject does not have asset import data.");
@@ -47,7 +47,7 @@ PyObject *py_ue_asset_import_data_set_sources(ue_PyUObject * self, PyObject * ar
4747
TArray<FString> filenames;
4848

4949
UStruct *u_struct = (UStruct *)self->ue_object->GetClass();
50-
UClassProperty *u_property = (UClassProperty *)u_struct->FindPropertyByName(TEXT("AssetImportData"));
50+
FClassProperty *u_property = (FClassProperty *)u_struct->FindPropertyByName(TEXT("AssetImportData"));
5151
if (!u_property)
5252
{
5353
return PyErr_Format(PyExc_Exception, "UObject does not have asset import data.");

0 commit comments

Comments
 (0)