From 888e3c02872d5d33b93356ddf98808e71c85ca83 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 2 Aug 2011 10:25:12 +0000 Subject: fix [#28146] OBJ fails when mehs has no material --- io_scene_obj/export_obj.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'io_scene_obj') diff --git a/io_scene_obj/export_obj.py b/io_scene_obj/export_obj.py index 3c721643..b043ec6d 100644 --- a/io_scene_obj/export_obj.py +++ b/io_scene_obj/export_obj.py @@ -383,6 +383,11 @@ def write_file(filepath, objects, scene, materials = me.materials[:] material_names = [m.name if m else None for m in materials] + # avoid bad index errors + if not materials: + materials = [None] + material_names = [""] + # Sort by Material, then images # so we dont over context switch in the obj file. if EXPORT_KEEP_VERT_ORDER: -- cgit v1.2.3