|
| 1 | +import bpy |
| 2 | +from bpy_types import (Operator) |
| 3 | +from bpy_extras.io_utils import (ImportHelper) |
| 4 | +from bpy.props import (StringProperty, BoolProperty, EnumProperty) |
| 5 | + |
| 6 | +bl_info = { |
| 7 | + "name": "Clausewitz Import/Export", |
| 8 | + "category": "Import-Export", |
| 9 | + "author": "Bernhard Sirlinger", |
| 10 | + "version": (0, 2), |
| 11 | + "blender": (2, 78, 0), |
| 12 | + "support": "TESTING", |
| 13 | + "wiki_url": "https://github.com/WebsiteDeveloper/ClausewitzBlenderPlugin/wiki", |
| 14 | + "tracker_url": "https://github.com/WebsiteDeveloper/ClausewitzBlenderPlugin/issues" |
| 15 | +} |
| 16 | + |
| 17 | +class ClausewitzExporter(Operator): |
| 18 | + """Clausewitz Exporter""" |
| 19 | + bl_idname = "clausewitz.exporter" |
| 20 | + bl_label = "Export .mesh (Clausewitz Engine)" |
| 21 | + |
| 22 | + def execute(self, context): |
| 23 | + return {'FINISHED'} |
| 24 | + |
| 25 | +class ClausewitzImporter(Operator, ImportHelper): |
| 26 | + """Clausewitz Importer""" |
| 27 | + bl_idname = "clausewitz.importer" |
| 28 | + bl_label = "Import .mesh (Clausewitz Engine)" |
| 29 | + |
| 30 | + filename_ext = ".mesh" |
| 31 | + |
| 32 | + filter_glob = StringProperty( |
| 33 | + default="*.mesh", |
| 34 | + options={'HIDDEN'}, |
| 35 | + maxlen=255, # Max internal buffer length, longer would be clamped. |
| 36 | + ) |
| 37 | + |
| 38 | + def execute(self, context): |
| 39 | + #pdx = PdxFile(self.filepath) |
| 40 | + #pdx.ReadFile() |
| 41 | + #pdx.AddBlenderMesh() |
| 42 | + |
| 43 | + return {'FINISHED'} |
| 44 | + |
| 45 | +def menu_func_export(self, context): |
| 46 | + self.layout.operator(ClausewitzExporter.bl_idname, text="Export .mesh (Clausewitz Engine)") |
| 47 | + |
| 48 | +def menu_func_import(self, context): |
| 49 | + self.layout.operator(ClausewitzImporter.bl_idname, text="Import .mesh (Clausewitz Engine)") |
| 50 | + |
| 51 | +def register(): |
| 52 | + bpy.utils.register_module(__name__) |
| 53 | + #bpy.utils.register_class(ClausewitzExporter) |
| 54 | + #bpy.utils.register_class(ClausewitzImporter) |
| 55 | + bpy.types.INFO_MT_file_export.append(menu_func_export) |
| 56 | + bpy.types.INFO_MT_file_import.append(menu_func_import) |
| 57 | + |
| 58 | + |
| 59 | +def unregister(): |
| 60 | + bpy.utils.unregister_module(__name__) |
| 61 | + #bpy.utils.unregister_class(ClausewitzExporter) |
| 62 | + #bpy.utils.unregister_class(ClausewitzImporter) |
| 63 | + bpy.types.INFO_MT_file_export.remove(menu_func_export) |
| 64 | + bpy.types.INFO_MT_file_import.remove(menu_func_import) |
0 commit comments