- 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 Statement
+ with open(os.path.join(path, base+".mdc"), "w") as out_file:
+ for n in sorted(resources.keys()):
+ r = resources[n]
+ st = Statement("animation", r.name)
+ st.sub = r.statements
+ st.write_to_file(out_file)
+ else:
+ for r in resources.values():
+ with open(os.path.join(path, r.name), w) as out_file:
+ for s in r.statements:
+ s.write_to_file(out_file)
+ else:
+ anim_data = context.active_object.animation_data
+ if not anim_data:
+ raise Exception("Object has no animation data")
+ if not anim_data.action:
+ raise Exception("No active action")
+
+ resource = self.export_animation(context, anim_data.action)
+
+ with open(out_fn, "w") as out_file:
+ for s in resource.statements:
+ s.write_to_file(out_file)