Skip to content

Commit bd21076

Browse files
author
Roberto De Ioris
committed
added get_inner(), get_key_prop() and get_value_prop()
1 parent 9cad9e7 commit bd21076

File tree

3 files changed

+55
-2
lines changed

3 files changed

+55
-2
lines changed

Source/UnrealEnginePython/Private/UEPyModule.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,9 @@ static PyMethodDef ue_PyUObject_methods[] = {
565565
{ "get_uproperty", (PyCFunction)py_ue_get_uproperty, METH_VARARGS, "" },
566566
{ "get_property_struct", (PyCFunction)py_ue_get_property_struct, METH_VARARGS, "" },
567567
{ "get_property_array_dim", (PyCFunction)py_ue_get_property_array_dim, METH_VARARGS, "" },
568+
{ "get_inner", (PyCFunction)py_ue_get_inner, METH_VARARGS, "" },
569+
{ "get_key_prop", (PyCFunction)py_ue_get_key_prop, METH_VARARGS, "" },
570+
{ "get_value_prop", (PyCFunction)py_ue_get_value_prop, METH_VARARGS, "" },
568571

569572
{ "functions", (PyCFunction)py_ue_functions, METH_VARARGS, "" },
570573

Source/UnrealEnginePython/Private/UObject/UEPyObject.cpp

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,8 +561,7 @@ PyObject *py_ue_find_function(ue_PyUObject * self, PyObject * args)
561561
UFunction *function = self->ue_object->FindFunction(FName(UTF8_TO_TCHAR(name)));
562562
if (!function)
563563
{
564-
Py_INCREF(Py_None);
565-
return Py_None;
564+
Py_RETURN_NONE;
566565
}
567566

568567
Py_RETURN_UOBJECT((UObject *)function);
@@ -1162,6 +1161,54 @@ PyObject *py_ue_get_uproperty(ue_PyUObject *self, PyObject * args)
11621161

11631162
}
11641163

1164+
PyObject *py_ue_get_inner(ue_PyUObject *self, PyObject * args)
1165+
{
1166+
1167+
ue_py_check(self);
1168+
1169+
UArrayProperty *u_property = ue_py_check_type<UArrayProperty>(self);
1170+
if (!u_property)
1171+
return PyErr_Format(PyExc_Exception, "object is not a UArrayProperty");
1172+
1173+
UProperty* inner = u_property->Inner;
1174+
if (!inner)
1175+
Py_RETURN_NONE;
1176+
1177+
Py_RETURN_UOBJECT(inner);
1178+
}
1179+
1180+
PyObject *py_ue_get_key_prop(ue_PyUObject *self, PyObject * args)
1181+
{
1182+
1183+
ue_py_check(self);
1184+
1185+
UMapProperty *u_property = ue_py_check_type<UMapProperty>(self);
1186+
if (!u_property)
1187+
return PyErr_Format(PyExc_Exception, "object is not a UMapProperty");
1188+
1189+
UProperty* key = u_property->KeyProp;
1190+
if (!key)
1191+
Py_RETURN_NONE;
1192+
1193+
Py_RETURN_UOBJECT(key);
1194+
}
1195+
1196+
PyObject *py_ue_get_value_prop(ue_PyUObject *self, PyObject * args)
1197+
{
1198+
1199+
ue_py_check(self);
1200+
1201+
UMapProperty *u_property = ue_py_check_type<UMapProperty>(self);
1202+
if (!u_property)
1203+
return PyErr_Format(PyExc_Exception, "object is not a UMapProperty");
1204+
1205+
UProperty* value = u_property->ValueProp;
1206+
if (!value)
1207+
Py_RETURN_NONE;
1208+
1209+
Py_RETURN_UOBJECT(value);
1210+
}
1211+
11651212
PyObject *py_ue_has_property(ue_PyUObject *self, PyObject * args)
11661213
{
11671214

Source/UnrealEnginePython/Private/UObject/UEPyObject.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ PyObject *py_ue_call(ue_PyUObject *, PyObject *);
2525
PyObject *py_ue_get_property(ue_PyUObject *, PyObject *);
2626
PyObject *py_ue_get_property_array_dim(ue_PyUObject *, PyObject *);
2727
PyObject *py_ue_get_uproperty(ue_PyUObject *, PyObject *);
28+
PyObject *py_ue_get_inner(ue_PyUObject *, PyObject *);
29+
PyObject *py_ue_get_key_prop(ue_PyUObject *, PyObject *);
30+
PyObject *py_ue_get_value_prop(ue_PyUObject *, PyObject *);
2831
PyObject *py_ue_get_property_class(ue_PyUObject *, PyObject *);
2932
PyObject *py_ue_has_property(ue_PyUObject *, PyObject *);
3033
PyObject *py_ue_is_rooted(ue_PyUObject *, PyObject *);

0 commit comments

Comments
 (0)