mitsuba-renderer/mitsuba-blender

Exporting of scenes via the Python API

akdd11 opened this issue · 2 comments

akdd11 commented

It would be amazing, if the export could not only be done via the "Export" dialog, but if there would also be a direct access from the Python API (if that is feasible).

I am working a lot on creating scenes with the Python API, and adding this to the scripts would save the manual work here.

PS: is this project also open for external contributors? Then I could give it a try.

Hi,

This should already be possible, since all operators are registered in the Blender Python API. In general, you can find the API handle of each operator/parameter in the Blender UI by enabling "Python tooltips" in the Blender preferences (Interface > Display). Hovering over any operator/parameter will then show you the associated handle in the API.

In the case of this addon, the operator to call to export from the blender API should be bpy.ops.export_scene.mitsuba

You can check the signature of such functions in the Python interactive console inside of blender, by just entering the name of the operator.

If this is not what you had in mind, let me know. PRs are also welcome !

akdd11 commented

That's exactly what I had in mind, thanks!!