Hello everyone,
I really believe that adding multithreading support would open lots of paths to extend and improve current algorithms.
With this topic I would like to understand if there is real interest from users and of course, if the development team has something against it ( and how we can convince them to overcome that something ).
My intention is to use blender for data science visualisation where flow and generators are computed by other languages or programs but having the full freedom to plot/animate it in any shape you like.
This is my second try to define some process that would expose the control of blender via a REST API with no success.
Here is the example code used to test this, the commented line crashes blender with āSegmentation fault (Core dumped)ā .
from http.server import HTTPServer, BaseHTTPRequestHandler
import threading
import bpy
from random import randint
class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
print(threading.current_thread().name, "handle get")
bpy.data.objects['Cube'].location.x += 0.05
#bpy.ops.mesh.primitive_cube_add(location=(randint(-10,10),randint(-10,10),randint(-10,10)))
self.send_response(200)
self.end_headers()
self.wfile.write(b'Hello, world!')
def log_message(self, format, *args):
return
class ServerThread(threading.Thread):
def __init__(self,port):
super(ServerThread, self).__init__()
self.port=port
def run(self):
httpd = HTTPServer(('localhost', self.port), SimpleHTTPRequestHandler)
httpd.serve_forever()
httpServer = ServerThread(8000)
httpServer.setDaemon(True)
httpServer.start()
Running this in the Scripting window is stable if you only move existing mesh (maybe), but will fail if you add new ones.
Simply do a ācurl locahost:8000ā and should move the āCubeā mesh. Uncomment the adding cube command and it will crash
There is a lot to discuss on this topic and would be happy to be part of it.
Any chance convincing someone to start fixing the multithreading issues ?