Correctly process meshes with empty material slots
authorMikko Rasa <tdb@tdb.fi>
Wed, 3 Jul 2019 16:35:05 +0000 (19:35 +0300)
committerMikko Rasa <tdb@tdb.fi>
Wed, 3 Jul 2019 16:35:05 +0000 (19:35 +0300)
This may happen if materials are defined on the object rather than on
the mesh.

blender/io_mspgl/export_object.py

index 0e6a9022c24790e8f960e84d9ac1c5a2439ebbee..6e399b0199f9f77b10175fe5a4a86027d29a88cc 100644 (file)
@@ -105,7 +105,7 @@ class ObjectExporter:
                        progress.push_task_slice("LOD {}".format(lod_index), i, len(lods))
 
                        material_map = None
-                       mapped_count = sum(m.material_map for m in l.data.materials)
+                       mapped_count = sum(m.material_map for m in l.data.materials if m)
                        if mapped_count:
                                material_map_tech = l.data.materials[0].technique
                                tech_mismatch = any(m.technique!=material_map_tech for m in l.data.materials)