Fix #104714: Missing shape keys in FBX export when original mesh data cannot be used
commitbc801d7b1dad4be446435e0cab4d3a80e6bb1d04
authorThomas Barlow <github@mysterymayhem.co.uk>
Tue, 19 Sep 2023 00:26:16 +0000 (19 02:26 +0200)
committerMysteryem <mysteryem@noreply.localhost>
Tue, 19 Sep 2023 00:26:16 +0000 (19 02:26 +0200)
treec69a9562a98857fc08ec6c566f0abb079ecd321e
parent2b8d9bf2b8f229adb150fdbcfd901fe6fad3c43d
Fix #104714: Missing shape keys in FBX export when original mesh data cannot be used

Enabling the Triangulate Faces option of the exporter or exporting mesh
Objects with Object-linked materials would remove the shape keys of the
exported Meshes, even without there being modifiers to apply.

This patch fixes the shape keys being removed, by using `Mesh.copy()`
instead of `BlendDataMeshes.new_from_object()` which currently always
removes shape keys and is unlikely to be changed to keep the shape keys
of non-evaluated meshes any time soon.

For the other cases of converting non-mesh Objects to meshes or
converting evaluated Objects to meshes when applying modifiers,
`BlendDataMeshes.new_from_object()` is still used.

The code has been reorganised to make the separate cases of using
`Mesh.copy()` and `BlendDataMeshes.new_from_object()` clearer than if
they were added directly into the existing code.

Aside from the lack of shape keys, it's possible there could be some
other differences between meshes copied with `Mesh.copy()` and
`BlendDataMeshes.new_from_object()`, but I have not noticed any.

Pull Request: https://projects.blender.org/blender/blender-addons/pulls/104890
io_scene_fbx/__init__.py
io_scene_fbx/export_fbx_bin.py