[Bf-extensions-cvs] [1ead56f] master: FBX import: use new mesh's 'validate_material_index' helper.
Bastien Montagne
noreply at git.blender.org
Thu Jul 17 17:18:00 CEST 2014
Commit: 1ead56feb5c354c9561c09bd55b2184634bc94d5
Author: Bastien Montagne
Date: Thu Jul 17 17:15:28 2014 +0200
https://developer.blender.org/rBA1ead56feb5c354c9561c09bd55b2184634bc94d5
FBX import: use new mesh's 'validate_material_index' helper.
===================================================================
M io_scene_fbx/import_fbx.py
===================================================================
diff --git a/io_scene_fbx/import_fbx.py b/io_scene_fbx/import_fbx.py
index e91954f..1e148b7 100644
--- a/io_scene_fbx/import_fbx.py
+++ b/io_scene_fbx/import_fbx.py
@@ -1713,14 +1713,8 @@ def load(operator, context, filepath="",
# We have to validate mesh polygons' mat_idx, see T41015!
# Some FBX seem to have an extra 'default' material which is not defined in FBX file.
- max_idx = max(0, len(mesh.materials) - 1)
- has_invalid_indexes = False
- for p in mesh.polygons:
- if p.material_index > max_idx:
- has_invalid_indexes = True
- p.material_index = 0
- if has_invalid_indexes:
- print("WARNING: mesh '%s' had invalid material indices, those were rest to first material" % mesh.name)
+ if mesh.validate_material_indices():
+ print("WARNING: mesh '%s' had invalid material indices, those were reset to first material" % mesh.name)
_(); del _
def _():
More information about the Bf-extensions-cvs
mailing list