MCPcopy Create free account
hub / github.com/20tab/UnrealEnginePython / ProcessEvent

Method ProcessEvent

Source/UnrealEnginePython/Public/PythonDelegate.cpp:22–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20}
21
22void UPythonDelegate::ProcessEvent(UFunction *function, void *Parms)
23{
24
25 if (!py_callable)
26 return;
27
28 FScopePythonGIL gil;
29
30 PyObject *py_args = nullptr;
31
32 if (signature_set) {
33 py_args = PyTuple_New(signature->NumParms);
34 Py_ssize_t argn = 0;
35
36 TFieldIterator<UProperty> PArgs(signature);
37 for (; PArgs && argn < signature->NumParms && ((PArgs->PropertyFlags & (CPF_Parm | CPF_ReturnParm)) == CPF_Parm); ++PArgs) {
38 UProperty *prop = *PArgs;
39 PyObject *arg = ue_py_convert_property(prop, (uint8 *)Parms);
40 if (!arg) {
41 unreal_engine_py_log_error();
42 Py_DECREF(py_args);
43 return;
44 }
45 PyTuple_SetItem(py_args, argn, arg);
46 argn++;
47 }
48 }
49
50 PyObject *ret = PyObject_CallObject(py_callable, py_args);
51 Py_XDECREF(py_args);
52 if (!ret) {
53 unreal_engine_py_log_error();
54 return;
55 }
56 // currently useless as events do not return a value
57 /*
58 if (signature_set) {
59 UProperty *return_property = signature->GetReturnProperty();
60 if (return_property && signature->ReturnValueOffset != MAX_uint16) {
61 if (!ue_py_convert_pyobject(ret, return_property, (uint8 *)Parms)) {
62 UE_LOG(LogPython, Error, TEXT("Invalid return value type for delegate"));
63 }
64 }
65 }
66 */
67 Py_DECREF(ret);
68}
69
70void UPythonDelegate::PyFakeCallable()
71{

Callers 1

py_ue_ufunction_callFunction · 0.80

Calls 2

ue_py_convert_propertyFunction · 0.85

Tested by

no test coverage detected