[Bf-extensions-cvs] [2170037] master: Fix T49873: FBX exporter not handling correctly Object-assigned materials.

Bastien Montagne noreply at git.blender.org
Mon Oct 31 12:24:40 CET 2016


Commit: 21700373aead71afb6108a190a2b94302e94b8d3
Author: Bastien Montagne
Date:   Mon Oct 31 12:22:40 2016 +0100
Branches: master
https://developer.blender.org/rBA21700373aead71afb6108a190a2b94302e94b8d3

Fix T49873: FBX exporter not handling correctly Object-assigned materials.

Note that FBX still links materials to geometry, so we have to export
own version of mesh in that case (i.e. Object-materials break instancing
if any).

===================================================================

M	io_scene_fbx/export_fbx_bin.py

===================================================================

diff --git a/io_scene_fbx/export_fbx_bin.py b/io_scene_fbx/export_fbx_bin.py
index 250b951..49e8e16 100644
--- a/io_scene_fbx/export_fbx_bin.py
+++ b/io_scene_fbx/export_fbx_bin.py
@@ -2172,12 +2172,14 @@ def fbx_data_from_scene(scene, settings):
                 data_meshes[ob_obj] = data_meshes[org_ob_obj]
                 continue
 
-        if settings.use_mesh_modifiers or ob.type in BLENDER_OTHER_OBJECT_TYPES:
-            use_org_data = False
+        is_ob_material = any(ms.link == 'OBJECT' for ms in ob.material_slots)
+
+        if settings.use_mesh_modifiers or ob.type in BLENDER_OTHER_OBJECT_TYPES or is_ob_material:
+            # We cannot use default mesh in that case, or material would not be the right ones...
+            use_org_data = not is_ob_material
             tmp_mods = []
-            if ob.type == 'MESH':
+            if use_org_data and ob.type == 'MESH':
                 # No need to create a new mesh in this case, if no modifier is active!
-                use_org_data = True
                 for mod in ob.modifiers:
                     # For meshes, when armature export is enabled, disable Armature modifiers here!
                     if mod.type == 'ARMATURE' and 'ARMATURE' in settings.object_types:



More information about the Bf-extensions-cvs mailing list