goat3d
annotate exporters/goatblender/src/goatblender.py @ 33:f43f4849c86a
started writing blender exporter
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 05 Oct 2013 03:07:45 +0300 |
parents | |
children |
rev | line source |
---|---|
nuclear@33 | 1 # Goat3D Blender >2.5 exporter |
nuclear@33 | 2 import bpy; |
nuclear@33 | 3 from bpy_extras.io_utils import ExportHelper |
nuclear@33 | 4 |
nuclear@33 | 5 bl_info = { |
nuclear@33 | 6 "name": "Goat3D scene", |
nuclear@33 | 7 "author": "John Tsiombikas", |
nuclear@33 | 8 "version": (0, 1), |
nuclear@33 | 9 "location": "File > Import-Export", |
nuclear@33 | 10 "description": "Mutant Stargoat, Goat3D scene file format: http://code.google.com/p/goat3d/", |
nuclear@33 | 11 "category": "Import-Export" |
nuclear@33 | 12 } |
nuclear@33 | 13 |
nuclear@33 | 14 class ExportGoat3D(bpy.types.Operator, ExportHelper): |
nuclear@33 | 15 bl_idname = "export.goat3d" |
nuclear@33 | 16 bl_label = "Goat3D scene export" |
nuclear@33 | 17 |
nuclear@33 | 18 fname = bpy.props.Stringproperty(subtype="FILE_PATH") |
nuclear@33 | 19 |
nuclear@33 | 20 @classmethod |
nuclear@33 | 21 def poll(cls, ctx): |
nuclear@33 | 22 return ctx.object is not None |
nuclear@33 | 23 |
nuclear@33 | 24 def execute(self, context): |
nuclear@33 | 25 file = open(self.filepath, "w") |
nuclear@33 | 26 file.write("foobar " + ctx.object.name) |
nuclear@33 | 27 return {'FINISHED'} |
nuclear@33 | 28 |
nuclear@33 | 29 def menu_func(self, ctx): |
nuclear@33 | 30 self.layout.operator_context = 'INVOKE_DEFAULT' |
nuclear@33 | 31 self.layout.operator(ExportGoat3D.bl_idname, text="Goat3D scene export") |
nuclear@33 | 32 |
nuclear@33 | 33 def register(): |
nuclear@33 | 34 bpy.utils.register_module(__name__) |
nuclear@33 | 35 bpy.types.INFO_MT_file_export.append(menu_func) |
nuclear@33 | 36 |
nuclear@33 | 37 def unregister(): |
nuclear@33 | 38 bpy.utils.unregister_module(__name__) |
nuclear@33 | 39 bpy.types.INFO_MT_file_export.remove(menu_func) |
nuclear@33 | 40 |
nuclear@33 | 41 if __name__ == "__main__": |
nuclear@33 | 42 register() |