[Bf-extensions-cvs] [0962e65] master: Fix T40274: FBX Export: Group instances export a "No Material" material

Bastien Montagne noreply at git.blender.org
Tue May 20 16:01:44 CEST 2014


Commit: 0962e658947844d22a9ad4dc929f7792e56ee284
Author: Bastien Montagne
Date:   Tue May 20 15:57:15 2014 +0200
https://developer.blender.org/rBA0962e658947844d22a9ad4dc929f7792e56ee284

Fix T40274: FBX Export: Group instances export a "No Material" material

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

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 1996508..0ad46f8 100644
--- a/io_scene_fbx/export_fbx_bin.py
+++ b/io_scene_fbx/export_fbx_bin.py
@@ -2094,15 +2094,16 @@ def fbx_data_from_scene(scene, settings):
     for mat, (mat_key, ob_objs) in data_materials.items():
         for ob_obj in ob_objs:
             connections.append((b"OO", get_fbx_uuid_from_key(mat_key), ob_obj.fbx_uuid, None))
-            if ob_obj.is_object:
-                # Get index of this mat for this object.
-                # Mat indices for mesh faces are determined by their order in 'mat to ob' connections.
-                # Only mats for meshes currently...
-                if ob_obj.type not in BLENDER_OBJECT_TYPES_MESHLIKE:
-                    continue
-                _mesh_key, me, _free = data_meshes[ob_obj.bdata]
-                idx = _objs_indices[ob_obj] = _objs_indices.get(ob_obj, -1) + 1
-                mesh_mat_indices.setdefault(me, OrderedDict())[mat] = idx
+            # Get index of this mat for this object (or dupliobject).
+            # Mat indices for mesh faces are determined by their order in 'mat to ob' connections.
+            # Only mats for meshes currently...
+            # Note in case of dupliobjects a same me/mat idx will be generated several times...
+            # Should not be an issue in practice, and it's needed in case we export duplis but not the original!
+            if ob_obj.type not in BLENDER_OBJECT_TYPES_MESHLIKE:
+                continue
+            _mesh_key, me, _free = data_meshes[ob_obj.bdata]
+            idx = _objs_indices[ob_obj] = _objs_indices.get(ob_obj, -1) + 1
+            mesh_mat_indices.setdefault(me, OrderedDict())[mat] = idx
     del _objs_indices
 
     # Textures



More information about the Bf-extensions-cvs mailing list