diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2019-05-23 10:34:45 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2019-05-23 10:34:45 +0300 |
commit | 57684e2bbf6073736bbd7708695d1a912b1a2a76 (patch) | |
tree | 807b4b443bedf07d1f258bd0791cfee8192b12d7 | |
parent | 067ccc71c20dbe3ac82fd47364c632d5a8c760b3 (diff) |
Fix T64999: FBX export fails with empty material slot.
We cannot reliably use `mesh.materials`, since those might be empty when
materials are only assigned/linked to the object...
-rw-r--r-- | io_scene_fbx/__init__.py | 2 | ||||
-rw-r--r-- | io_scene_fbx/export_fbx_bin.py | 5 |
2 files changed, 3 insertions, 4 deletions
diff --git a/io_scene_fbx/__init__.py b/io_scene_fbx/__init__.py index dfe55f17..f7f9c4e3 100644 --- a/io_scene_fbx/__init__.py +++ b/io_scene_fbx/__init__.py @@ -21,7 +21,7 @@ bl_info = { "name": "FBX format", "author": "Campbell Barton, Bastien Montagne, Jens Restemeier", - "version": (4, 14, 8), + "version": (4, 14, 9), "blender": (2, 80, 0), "location": "File > Import-Export", "description": "FBX IO meshes, UV's, vertex colors, materials, textures, cameras, lamps and actions", diff --git a/io_scene_fbx/export_fbx_bin.py b/io_scene_fbx/export_fbx_bin.py index 915dda16..6f01ddf8 100644 --- a/io_scene_fbx/export_fbx_bin.py +++ b/io_scene_fbx/export_fbx_bin.py @@ -1130,9 +1130,8 @@ def fbx_data_mesh_elements(root, me_obj, scene_data, done_meshes): # Face's materials. me_fbxmaterials_idx = scene_data.mesh_material_indices.get(me) if me_fbxmaterials_idx is not None: - # Mapping to indices is done using original material pointers, so need to go from evaluated - # to original (this is for the case mesh is a result of evaluated modifier stack). - me_blmaterials = [material.original for material in me.materials] + # We cannot use me.materials here, as this array is filled with None in case materials are linked to object... + me_blmaterials = [mat_slot.material for mat_slot in me_obj.material_slots] if me_fbxmaterials_idx and me_blmaterials: lay_ma = elem_data_single_int32(geom, b"LayerElementMaterial", 0) elem_data_single_int32(lay_ma, b"Version", FBX_GEOMETRY_MATERIAL_VERSION) |