[Bf-extensions-cvs] [cce6f72] master: Fix material indices in mesh's faces.
Bastien Montagne
noreply at git.blender.org
Sat Mar 15 13:23:26 CET 2014
Commit: cce6f72de36d3cff922c8fa9a894e4a1233b9f86
Author: Bastien Montagne
Date: Sat Mar 15 13:21:44 2014 +0100
https://developer.blender.org/rBAcce6f72de36d3cff922c8fa9a894e4a1233b9f86
Fix material indices in mesh's faces.
Patch by Jens Restemeier, many thanks! :)
Differential Revision: https://developer.blender.org/D402
===================================================================
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 a8ba3ff..ec6beb5 100644
--- a/io_scene_fbx/export_fbx_bin.py
+++ b/io_scene_fbx/export_fbx_bin.py
@@ -1150,11 +1150,15 @@ def fbx_data_mesh_elements(root, me, scene_data):
blmats_to_fbxmats_idxs = [me_fbxmats_idx[m] for m in me_blmats]
mat_idx_limit = len(blmats_to_fbxmats_idxs)
def_mat = blmats_to_fbxmats_idxs[0]
- _gen = (blmats_to_fbxmats_idxs[m] if m < mat_idx_limit else def_mat for m in range(len(me_blmats)))
+ _gen = (blmats_to_fbxmats_idxs[m] if m < mat_idx_limit else def_mat for m in t_pm)
t_pm = array.array(data_types.ARRAY_INT32, _gen)
elem_data_single_string(lay_mat, b"MappingInformationType", b"ByPolygon")
- elem_data_single_string(lay_mat, b"ReferenceInformationType", b"Direct")
+ # XXX Logically, should be "Direct" reference type, since we do not have any index array, and have one
+ # value per polygon...
+ # But looks like FBX expects it to be IndexToDirect here (maybe because materials are already
+ # indices??? *sigh*).
+ elem_data_single_string(lay_mat, b"ReferenceInformationType", b"IndexToDirect")
elem_data_single_int32_array(lay_mat, b"Materials", t_pm)
del t_pm
else:
More information about the Bf-extensions-cvs
mailing list