]> git.tdb.fi Git - libs/gl.git/blob - blender/io_mspgl/export_armature.py
Throw an exception if trying to draw a Mesh with a different Mesh bound
[libs/gl.git] / blender / io_mspgl / export_armature.py
1 from .outfile import OutFile
2
3 class ArmatureExporter:
4         def export(self, context, fn):
5                 obj = context.active_object
6                 if obj.type!="ARMATURE":
7                         raise Exception("Can only export Armature data")
8
9                 from .armature import Armature
10
11                 armature = Armature(obj.data)
12                 armature.sort_links()
13
14                 out_file = OutFile(fn)
15                 for l in armature.links:
16                         out_file.begin("link", '"{}"'.format(l.name))
17                         out_file.write("index", l.index)
18                         if l.parent:
19                                 out_file.write("parent", '"{}"'.format(l.parent.name))
20                         out_file.write("base", *tuple(l.base))
21                         out_file.end()