From: Mikko Rasa Date: Wed, 3 Jul 2019 17:26:03 +0000 (+0300) Subject: Sort things by name when exporting X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=475c875fd12e264f093a88c8c4dc52ee13991569;p=libs%2Fgl.git Sort things by name when exporting This keeps them in deterministic order and produces cleaner diffs. --- diff --git a/blender/io_mspgl/export_animation.py b/blender/io_mspgl/export_animation.py index 0d72edb4..45eff8f9 100644 --- a/blender/io_mspgl/export_animation.py +++ b/blender/io_mspgl/export_animation.py @@ -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) diff --git a/blender/io_mspgl/export_scene.py b/blender/io_mspgl/export_scene.py index 44c892d8..ac812abf 100644 --- a/blender/io_mspgl/export_scene.py +++ b/blender/io_mspgl/export_scene.py @@ -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)