blender-addons/io_scene_fbx
Thomas Barlow dab724afe2 Fix #104737: FBX: Materials missing from linked duplicates
Exporting meshes with duplicate materials combines them into a single
material slot (Material->Model connection) when exporting as FBX because
the material indices dict is keyed by materials. This resulted in unused
duplicate material slots being included in the export.

[1] removed these unused duplicate material slots, however, because the
materials for each object are keyed by the object's mesh, this meant
that linked duplicates sharing the same mesh (aside from the first
linked duplicate processed) would not get any material slots because
their materials would already be present in their mesh's dict that
mapped from materials to material indices.

Without larger changes to how materials and material slots are exported,
it is not currently possible to simultaneously remove the unused
duplicate material slots and support linked duplicates. The code for
exporting materials and material slots needs some redesigning anyway so
that linked duplicates with differing materials are actually exported as
linked duplicates instead of duplicating their meshes on export, but
this would be more of a target for 4.0.

As noted in [1], reverting [0] was also an option, so this patch does as
noted and reverts the functional changes of [0], but keeps the comment
because it's still relevant.

This patch changes the export of meshes containing duplicate materials
to export unused duplicate material slots as they did before [1].
Note that because of [2], these unused duplicate material slots are
visible to users when importing the .fbx back into Blender, just like
any meshes with duplicate materials exported as .fbx by Blender 3.5 and
earlier.

[0]: 5c9ecad1d2
[1]: 0a4e4f2704
[2]: 80db34b208

Pull Request: #104738
2023-07-12 14:59:46 +02:00
..
__init__.py Revert "Merge branch 'main' into blender-v3.6-release" 2023-07-05 09:41:03 +02:00
data_types.py Revert "Merge branch 'main' into blender-v3.6-release" 2023-07-05 09:41:03 +02:00
encode_bin.py Revert "Merge branch 'main' into blender-v3.6-release" 2023-07-05 09:41:03 +02:00
export_fbx_bin.py Fix #104737: FBX: Materials missing from linked duplicates 2023-07-12 14:59:46 +02:00
fbx2json.py Revert "Merge branch 'main' into blender-v3.6-release" 2023-07-05 09:41:03 +02:00
fbx_utils.py Revert "Merge branch 'main' into blender-v3.6-release" 2023-07-05 09:41:03 +02:00
import_fbx.py Revert "Merge branch 'main' into blender-v3.6-release" 2023-07-05 09:41:03 +02:00
json2fbx.py Revert "Merge branch 'main' into blender-v3.6-release" 2023-07-05 09:41:03 +02:00
parse_fbx.py Revert "Merge branch 'main' into blender-v3.6-release" 2023-07-05 09:41:03 +02:00