Fix #104714: Missing shape keys in FBX export when original mesh data cannot be used #104890

Merged
Thomas Barlow merged 7 commits from Mysteryem/blender-addons:fbx_fix_triangulate_removing_shapes into main 2023-09-19 02:26:19 +02:00
Member

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.

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.
Thomas Barlow added 5 commits 2023-09-16 00:27:59 +02:00
Thomas Barlow requested review from Bastien Montagne 2023-09-16 00:30:05 +02:00
Bastien Montagne approved these changes 2023-09-18 14:03:02 +02:00
Bastien Montagne left a comment
Owner

The general reorganization of the code, and changes described in the comments and commit message, make total sense to me. I will trust you for the code details. ;)

The general reorganization of the code, and changes described in the comments and commit message, make total sense to me. I will trust you for the code details. ;)
Thomas Barlow added 2 commits 2023-09-19 02:12:04 +02:00
Thomas Barlow merged commit bc801d7b1d into main 2023-09-19 02:26:19 +02:00
Thomas Barlow deleted branch fbx_fix_triangulate_removing_shapes 2023-09-19 02:26:21 +02:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#104890
No description provided.