From: Mikko Rasa Date: Fri, 16 Apr 2021 20:52:23 +0000 (+0300) Subject: Don't rename scene objects while exporting X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=e9ee48357064fbe1e24471e215b5633dfc5df0b1;p=libs%2Fgl.git Don't rename scene objects while exporting It's somewhat risky to come up with entirely new names. Sorting the objects by name already ensures that if one of the names is a prefix for others, it gets used as the prototype name. --- diff --git a/blender/io_mspgl/export_scene.py b/blender/io_mspgl/export_scene.py index e272823e..aa3c0c19 100644 --- a/blender/io_mspgl/export_scene.py +++ b/blender/io_mspgl/export_scene.py @@ -16,33 +16,6 @@ class SceneExporter: path, base = os.path.split(out_fn) base, ext = os.path.splitext(base) - export_names = {} - used_names = set() - for p in scene.prototypes: - clones = [i for i in scene.instances if i.prototype==p.name] - - prefix = p.name - for c in clones: - while not c.name.startswith(prefix): - pos = max(prefix.rfind(' '), prefix.rfind('.')) - if pos<0: - break; - prefix = prefix[:pos] - - if prefix: - export_names[p.name+".object"] = prefix.strip(" .") - else: - used_names.add(p.name) - - for n, e in export_names.items(): - if e in used_names: - number = 1 - while "{}_{}".format(e, number) in used_names: - number += 1 - e += "_{}".format(number) - export_names[n] = e+".object" - used_names.add(e) - from .util import Progress progress = Progress(self.show_progress and context) @@ -51,10 +24,6 @@ class SceneExporter: resources = {} data_exporter.export_resources(context, scene.prototypes, resources, None, progress) - for n, r in resources.items(): - if r.name in export_names: - r.name = export_names[r.name] - scene_res = self.export_scene(scene, resources, progress) refs = scene_res.collect_references()