Skip to content

Commit 6f6fa94

Browse files
author
Roberto De Ioris
committed
2 parents 5f17cc8 + 0d89377 commit 6f6fa94

3 files changed

Lines changed: 12 additions & 8 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ The currently supported Unreal Engine versions are 4.12, 4.13, 4.14, 4.15, 4.16,
3434

3535
We support official python.org releases as well as IntelPython and Anaconda distributions.
3636

37-
Note: this plugin has nothing to do with the experimental 'PythonScriptPlugin' included in Unreal Engine >= 4.19. We aim at full integration with engine and editor (included the Slate api), as well as support for the vast majority of python features like asyncio, coroutines, generators, threads and third party modules.
37+
Note: this plugin has nothing to do with the experimental 'PythonScriptPlugin' included in Unreal Engine >= 4.19. We aim at full integration with engine and editor (included the Slate api, check here: https://github.com/20tab/UnrealEnginePython/blob/master/docs/Slate_API.md), as well as support for the vast majority of python features like asyncio, coroutines, generators, threads and third party modules.
3838

3939
# Binary installation on Windows (64 bit)
4040

Source/UnrealEnginePython/Private/PythonFunction.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,17 @@ void UPythonFunction::CallPythonCallable(FFrame& Stack, RESULT_DECL)
1919

2020
FScopePythonGIL gil;
2121

22+
#if ENGINE_MINOR_VERSION <= 18
23+
UObject *Context = Stack.Object;
24+
#endif
25+
2226
UPythonFunction *function = static_cast<UPythonFunction *>(Stack.CurrentNativeFunction);
2327

2428
bool on_error = false;
2529
bool is_static = function->HasAnyFunctionFlags(FUNC_Static);
2630

2731
// count the number of arguments
28-
Py_ssize_t argn = (Stack.Object && !is_static) ? 1 : 0;
32+
Py_ssize_t argn = (Context && !is_static) ? 1 : 0;
2933
TFieldIterator<UProperty> IArgs(function);
3034
for (; IArgs && ((IArgs->PropertyFlags & (CPF_Parm | CPF_ReturnParm)) == CPF_Parm); ++IArgs) {
3135
argn++;
@@ -34,22 +38,22 @@ void UPythonFunction::CallPythonCallable(FFrame& Stack, RESULT_DECL)
3438
UE_LOG(LogPython, Warning, TEXT("Initializing %d parameters"), argn);
3539
#endif
3640
PyObject *py_args = PyTuple_New(argn);
41+
argn = 0;
3742

38-
if (Stack.Object && !is_static) {
39-
PyObject *py_obj = (PyObject *)ue_get_python_uobject(Stack.Object);
43+
if (Context && !is_static) {
44+
PyObject *py_obj = (PyObject *)ue_get_python_uobject(Context);
4045
if (!py_obj) {
4146
unreal_engine_py_log_error();
4247
on_error = true;
4348
}
4449
else {
4550
Py_INCREF(py_obj);
46-
PyTuple_SetItem(py_args, 0, py_obj);
51+
PyTuple_SetItem(py_args, argn++, py_obj);
4752
}
4853
}
4954

5055
uint8 *frame = Stack.Locals;
5156

52-
argn = (Stack.Object && !is_static) ? 1 : 0;
5357
// is it a blueprint call ?
5458
if (*Stack.Code == EX_EndFunctionParms) {
5559
for (UProperty *prop = (UProperty *)function->Children; prop; prop = (UProperty *)prop->Next) {
@@ -127,4 +131,4 @@ UPythonFunction::~UPythonFunction()
127131
#if defined(UEPY_MEMORY_DEBUG)
128132
UE_LOG(LogPython, Warning, TEXT("PythonFunction callable %p XDECREF'ed"), this);
129133
#endif
130-
}
134+
}

docs/Slate_API.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ More infos here: https://api.unrealengine.com/INT/API/Editor/PropertyEditor/SObj
739739

740740
## SPythonEditorViewport
741741

742-
This is probably tu funniest widget, an EditorViewportClient and a whole World all in a single SWidget:
742+
This is probably the funniest widget, an EditorViewportClient and a whole World all in a single SWidget:
743743

744744
```python
745745
from unreal_engine import SWindow, SPythonEditorViewport, FVector, FRotator

0 commit comments

Comments
 (0)