Browse Source

Blender JSON exporter: Fixes issue when exporting mesh materials with the 'Face Materials' checkbox checked but there are no face materials to export. (#8717) (#8782)

carlosanunes 9 years ago
parent
commit
bf827deab4
1 changed files with 4 additions and 0 deletions
  1. 4 0
      utils/exporters/blender/addons/io_three/exporter/api/mesh.py

+ 4 - 0
utils/exporters/blender/addons/io_three/exporter/api/mesh.py

@@ -507,6 +507,10 @@ def materials(mesh, options):
     """
     """
     logger.debug("mesh.materials(%s, %s)", mesh, options)
     logger.debug("mesh.materials(%s, %s)", mesh, options)
 
 
+    # sanity check
+    if not mesh.materials:
+        return []
+
     indices = []
     indices = []
     for face in mesh.tessfaces:
     for face in mesh.tessfaces:
         if face.material_index not in indices:
         if face.material_index not in indices: