1 class ArmatureExporter:
2 def export_to_file(self, context, out_fn):
3 obj = context.active_object
5 statements = self.export_armature(context, obj)
7 with open(out_fn, "w") as out_file:
9 s.write_to_file(out_file)
11 def export_armature(self, obj):
12 if obj.type!="ARMATURE":
13 raise Exception("Object is not an armature")
15 from .armature import Armature
16 armature = Armature(obj.data)
19 from .datafile import Statement
22 for l in armature.links:
23 st = Statement("link", l.name)
24 st.sub.append(Statement("index", l.index))
26 st.sub.append(Statement("parent", l.parent.name))
27 st.sub.append(Statement("base", *tuple(l.base)))