Hello,
I have found tutorials to make Python scripts that create a UI and allow me to enhance the editor which is great. They use PySide2 and they don’t block the editor but still seem to run on the main thread without causing any issue.
But for what I want to do, Pyside and Qt aren’t what I want to use. And I would rather have a SDL2 Window. But a SDL2 window needs a infinite loop to render frame after frame.
So I can start the window in another python thread, but then the editor complains that the unreal.___ functions I’m using aren’t being called from the main thread.
My question is: how come PySide2 doesn’t block the editor, but is seemingly still running in the main thread ? The reason I think it runs in the main thread is that I don’t get warnings/errors that the unreal functions aren’t called from the main thread.
Can I get the same behavior as PySide2 => no blocking of the editor UI, but python script that can still run and execute functions in the editor ?
And part of that question is: how does PySide does it ?
EDIT: I’m still interested in other ways to do it, but I found a way around:
In the python script I create my SDL window and openGL context. And I register the main update loop as a callback with unreal.register_slate_pre_tick_callback()
In that callback I have a way to detect that the window must be closed, and when that happens I destroy the SDL window and call unreal.unregister_slate_pre_tick_callback()