Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-01-23 15:48:31 +0300
committerCampbell Barton <ideasman42@gmail.com>2011-01-23 15:48:31 +0300
commitebab2f3277c4cdea24f89ee8805e082dd2c4f6a8 (patch)
tree80b93d9044173656fa1204ddbd6c57d6c99805af /io_scene_x3d
parentd326b12f406121fac12b297be76a04b1ab5353b4 (diff)
write predictable material order.
Diffstat (limited to 'io_scene_x3d')
-rw-r--r--io_scene_x3d/export_x3d.py6
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]