Skip to content

Instantly share code, notes, and snippets.

@dbechrd
Last active May 15, 2020 17:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dbechrd/c652e441661adee8b6ef65c1bee74cf9 to your computer and use it in GitHub Desktop.
Save dbechrd/c652e441661adee8b6ef65c1bee74cf9 to your computer and use it in GitHub Desktop.
My-Craft Blender 2.80 Exporter
bl_info = {
"name": "My-Craft Export (.mce)",
"description": "NexusNul is cool",
"author": "NexusNul",
"version": (2, 0, 0, 0),
'blender': (2, 80, 0),
"location": "File > Import-Export",
"wiki_url": "",
"category": "Import-Export"}
import bpy
from bpy_extras.io_utils import ExportHelper
class MCEExporter(bpy.types.Operator, ExportHelper):
bl_idname = "export_scene.mce"
bl_label = "Export MCE"
filename_ext = ".mce"
option_export_selection: bpy.props.BoolProperty(name = "Export Selection Only", description = "Export only selected objects", default = False)
def Write(self, text):
self.file.write(text)
def execute(self, context):
print("\n#--------------------------------------------------")
print("# My-Craft Exporter v0.0.1")
print("#--------------------------------------------------")
self.file = open(self.filepath, "w")
self.Write("[")
# TODO: Write data
self.Write("]")
self.file.close()
print("Finished")
return {'FINISHED'}
def menu_func(self, context):
self.layout.operator(MCEExporter.bl_idname, text = "My-Craft (.mce)")
def register():
bpy.utils.register_class(MCEExporter)
bpy.types.TOPBAR_MT_file_export.append(menu_func)
def unregister():
bpy.types.TOPBAR_MT_file_export.remove(menu_func)
bpy.utils.unregister_class(MCEExporter)
if __name__ == "__main__":
register()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment