mitsuba-renderer / mitsuba-blender

Mitsuba integration add-on for Blender
BSD 3-Clause "New" or "Revised" License
278 stars 36 forks source link

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

Closed mengyuan-lee closed 10 months ago

mengyuan-lee commented 10 months ago

**Environment:

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

bathal1 commented 10 months ago

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.

mengyuan-lee commented 10 months ago

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.

bathal1 commented 10 months ago

What's the error message you get ?

mengyuan-lee commented 10 months ago

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”.

bathal1 commented 10 months ago

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

mengyuan-lee commented 10 months ago

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.

bathal1 commented 10 months ago

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".

mengyuan-lee commented 10 months ago

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

otaGran commented 7 months ago

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!

Oberschnulli commented 7 months ago

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?