goat3d
diff exporters/blendgoat/src/__init__.py @ 38:60f2037680ee
split the exporter into two files to make it more readable (and maybe make an importer too at some point?)
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 07 Oct 2013 20:02:57 +0300 |
parents | |
children | 0e48907847ad |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/exporters/blendgoat/src/__init__.py Mon Oct 07 20:02:57 2013 +0300 1.3 @@ -0,0 +1,44 @@ 1.4 +bl_info = { 1.5 + "name": "Goat3D scene", 1.6 + "author": "John Tsiombikas", 1.7 + "version": (0, 1), 1.8 + "location": "File > Import-Export", 1.9 + "description": "Mutant Stargoat, Goat3D scene file format: http://code.google.com/p/goat3d/", 1.10 + "category": "Import-Export" 1.11 +} 1.12 + 1.13 +if "bpy" in locals(): 1.14 + import imp 1.15 + if "export_goat" in locals(): 1.16 + imp.reload(export_goat) 1.17 + 1.18 +import bpy 1.19 +from bpy_extras.io_utils import ExportHelper 1.20 + 1.21 +class ExportGoat3D(bpy.types.Operator, ExportHelper): 1.22 + bl_idname = "export_scene.goat3d" 1.23 + bl_label = "Export Goat3D Scene" 1.24 + bl_options = {'PRESET'} 1.25 + filename_ext = ".goatsce" 1.26 + filter_glob = bpy.props.StringProperty(default="*.goatsce", options={'HIDDEN'}) 1.27 + 1.28 + def execute(self, ctx): 1.29 + from . import export_goat 1.30 + if not export_goat.export(self, ctx, self.filepath): 1.31 + return {'CANCELLED'} 1.32 + return {'FINISHED'} 1.33 + 1.34 +def menu_func(self, ctx): 1.35 + self.layout.operator_context = 'INVOKE_DEFAULT' 1.36 + self.layout.operator(ExportGoat3D.bl_idname, text="Goat3D scene export (.goatsce)") 1.37 + 1.38 +def register(): 1.39 + bpy.utils.register_module(__name__) 1.40 + bpy.types.INFO_MT_file_export.append(menu_func) 1.41 + 1.42 +def unregister(): 1.43 + bpy.utils.unregister_module(__name__) 1.44 + bpy.types.INFO_MT_file_export.remove(menu_func) 1.45 + 1.46 +if __name__ == "__main__": 1.47 + register()