0
$\begingroup$

I have this custom exporter, that is now showing up in the Export menu. The addon gets added without any problems, I can tick and untick it and no errors are shown on the console.

I'm trying to make it work on Blender 3.3. What am I missing?

#!BPY
"""
Name: 'Golden Age Level Exporter'
Group: 'Export'
Tooltip: 'Golden Age Level Exporter'
"""

bl_info = {
    "name": "GAL Exporter",
    "author": "WAG",
    "version": (1,0,0),
    "blender": (2, 80, 0),
    "location": "File > Export",
    "description":  "Export to Golden Age Level format",
    "category":"Import-Export",
}

import bpy
import os
import struct
import ctypes

from ctypes import*

from mathutils import Matrix, Vector, Euler


from bpy.props import (CollectionProperty,
                       StringProperty,
                       BoolProperty,
                       EnumProperty,
                       FloatProperty,
                       )

from bpy_extras.io_utils import (ImportHelper,
                                 ExportHelper,
                                 axis_conversion,
                                 )

class GAL_Exporter(bpy.types.Operator, ExportHelper):
    bl_idname = "export_mesh.gal"
    bl_label = "GAL Export"
    bl_options = {'REGISTER', 'UNDO'}

    filename_ext    = ".gal";
    filter_glob     = StringProperty(default="*.gal", options={'HIDDEN'})
    
    # Export options
    apply_modifiers = BoolProperty(
        name="Apply Modifiers",
        description="Apply Modifiers to the exported mesh",
        default=True,
        )
        
    global_scale = FloatProperty(
        name="Scale",
        min=0.01, max=1000.0,
        default=1.0,
        )
        
    def execute(self, context): 
        filepath = self.filepath
        filepath = bpy.path.ensure_ext(filepath, self.filename_ext)
        
   
        print ("Exported Succesfully")
        
        return {'FINISHED'}

def menu_func(self, context):
    self.layout.operator(GAL_Exporter.bl_idname, text="Golden Age Level (.gal)");

def register():
    bpy.utils.register_class(GAL_Exporter);
    bpy.types.TOPBAR_MT_file_import.append(menu_func);


def unregister():
    bpy.utils.unregister_class(GAL_Exporter);
    bpy.types.TOPBAR_MT_file_import.remove(menu_func);


if __name__ == "__main__":
    register()
$\endgroup$
2
  • 1
    $\begingroup$ it should be TOPBAR_MT_file_export $\endgroup$
    – Karan
    Commented Jun 17, 2023 at 19:58
  • $\begingroup$ Doh! Silly mistake, thanks! $\endgroup$
    – Walrfi
    Commented Jun 17, 2023 at 20:07

1 Answer 1

3
$\begingroup$

It should be TOPBAR_MT_file_export

bl_info = {
    "name": "GAL Exporter",
    "description":  "Export to Golden Age Level format",
    "author": "WAG",
    "version": (1, 0, 0),
    "blender": (2, 80, 0),
    "location": "File > Export",
    "warning": "", # used for warning icon and text in addons panel
    "doc_url": "",
    "tracker_url": "",
    "support": "COMMUNITY",
    "category":"Import-Export",
}


import bpy
from mathutils import Matrix, Vector, Euler
from bpy.props import *
from bpy_extras.io_utils import *


class GAL_Exporter(bpy.types.Operator, ExportHelper):
    bl_idname = "export_mesh.gal"
    bl_label = "GAL Export"
    bl_options = {'REGISTER', 'UNDO'}

    filename_ext    = ".gal";
    filter_glob     = StringProperty(default="*.gal", options={'HIDDEN'})
    
    # Export options
    apply_modifiers = BoolProperty(
        name="Apply Modifiers",
        description="Apply Modifiers to the exported mesh",
        default=True,
        )
        
    global_scale = FloatProperty(
        name="Scale",
        min=0.01, max=1000.0,
        default=1.0,
        )
        
    def execute(self, context): 
        filepath = self.filepath
        filepath = bpy.path.ensure_ext(filepath, self.filename_ext)
        
   
        print ("Exported Succesfully")
        
        return {'FINISHED'}


def menu_func(self, context):
    self.layout.operator(GAL_Exporter.bl_idname, text="Golden Age Level (.gal)");


def register():
    bpy.utils.register_class(GAL_Exporter);
    bpy.types.TOPBAR_MT_file_export.append(menu_func);


def unregister():
    bpy.utils.unregister_class(GAL_Exporter);
    bpy.types.TOPBAR_MT_file_export.remove(menu_func);
    
    
if __name__ == "__main__":
    register()
$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .