Fix #104669: Incorrect material assignment of imported FBX with duplicate materials #104683
No reviewers
Labels
No Label
Interest
Animation & Rigging
Interest
Blender Cloud
Interest
Collada
Interest
Core
Interest
Documentation
Interest
Eevee & Viewport
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
Import and Export
Interest
Modeling
Interest
Modifiers
Interest
Nodes & Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds, Tests & Devices
Interest
Python API
Interest
Rendering & Cycles
Interest
Sculpt, Paint & Texture
Interest
Translations
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Meta
Good First Issue
Meta
Papercut
Module
Add-ons (BF-Blender)
Module
Add-ons (Community)
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender-addons#104683
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "Mysteryem/blender-addons:fix_duplicate_material_import_pr"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The initial fix made for #103976 incorrectly identified the issue as
being part of the exporter and changed the exporter to work with the
bugged behaviour of the importer. This patch fixes the issue on the
importer side.
Unlike Blender, Materials always belong to the FBX Model (Object
equivalent), whereas Blender defaults to the Materials belonging to the
Mesh (FBX Geometry equivalent). When a Mesh was used by multiple
Objects, to prevent appending the Materials of each FBX Model to the
Mesh, a set of already used Materials was kept and non-unique Materials
would be skipped. However, skipping non-unique Materials would mean the
material indices of a Mesh no longer match its Materials, causing the
material indices to appear offset or invalid.
This patch changes the import of Meshes containing duplicate Materials.
The duplicates are now added to the Mesh in their original order
instead of being skipped.
This patch changes the import of Meshes used by more than one Object
whereby the imported Objects have different Materials. After the
Materials from the first imported Object are appended to the Mesh, any
different Materials from other imported Objects at the same indices have
their Material Slot linked to the Object with the differing Material set
in that Material Slot. If other imported Objects have more Materials
than the number of existing materials on the Mesh, the additional
Materials are appended to the Mesh. Previously, Materials that were
already present in the Mesh would be skipped and new Materials would be
appended to the end of the Mesh's Materials.
Meshes containing duplicate materials that were exported by Blender 3.5
and earlier would export duplicate materials despite only one of the
duplicates being used by the exported mesh (fixed in #104667). All the
duplicates in these FBX files are now imported with this change.
Due to the previous incorrect attempt fix for #103976, FBX with
duplicate materials exported by Blender 3.5 have incorrect material
indices (fixed in #104667). The importer issue fixed by this patch
combined with the exporter issue would cause such incorrectly exported
FBX files to import as if they had been exported correctly in the first
place. Now that the importer issue is fixed, this is no longer the case
and the importer will now show that those Blender 3.5 exported FBX with
duplicate materials have incorrect material indices.
Fix #104669: Incorrect material assignment of imported FBX with duplicate materialsto Fix #104669: Incorrect material assignment of imported FBX with duplicate materials@ -3340,0 +3342,4 @@
# they are different.
mats_to_append = ()
mats_to_compare = material_connections
else:
The last branch of the if statement technically would cover all cases, but keeping each branch separate I think helps visually explain what each of the expected cases are.
Thanks for the detailed explanations, makes it so easy to review. :)