Skip to content

Commit 1e57bb8

Browse files
author
Roberto De Ioris
committed
fixed non-unity build
1 parent 1c4932f commit 1e57bb8

2 files changed

Lines changed: 21 additions & 10 deletions

File tree

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,36 @@
11

22
#include "PythonScript.h"
33

4-
static void callback(void *arg) {
4+
#include "UEPyModule.h"
5+
6+
7+
static void callback(void *arg)
8+
{
59
UPythonScript *self = (UPythonScript *)arg;
610
self->CallSpecificFunctionWithArgs();
711
}
812

9-
void UPythonScript::Run() {
13+
void UPythonScript::Run()
14+
{
1015
FUnrealEnginePythonModule &PythonModule = FModuleManager::GetModuleChecked<FUnrealEnginePythonModule>("UnrealEnginePython");
1116
PythonModule.RunFile(TCHAR_TO_UTF8(*ScriptPath));
12-
if (!FunctionToCall.IsEmpty()) {
17+
if (!FunctionToCall.IsEmpty())
18+
{
1319
CallSpecificFunctionWithArgs();
1420
}
1521
}
1622

17-
void UPythonScript::RunSandboxed() {
23+
void UPythonScript::RunSandboxed()
24+
{
1825
FUnrealEnginePythonModule &PythonModule = FModuleManager::GetModuleChecked<FUnrealEnginePythonModule>("UnrealEnginePython");
1926
PythonModule.RunFileSandboxed(TCHAR_TO_UTF8(*ScriptPath), callback, this);
2027
}
2128

22-
void UPythonScript::CallSpecificFunctionWithArgs() {
29+
void UPythonScript::CallSpecificFunctionWithArgs()
30+
{
2331
PyObject *function_to_call = PyDict_GetItemString(PyEval_GetGlobals(), TCHAR_TO_UTF8(*FunctionToCall));
24-
if (!function_to_call) {
32+
if (!function_to_call)
33+
{
2534
UE_LOG(LogPython, Error, TEXT("unable to find function %s"), *FunctionToCall);
2635
return;
2736
}
@@ -32,16 +41,19 @@ void UPythonScript::CallSpecificFunctionWithArgs() {
3241
if (n > 0)
3342
args = PyTuple_New(n);
3443

35-
for (int i = 0; i < n; i++) {
44+
for (int i = 0; i < n; i++)
45+
{
3646
PyTuple_SetItem(args, i, PyUnicode_FromString(TCHAR_TO_UTF8(*FunctionArgs[i])));
3747
}
3848

3949
PyObject *ret = PyObject_Call(function_to_call, args, nullptr);
4050
Py_DECREF(args);
41-
if (!ret) {
51+
if (!ret)
52+
{
4253
unreal_engine_py_log_error();
4354
}
44-
else {
55+
else
56+
{
4557
Py_DECREF(ret);
4658
}
4759
}

‎Source/UnrealEnginePython/Public/PythonScript.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#pragma once
22

3-
#include "UEPyModule.h"
43
#include "UObject/Object.h"
54
#include "PythonScript.generated.h"
65

0 commit comments

Comments
 (0)