77#include " Engine/LocalPlayer.h"
88#include " GameFramework/GameState.h"
99#include " SSearchBox.h"
10-
10+ // #include "UnrealEnginePython.h"
1111#define LOCTEXT_NAMESPACE " PythonConsole"
1212
1313
@@ -159,8 +159,6 @@ void SPythonConsoleInputBox::Tick(const FGeometry& AllottedGeometry, const doubl
159159}
160160
161161
162-
163-
164162void SPythonConsoleInputBox::OnTextCommitted (const FText& InText, ETextCommit::Type CommitInfo)
165163{
166164 if (CommitInfo == ETextCommit::OnEnter)
@@ -181,6 +179,8 @@ void SPythonConsoleInputBox::OnTextCommitted(const FText& InText, ETextCommit::T
181179 bIgnoreUIUpdate = false ;
182180
183181 // Here run the python code
182+ // FUnrealEnginePythonModule UnrealEnginePythonModule = FModuleManager::LoadModuleChecked<FUnrealEnginePythonModule>("UnrealEnginePython");
183+ // UnrealEnginePythonModule.PythonGILAcquire();
184184
185185 PyObject *eval_ret = PyRun_String (TCHAR_TO_UTF8 (*ExecString), Py_file_input, main_dict, local_dict);
186186
@@ -199,6 +199,7 @@ void SPythonConsoleInputBox::OnTextCommitted(const FText& InText, ETextCommit::T
199199
200200 if (!value) {
201201 PyErr_Clear ();
202+ // UnrealEnginePythonModule.PythonGILRelease();
202203 OnConsoleCommandExecuted.ExecuteIfBound ();
203204 return ;
204205 }
@@ -211,6 +212,7 @@ void SPythonConsoleInputBox::OnTextCommitted(const FText& InText, ETextCommit::T
211212
212213 if (!msg) {
213214 PyErr_Clear ();
215+ // UnrealEnginePythonModule.PythonGILRelease();
214216 OnConsoleCommandExecuted.ExecuteIfBound ();
215217 return ;
216218 }
@@ -220,13 +222,15 @@ void SPythonConsoleInputBox::OnTextCommitted(const FText& InText, ETextCommit::T
220222 // taken from uWSGI ;)
221223 if (!traceback) {
222224 PyErr_Clear ();
225+ // UnrealEnginePythonModule.PythonGILRelease();
223226 OnConsoleCommandExecuted.ExecuteIfBound ();
224227 return ;
225228 }
226229
227230 PyObject *traceback_module = PyImport_ImportModule (" traceback" );
228231 if (!traceback_module) {
229232 PyErr_Clear ();
233+ // UnrealEnginePythonModule.PythonGILRelease();
230234 OnConsoleCommandExecuted.ExecuteIfBound ();
231235 return ;
232236 }
@@ -238,6 +242,7 @@ void SPythonConsoleInputBox::OnTextCommitted(const FText& InText, ETextCommit::T
238242 PyObject *ret = PyObject_CallFunctionObjArgs (format_exception, type, value, traceback, NULL );
239243 if (!ret) {
240244 PyErr_Clear ();
245+ // UnrealEnginePythonModule.PythonGILRelease();
241246 OnConsoleCommandExecuted.ExecuteIfBound ();
242247 return ;
243248 }
@@ -256,6 +261,7 @@ void SPythonConsoleInputBox::OnTextCommitted(const FText& InText, ETextCommit::T
256261 }
257262 PyErr_Clear ();
258263 }
264+ // UnrealEnginePythonModule.PythonGILRelease();
259265 }
260266
261267 }
0 commit comments