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).
This commit is contained in:
Bastien Montagne 2016-10-31 12:22:40 +01:00
parent afde50f681
commit 21700373ae
Notes: blender-bot 2023-02-14 19:44:15 +01:00
Referenced by issue #49873, Traceback error on exporting to .fbx
1 changed files with 6 additions and 4 deletions

View File

@ -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: