object_prototypes = {}
unique_objects = []
+ export_names = {}
for o in objs:
if o.name in object_prototypes:
continue
clones.append(u)
+ prefix = o.name
+ for c in clones:
+ for i in range(min(len(c.name), len(prefix))):
+ if c.name[i]!=prefix[i]:
+ prefix = prefix[:i]
+ break
+
+ if prefix:
+ export_names[o.name+".object"] = prefix.strip(" .")+".object"
+
unique_objects.append(o)
for c in clones:
object_prototypes[c.name] = o
resources = {}
self.export_scene_resources(context, unique_objects, resources, progress)
+ for n, r in resources.items():
+ if r.name in export_names:
+ r.name = export_names[r.name]
scene_res = self.export_scene(context, objs, progress, prototypes=object_prototypes, resources=resources)
refs = scene_res.collect_references()
object_export = ObjectExporter()
object_export.single_file = False
+ material_maps = {}
+
for i, o in enumerate(objs):
progress.push_task_slice(o.name, i, len(objs))
- object_export.export_object_resources(context, o, resources, progress)
+ object_export.export_object_resources(context, o, resources, progress, material_maps=material_maps)
obj_name = o.name+".object"
resources[obj_name] = object_export.export_object(context, o, progress, resources=resources)
progress.pop_task()
for o in objs:
obj_res = resources[prototypes[o.name].name+".object"]
- st = scene_res.create_reference_statement("object", obj_res)
+ st = scene_res.create_reference_statement("object", obj_res, o.name)
# XXX Parent relationships screw up the location and rotation
st.sub.append(Statement("position", o.location[0], o.location[1], o.location[2]))
if o.rotation_mode=="AXIS_ANGLE":