- progress = Progress(context)
- if self.resource_collection:
- res_out = open_output(os.path.join(path, base+"_resources.mdc"))
-
- # TODO Export techniques as separate items in the collection
- for i, o in enumerate(objs):
- res_out.begin("object", '"{}.object"'.format(o.name))
- progress.push_task(o.name, i/len(objs), (i+1)/len(objs))
- object_export.export(context, res_out, [o], progress)
- progress.pop_task()
- res_out.end()
+ progress = Progress(self.show_progress and context)
+
+ from .export import DataExporter
+ data_exporter = DataExporter()
+
+ resources = {}
+ data_exporter.export_resources(context, unique_objects, 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(context, objs, resources, object_prototypes, progress)
+ refs = scene_res.collect_references()
+
+ if self.collection:
+ existing = None
+ if self.skip_existing:
+ existing = lambda r: not os.path.exists(os.path.join(path, r.name))
+ scene_res.write_collection(out_fn, filter=existing)