I have a Blender add-on working well to perform an export. I try to upgrade it to Blender 2.80. I fixed some problems (https://github.com/petitg1987/UrchinEngine/commit/a07e6390caa4b231a8c463fc6bb5661cd4f0e6a7#diff-54ba6c537268c77d122862a62df64238) but now I'm stuck on this error:

rna_uiItemO: operator missing srna 'export.urchin'
Traceback (most recent call last):
  File "/usr/share/blender/scripts/modules/bpy_types.py", line 758, in draw_ls
    func(self, context)
  File "/home/greg/.config/blender/2.80/scripts/addons/io_export_urchin.py", line 741, in menuFunc
    self.layout.operator(ExportUrchin.bl_idname, text="Urchin Engine (.urchinMesh .urchinAnim)", icon='BLENDER').filepath = default_path
AttributeError: 'NoneType' object has no attribute 'filepath'

Here is the source code:

class ExportUrchin(bpy.types.Operator):
  """Export Urchin Engine (.urchinMesh .urchinAnim)"""
  bl_idname = "export.urchin"
  bl_label = 'Export Urchin Engine'

  exportModes = [("mesh & anim", "Mesh & Anim", "Export mesh and anim"),
                 ("anim only", "Anim only", "Export anim only"),
                 ("mesh only", "Mesh only", "Export mesh only")]

  filepath: bpy.props.StringProperty(subtype='FILE_PATH', name="File Path", description="File path for exporting", maxlen=1024, default="")
  exportMode: bpy.props.EnumProperty(name="Exports", items=exportModes, description="Choose export mode", default='mesh only')
  meshScale: bpy.props.FloatProperty(name="Scale", description="Scale all objects from world origin (0,0,0)", min=0.001, max=1000.0, default=1.0, precision=6)

  def execute(self, context):
    global scale
    scale = self.meshScale
    settings = urchinSettings(savePath=self.properties.filepath, exportMode=self.properties.exportMode)
    return {'FINISHED'}

  def invoke(self, context, event):
    return {"RUNNING_MODAL"}

def menuFunc(self, context):
  default_path = os.path.splitext(bpy.data.filepath)[0]
  self.layout.operator(ExportUrchin.bl_idname, text="Urchin Engine (.urchinMesh .urchinAnim)", icon='BLENDER').filepath = default_path #Line 741

Full source code: https://github.com/petitg1987/UrchinEngine/blob/master/3dEngine/io_export_urchin.py

Could you please help me to understand the error ?


The registration of the operator was broken. The bpy.utils.register_classes_factory() generates a register() and unregister() function for all supplied classes, but doesn't call them. There was also a , missing in the class tuple.

classes = (

def register():
    for cls in classes:

def unregister():
    for cls in classes:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.