+ resources = {}
+ for a in actions:
+ resources[a.name+".anim"] = self.export_animation(context, a, looping_threshold=looping_threshold)
+
+ path, base = os.path.split(out_fn)
+ base, ext = os.path.splitext(base)
+
+ if 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)
+
+ def export_animation(self, context, action, *, looping_threshold=0.001):