# HG changeset patch # User John Tsiombikas # Date 1380931665 -10800 # Node ID f43f4849c86aaa5969c5438a8d3a98357fb74b00 # Parent 3d669155709df0c7f26fcf79c5e74a96308e069f started writing blender exporter diff -r 3d669155709d -r f43f4849c86a exporters/goatblender/src/goatblender.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/exporters/goatblender/src/goatblender.py Sat Oct 05 03:07:45 2013 +0300 @@ -0,0 +1,42 @@ +# Goat3D Blender >2.5 exporter +import bpy; +from bpy_extras.io_utils import ExportHelper + +bl_info = { + "name": "Goat3D scene", + "author": "John Tsiombikas", + "version": (0, 1), + "location": "File > Import-Export", + "description": "Mutant Stargoat, Goat3D scene file format: http://code.google.com/p/goat3d/", + "category": "Import-Export" +} + +class ExportGoat3D(bpy.types.Operator, ExportHelper): + bl_idname = "export.goat3d" + bl_label = "Goat3D scene export" + + fname = bpy.props.Stringproperty(subtype="FILE_PATH") + + @classmethod + def poll(cls, ctx): + return ctx.object is not None + + def execute(self, context): + file = open(self.filepath, "w") + file.write("foobar " + ctx.object.name) + return {'FINISHED'} + +def menu_func(self, ctx): + self.layout.operator_context = 'INVOKE_DEFAULT' + self.layout.operator(ExportGoat3D.bl_idname, text="Goat3D scene export") + +def register(): + bpy.utils.register_module(__name__) + bpy.types.INFO_MT_file_export.append(menu_func) + +def unregister(): + bpy.utils.unregister_module(__name__) + bpy.types.INFO_MT_file_export.remove(menu_func) + +if __name__ == "__main__": + register()