Feature outline
- Blender add-on that sends object data (i.e. edges) to osci-render
- Functionally replaces importing .obj files (no reason to deprecate this though)
- Allows for rendering of multiple objects easily
- Allows for objects to be animated
Communication with osci-render
Since neither osci-render or the osci-render add-on are a sub-process of one another, IPC using pipes doesn't make sense. Named pipes are potentially an option but look more painful to implement
Therefore regular sockets seem a more sensible option for IPC between Python and Java. Although I expect performance to be slightly worse than with pipes, I don't expect the data bandwidth will need to be massive. TODO: Approximate the required bandwidth for sending all edges every frame (this will depend on how often we need to do frame updates with Blender).
Protocol buffers look sensible to use for serialisation/deserialisation.
- IPC using sockets
- Java side acts as a server
- Python side is the client
- Use Protobuf
https://stackoverflow.com/questions/4185242/communication-between-python-client-and-java-server useful resource.
Required information from Blender
- All edge information for all visible objects as 3D coordinates (before projection)
- This is only required when an object is loaded in - not every frame!
- Equivalent to what osci-render currently extracts from an .obj file
- Position of all objects
- Rotation of all objects
- Camera position
- Camera rotation
- osci-render assumes there is no camera rotation, so this must be applied to the objects (kind of like screen-space coordinates)
Relevant Blender handlers
bpy.app.handlers.frame_change_pre
- Called every frame
- This will be used to send:
- Position of all objects
- Rotation of all objects
- Camera position
- Camera rotation
bpy.app.handlers.depsgraph_update_pre
- Called every time the depsgraph is updated (not actually sure what this means, but it's frequent enough that it would capture new objects being imported)
- This is called after a lot of different actions in Blender, but I can check whether the specific thing I'm looking for has changed. E.g. check if there are any new objects in the scene to import into osci-render
- This will be used to send:
- Edge information for visible objects
OTHER SECTIONS TODO