Page MenuHome

FBX export fails when batch mode is set to 'Scene' and mesh objects contain modifiers.
Needs Triage, NormalPublic

Description

System Information
Operating system: Windows-10-10.0.19041-SP0 64 Bits
Graphics card: GeForce GTX 1060 6GB/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 460.89

Blender Version
Broken: version: 2.91.2, branch: master, commit date: 2021-01-19 16:15, hash: rB5be9ef417703

Short description of error
There is a bug in the FBX exporter that prevents the 'Scene' Batch Mode from exporting scenes containing mesh objects with modifiers.

If a Blender file contains multiple scenes, and those scenes contain mesh objects with modifiers, and the user has not viewed those scenes yet (because the file was recently opened, for example), the export process will fail, and returns an error.

You can avoid this bug by loading each individual scene in the 3D Viewport before exporting, disabling Apply Modifiers in the export settings, or manually removing/applying all modifiers in the Blender file. However, none of these solutions are ideal.

I have experienced this bug on multiple computers using multiple versions of Blender since 2.80.

Exact steps for others to reproduce the error


I have attached a Blender file called Bug_SceneBatchExport.blend. It contains three scenes (Cube, Monkey, Sphere). Each scene contains one mesh object with a modifier.

  1. Open the Blender file. (If you have already opened it and viewed all three scenes, close it and open it again. This bug only occurs if the other scenes have not been viewed yet).
  2. In the main menu go to File > Export > FBX (.fbx)
  3. In the export settings set Batch Mode to 'Scene'.
  4. Click Export FBX.
  5. The export should fail, and you will get the following error message in the python console:
Python: Traceback (most recent call last):
  File "C:\Program Files\Blender Foundation\Blender 2.91\2.91\scripts\addons\io_scene_fbx\__init__.py", line 636, in execute
    return export_fbx_bin.save(self, context, **keywords)
  File "C:\Program Files\Blender Foundation\Blender 2.91\2.91\scripts\addons\io_scene_fbx\export_fbx_bin.py", line 3274, in save
    save_single(operator, scene, scene.view_layers[0].depsgraph, filepath, **kwargs_batch)
  File "C:\Program Files\Blender Foundation\Blender 2.91\2.91\scripts\addons\io_scene_fbx\export_fbx_bin.py", line 3079, in save_single
    scene_data = fbx_data_from_scene(scene, depsgraph, settings)
  File "C:\Program Files\Blender Foundation\Blender 2.91\2.91\scripts\addons\io_scene_fbx\export_fbx_bin.py", line 2302, in fbx_data_from_scene
    ob_to_convert = ob.evaluated_get(depsgraph) if settings.use_mesh_modifiers else ob
TypeError: Object.evaluated_get(): error with argument 1, "depsgraph" -  Function.depsgraph does not support a 'None' assignment Depsgraph type

location: <unknown location>:-1

If the batch export was successful it should create three FBX files, one for each scene. Each FBX should contain the contents of its corresponding scene, including mesh objects with applied modifiers.

That is all. Thank you for your hard work.