Hello
after searching a lot of forums and doing some posts, i would like to ask you developers in the Development category directly. Hope this is ok for you. The topic of multiprocessing is found in some discussions, so hopefully this question is interesting also for others.
What is the current state of multiprocessing in blender scripting? Is it supported in background only? What would be a minimal example? Please take a look at this post: Start multiprocessing from panel - Beginning Blender Code and Development - Blender Artists Community
Even if not started in mainloop, this appraoch is working well on Linux but not on windows. I guess this is due the different ways of starting jobs (spawn, fork). Furthermore it looks like a hack for me, because the multiprocessing is not started in mainloop at all.
There ist a function called “run_in_main_thread” suggested in app timers. Could this be used to start the jobs in mainloop? When printing the name it looks like, that it is running in the environment of the script.
Its mentioned in the docs, that threading can be used, if the script is joining the threads again. Does this apply to multiprocessing to, if the script is waiting for all jobs?
What would be another approach to add multiprocessing to our scripts? Is there some kind of handler to do this?
Thanks in advance,
Chris
Background: We try to create an add-on to run structural analysis with an genetic algorithm for creation and optimization of architectural structures. This is the current version of the script: GitHub - bewegende-Architektur/Phaenotyp: Phänotyp allows to perform genetic mutation of architectural structures. Furthermore it can be used to analyze moving shapes. This is especially useful when working on kinematic architectural projects. The tool is focusing on early stages of the design process and can be used for free without any warranty. If you want to participate in the project please get in contact via:
Please be aware, that this is still an early stage. Furthermore we are coming from the background of architecture and structural engineering. The structural analysis itself would not depend on blender. We are creating a truss object in pynite and start the job. The result is stored in a multiprocessing dict and is integrated after the calculation.