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...
This commit is contained in:
parent
067ccc71c2
commit
57684e2bbf
Notes:
blender-bot
2023-02-14 02:29:02 +01:00
Referenced by issue blender/blender#64999, FBX export fails with empty material slot
|
@ -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",
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue