Egert_Kanep wrote: Thu Apr 04, 2019 9:03 pm
Mainly what I am interested in is the logic of exporter. My idea, maybe it already works this way, is that my compositing software will send 3d scene and material info(as text os something) to LuxCore, which is running on the background and the Lux sends the rendered image back to compositing software.
Do you mean like a daemon process that's always running? That's possible, but not how the current plugins work.
The Blender addon uses pyluxcore, which is a Python interface for LuxCore.
It works like this:
I create a new LuxCore scene with
This calls the Python API of LuxCore, which then calls the underlying C++ code and creates a Scene instance and gives the control back to Python.
Then I can for example convert a mesh:
Code: Select all
faces = mesh.tessfaces[0].as_pointer()
luxcore_scene.DefineBlenderMesh(name, len(mesh.tessfaces), faces ...)
Again, the Python API calls corresponding C++ code, which is executed. After the C++ function is done, the scene contains the converted mesh, and we jump out of the C++ code back to Python and execute the next lines of Python.
So a lot of it is happening on demand, there's no LuxCore process running all the time.
When the rendering is started, LuxCore creates the required threads from C++, so you don't care about that from the Python side. The rendering runs asynchronically, meaning your Python interpreter continues executing your code while LuxCore renders. Usually you create a loop for this where every x milliseconds you update the statistics, check if the user wants to end the render, check if any halt conditions are met - and of course you can retrieve the rendered output through a Python API function.
Does this description help? If you have further questions, ask away
