Skip to content

Commit e23c956

Browse files
author
David
committed
Added keyword arguments for Outer and Name for UObject instance creation in python.
This was used to get the blueprint node creation example scripts to work in 4.25.
1 parent d957ca0 commit e23c956

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

Source/UnrealEnginePython/Private/UEPyModule.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1416,7 +1416,22 @@ static PyObject* ue_PyUObject_call(ue_PyUObject* self, PyObject* args, PyObject*
14161416
{
14171417
return NULL;
14181418
}
1419+
// allow for keyword specification of Outer and Name
1420+
// because want to be able to just add Outer
1421+
// note that we do not check for other keywords being passed - they are just ignored
1422+
// for the moment override positional arguments if given in keyword form
1423+
if (kw)
1424+
{
1425+
PyObject* py_chk_outer = PyDict_GetItemString(kw, "Outer");
1426+
if (py_chk_outer != nullptr)
1427+
py_outer = py_chk_outer;
1428+
PyObject* py_chk_name = PyDict_GetItemString(kw, "Name");
1429+
if (py_chk_name != nullptr)
1430+
py_name = py_chk_name;
1431+
}
14191432
int num_args = py_name ? 3 : 1;
1433+
if (num_args == 1 && py_outer != Py_None)
1434+
num_args = 2;
14201435
PyObject* py_args = PyTuple_New(num_args);
14211436
Py_INCREF((PyObject*)self);
14221437
PyTuple_SetItem(py_args, 0, (PyObject*)self);
@@ -1426,6 +1441,10 @@ static PyObject* ue_PyUObject_call(ue_PyUObject* self, PyObject* args, PyObject*
14261441
PyTuple_SetItem(py_args, 1, py_outer);
14271442
Py_INCREF(py_name);
14281443
PyTuple_SetItem(py_args, 2, py_name);
1444+
} else if (py_outer != Py_None)
1445+
{
1446+
Py_INCREF(py_outer);
1447+
PyTuple_SetItem(py_args, 1, py_outer);
14291448
}
14301449
ue_PyUObject* ret = (ue_PyUObject*)py_unreal_engine_new_object(nullptr, py_args);
14311450
Py_DECREF(py_args);

0 commit comments

Comments
 (0)