diff --git a/io_scene_fbx/export_fbx_bin.py b/io_scene_fbx/export_fbx_bin.py index 5ecc8706bb0d33bd46cce8e8b0c77339d6b31f2a..cbcc8675ef5e66f9b09e451fdc8ee3b2cd3032c8 100644 --- a/io_scene_fbx/export_fbx_bin.py +++ b/io_scene_fbx/export_fbx_bin.py @@ -2245,7 +2245,6 @@ def fbx_data_from_scene(scene, depsgraph, settings): for shape in me.shape_keys.key_blocks[1:]: # Only write vertices really different from org coordinates! - # XXX FBX does not like empty shapes (makes Unity crash e.g.), so we have to do this here... :/ shape_verts_co = [] shape_verts_idx = [] @@ -2258,8 +2257,13 @@ def fbx_data_from_scene(scene, depsgraph, settings): continue shape_verts_co.extend(Vector(sv_co) - Vector(ref_co)) shape_verts_idx.append(idx) + + # FBX does not like empty shapes (makes Unity crash e.g.). + # To prevent this, we add a vertex that does nothing, but it keeps the shape key intact if not shape_verts_co: - continue + shape_verts_co.extend((0, 0, 0)) + shape_verts_idx.append(0) + channel_key, geom_key = get_blender_mesh_shape_channel_key(me, shape) data = (channel_key, geom_key, shape_verts_co, shape_verts_idx) data_deformers_shape.setdefault(me, (me_key, shapes_key, {}))[2][shape] = data