- with open(out_fn, "w") as out_file:
- for s in resource.statements:
- s.write_to_file(out_file)
+ if self.collection:
+ from .datafile import Resource
+ dummy = Resource("dummy", "dummy")
+ dummy.references = list(sorted(resources.values(), key=lambda r: r.name))
+ dummy.write_collection(os.path.join(path, base+".mdc"), exclude_self=True)
+ else:
+ for r in resources.values():
+ r.write_to_file(os.path.join(path, r.name))
+ else:
+ anim_data = context.active_object.animation_data
+ if not anim_data:
+ raise Exception("Object {} has no animation data".format(context.active_object.name))
+ if not anim_data.action:
+ raise Exception("Object {} has no active action".format(context.active_object.name))
+
+ resource = self.export_animation(context, anim_data.action)
+
+ resource.write_to_file(out_fn)