I am considering writing a python script which, once run by the Blender internal interpreter, would stay in memory, listening to a socket and reacting to messages.
As an example I would use this to preview the currently edited object in an external engine, without having to export it to the filesystem then loading it in the engine.
How can I design a plugin to have such a behavior?
Note that this question :
- Only targets the "staying in memory / listening to a socket" part with respect to Blender inner workings, not the scene crawling/exporting, messaging details etc.
- Does not make reference to the "
blender --background
" mode of operation. To the contrary I would like this to work in the usual, UI-driven interface.
I am also aware of the Blender Command Port patch, but it does not seem like it has ever been merged (and I would like this to work with a "vanilla" Blender).
bpy.app.handlers.frame_change_pre
, and usingthreading
to avoid freezing the GUI (see also blender.stackexchange.com/questions/2428/…). $\endgroup$