mitsuba-renderer/mitsuba-blender

Calling operator “bpy.ops.export_scene.mitsuba” error, could not be found

mengyuan-lee opened this issue · 10 comments

**Environment:

  • Ubuntu 18.04.4 LTS
  • bpy 3.4.0 or blender 3.3.1
  • Add-on Version: latest
  • python 3.10

I am going to import osm into Blender, change materials, and then export with bpy.ops.export_scene.mitsuba. However, it failed and suggested “ Calling operator “bpy.ops.export_scene.mitsuba” error, could not be found”. Please refer to the following code.

https://github.com/functions-lab/geo2sigmap/blob/ce771647e13fdba926462e99d0a28dc073870d0d/gen_data/Step2_Blender/blender_test_command_line.py#L321C17-L321C17

The command bpy.ops.export_scene.mitsuba is the exact command run by blender when using the export option in the UI, so it is likely that this does not work either. Are you sure the add-on is properly installed ? i.e. can you export the default scene from the UI ?

If so, it would be greatly appreciated if you could provide a minimal reproducer for your issue, ideally using the default scene and no other python dependencies except the addon itself.

Unfortunately, I cannot export the default scene.

The codes are as follows.

import bpy
import os
bpy.ops.preferences.addon_install(filepath='./mitsuba-blender.zip')

bpy.ops.preferences.addon_enable(module='mitsuba-blender')

f_path ='./test.xml'
bpy.ops.export_scene.mitsuba(filepath=f_path, axis_forward='Y', axis_up='Z')

Please create a test.py with the above codes and put the mitsuba-blender.zip in the same folder. Then you can run python test.py to reproduce the issue.

What's the error message you get ?

AttributeError: Calling operator “bpy.ops.export_scene.mitsuba” error, could not be found

I run the code with bpy 3.4 and mitsuba 3.5.0.

And I get the same error message if I run the code with blender 3.3.1 and mitsuba 3.5.0 by the command “blender --background --python test.py”.

Can you please try the same procedure, but directly in the UI instead of using a script ?

I ran the code in UI and find that the add-on is not successfully enabled. It suggets “Mitsuba dependencies not installed.” I clicked the “install dependencies” button but failed again.

Is there an error message in the addon settings ? If it failed to install dependencies, it should be printing some message like "failed to install dependencies".

I tried several times and finally it works. It seems that the performance is not stable. Thanks for the help.

Hi @mengyuan-lee

As the main contributor to geo2sigmap, I've encountered the same issue during code refactoring.

In my case, mitsuba==3.4.1 + mitsuba-blender==0.3.0 works but mitsuba==3.5.0 + mitsuba-blender==0.3.0 cause the same problem.

PS: We're updating geo2sigmap with a clearer README and a 10X faster data generation pipeline by the end of this week. Stay tuned!

I have a similar issue because I want to automate the blender to mitsuba conversion for several thousand files. Did you manage to the the transformation solely with a python script which is executed via bash in the terminal?