]> git.tdb.fi Git - libs/gl.git/commitdiff
Sort things by name when exporting
authorMikko Rasa <tdb@tdb.fi>
Wed, 3 Jul 2019 17:26:03 +0000 (20:26 +0300)
committerMikko Rasa <tdb@tdb.fi>
Wed, 3 Jul 2019 17:44:55 +0000 (20:44 +0300)
This keeps them in deterministic order and produces cleaner diffs.

blender/io_mspgl/export_animation.py
blender/io_mspgl/export_scene.py

index 0d72edb4d5eed4894e1df575e8a5b396213ab158..45eff8f9d09e80cdbe8aa0d0a18520f8db0559fd 100644 (file)
@@ -32,7 +32,8 @@ class AnimationExporter:
                        if self.collection:
                                from .datafile import Statement
                                with open(os.path.join(path, base+".mdc"), "w") as out_file:
-                                       for r in resources.values():
+                                       for n in sorted(resources.keys()):
+                                               r = resources[n]
                                                st = Statement("animation", r.name)
                                                st.sub = r.statements
                                                st.write_to_file(out_file)
index 44c892d873d245729ed0c9b28191b6a20300556b..ac812abf7b115766ab0c08af3848614a4ff99ab4 100644 (file)
@@ -19,6 +19,7 @@ class SceneExporter:
                        objs = [o for o in objs if any(a and b for a, b in zip(layers, o.layers))]
                objs = [o for o in objs if o.type=="MESH" and not o.lod_for_parent]
                objs = [o for o in objs if (not o.compound or o.parent not in objs)]
+               objs.sort(key=lambda x:x.name)
 
                path, base = os.path.split(out_fn)
                base, ext = os.path.splitext(base)