Skip to content

Commit 9c77ac0

Browse files
committed
UEPyLambda from getnamo fork
1 parent 821ef2a commit 9c77ac0

File tree

3 files changed

+139
-0
lines changed

3 files changed

+139
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#include "UEPyLambda.h"
2+
#include "UnrealEnginePythonPrivatePCH.h"
3+
4+
PyObject * py_ue_run_on_game_thread(PyObject* PyFunction, PyObject* Args)
5+
{
6+
//Todo: convert from input to function
7+
8+
//Dispatch function on game thread
9+
FFunctionGraphTask::CreateAndDispatchWhenReady([PyFunction, Args]
10+
{
11+
//Call the PyFunction with Args here after acquiring GIL
12+
}, TStatId(), nullptr, ENamedThreads::GameThread);
13+
14+
return Py_False;
15+
}
16+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#pragma once
2+
3+
#include "UnrealEnginePython.h"
4+
5+
PyObject *py_ue_run_on_game_thread(ue_PyUObject *, PyObject *);
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
// Copyright 20Tab S.r.l.
2+
3+
#pragma once
4+
5+
//#define UEPY_MEMORY_DEBUG 1
6+
#define UEPY_THREADING 1
7+
8+
#include "UnrealEnginePython.h"
9+
10+
// You should place include statements to your module's private header files here. You only need to
11+
// add includes for headers that are used in most of your module's source files though.
12+
13+
#include "Engine.h"
14+
#if WITH_EDITOR
15+
#include "Editor.h"
16+
#endif
17+
18+
#include "Runtime/Launch/Resources/Version.h"
19+
20+
21+
#if defined(UNREAL_ENGINE_PYTHON_ON_MAC)
22+
#include <Headers/Python.h>
23+
#include <Headers/structmember.h>
24+
#elif defined(UNREAL_ENGINE_PYTHON_ON_LINUX)
25+
#include <Python.h>
26+
#include <structmember.h>
27+
#else
28+
#include <Include/Python.h>
29+
#include <Include/structmember.h>
30+
#endif
31+
32+
#include "UEPyModule.h"
33+
34+
#include "Wrappers/UEPyESlateEnums.h"
35+
36+
#include "Wrappers/UEPyFVector.h"
37+
#include "Wrappers/UEPyFHitResult.h"
38+
#include "Wrappers/UEPyFRotator.h"
39+
#include "Wrappers/UEPyFTransform.h"
40+
#include "Wrappers/UEPyFColor.h"
41+
#include "Wrappers/UEPyFLinearColor.h"
42+
#include "Wrappers/UEPyFSocket.h"
43+
#include "Wrappers/UEPyFQuat.h"
44+
45+
#include "Wrappers/UEPyFRawAnimSequenceTrack.h"
46+
47+
#include "Wrappers/UEPyFRandomStream.h"
48+
49+
#include "Wrappers/UEPyFPythonOutputDevice.h"
50+
#include "Wrappers/UEPyFSoftSkinVertex.h"
51+
#include "Wrappers/UEPyFMorphTargetDelta.h"
52+
#include "Wrappers/UEPyFObjectThumbnail.h"
53+
54+
#include "Wrappers/UEPyFViewportClient.h"
55+
#if WITH_EDITOR
56+
#include "Wrappers/UEPyFEditorViewportClient.h"
57+
#endif
58+
59+
#include "UEPyCallable.h"
60+
#include "UEPyUClassesImporter.h"
61+
#include "UEPyEnumsImporter.h"
62+
#include "UEPyUStructsImporter.h"
63+
64+
#include "UEPyUScriptStruct.h"
65+
66+
#if WITH_EDITOR
67+
#include "Wrappers/UEPyFAssetData.h"
68+
#include "Wrappers/UEPyFARFilter.h"
69+
#include "Wrappers/UEPyFRawMesh.h"
70+
#include "Wrappers/UEPyFStringAssetReference.h"
71+
#include "UObject/UEPyAnimSequence.h"
72+
#include "Blueprint/UEPyEdGraphPin.h"
73+
#include "UEPyIPlugin.h"
74+
#include "CollectionManager/UEPyICollectionManager.h"
75+
#include "MaterialEditorUtilities/UEPyFMaterialEditorUtilities.h"
76+
#endif
77+
78+
#include "Slate/UEPySlate.h"
79+
#include "Http/UEPyIHttp.h"
80+
#include "ConsoleManager/UEPyIConsoleManager.h"
81+
#include "SlateApplication/UEPyFSlateApplication.h"
82+
#include "Voice/UEPyIVoiceCapture.h"
83+
84+
#include "PythonHouseKeeper.h"
85+
86+
87+
#define ue_py_check(py_u) if (!FUnrealEnginePythonHouseKeeper::Get()->IsValidPyUObject(py_u))\
88+
return PyErr_Format(PyExc_Exception, "PyUObject is in invalid state")
89+
90+
#define ue_py_check_int(py_u) if (!FUnrealEnginePythonHouseKeeper::Get()->IsValidPyUObject(py_u))\
91+
{\
92+
PyErr_SetString(PyExc_Exception, "PyUObject is in invalid state");\
93+
return -1;\
94+
}
95+
96+
#if PY_MAJOR_VERSION < 3
97+
char *PyUnicode_AsUTF8(PyObject *py_str);
98+
int PyGILState_Check();
99+
#endif
100+
bool PyUnicodeOrString_Check(PyObject *py_obj);
101+
102+
#define Py_RETURN_UOBJECT(py_uobj) ue_PyUObject *ret = ue_get_python_uobject_inc(py_uobj);\
103+
if (!ret)\
104+
return PyErr_Format(PyExc_Exception, "uobject is in invalid state");\
105+
return (PyObject *)ret;
106+
107+
#define Py_RETURN_UOBJECT_NOINC(py_uobj) ue_PyUObject *ret = ue_get_python_uobject(py_uobj);\
108+
if (!ret)\
109+
return PyErr_Format(PyExc_Exception, "uobject is in invalid state");\
110+
return (PyObject *)ret;
111+
112+
#if ENGINE_MINOR_VERSION < 16
113+
template<class CPPSTRUCT>
114+
struct TStructOpsTypeTraitsBase2 : TStructOpsTypeTraitsBase
115+
{
116+
117+
};
118+
#endif

0 commit comments

Comments
 (0)