diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-01-23 15:48:31 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-01-23 15:48:31 +0300 |
commit | ebab2f3277c4cdea24f89ee8805e082dd2c4f6a8 (patch) | |
tree | 80b93d9044173656fa1204ddbd6c57d6c99805af /io_scene_x3d/export_x3d.py | |
parent | d326b12f406121fac12b297be76a04b1ab5353b4 (diff) |
write predictable material order.
Diffstat (limited to 'io_scene_x3d/export_x3d.py')
-rw-r--r-- | io_scene_x3d/export_x3d.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/io_scene_x3d/export_x3d.py b/io_scene_x3d/export_x3d.py index 4157878d..aae369ed 100644 --- a/io_scene_x3d/export_x3d.py +++ b/io_scene_x3d/export_x3d.py @@ -378,7 +378,11 @@ class x3d_class: for i, (material_index, image) in enumerate(zip(mesh_faces_materials, mesh_faces_image)): face_groups[material_index, image].append(i) - for (material_index, image), face_group in face_groups.items(): + # same as face_groups.items() but sorted so we can get predictable output. + face_groups_items = list(face_groups.items()) + face_groups_items.sort(key=lambda m: (m[0][0], getattr(m[0][1], "name", ""))) + + for (material_index, image), face_group in face_groups_items: # face_groups.items() if face_group: material = mesh_materials[material_index] |