From 475c875fd12e264f093a88c8c4dc52ee13991569 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Wed, 3 Jul 2019 20:26:03 +0300 Subject: [PATCH] Sort things by name when exporting This keeps them in deterministic order and produces cleaner diffs. --- blender/io_mspgl/export_animation.py | 3 ++- blender/io_mspgl/export_scene.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) 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) -- 2.43.0