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)
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()