Import/Export Script

hey guys,

i’ve got some import and export scripts that i use all the time and now with 2.8 i’d like to adjust them to the new api.
the thing is that i have no clue what i am doing :wink:
could anyone help with this 1 script so that i can adjust my other scripts accordingly?

cheers chris

bl_info = {
    "name": "objIMPORT",
    "category": "Import-Export",
}
 
import bpy
 
class objIMPORT(bpy.types.Operator):
    """objIMPORT"""                         # blender will use this as a tooltip for menu items and buttons.
    bl_idname = "import_scene.obj_import"   # unique identifier for buttons and menu items to reference.
    bl_label = "objIMPORT"                  # display name in the interface.
 
 
    def execute(self, context):             # execute() is called by blender when running the operator.
 
        # The original script
        bpy.ops.import_scene.obj(filepath=r"C:\Users\Christian\objEXCHANGE.obj", use_split_objects=False,use_split_groups=False, use_image_search=False)
 
        return {'FINISHED'}                 # this lets blender know the operator finished successfully.
 
def register():
    bpy.utils.register_module(__name__)

def unregister():
    bpy.utils.unregister_module(__name__)
    
# This allows you to run the script directly from blenders text editor
# to test the addon without having to install it.
if __name__ == "__main__":
    register()

I have started some migration work on some addons that I want to be able to work on 2.79 and 2.80. Have a look at this code starting about line 749 where it shows the different syntax for 2.79 and 2.80.

https://github.com/douglaskastle/blender-import-lwo/blob/master/io_import_scene_lwo/init.py

It is not considered finished code so there are also some WiP code in there, ignore that!

What is the issue you have?

thanks guys.

it seems to be an error in this line of my script.

i took a look at maveks code and replaced the above line with his:

def register():
    if (2, 80, 0) < bpy.app.version:
        for cls in classes:
            bpy.utils.register_class(cls)

but i still get a python script failed message

Did you add a line like:

classes = (objIMPORT)

before your def register():?

https://wiki.blender.org/wiki/Reference/Release_Notes/2.80/Python_API/Addons

no … but then again i have no clue what i am doing :wink:

have to try some more tomorrow

thanks so far, mavek!

OK sounds like there is a lot of work there. Maybe you might want to check out this thread then:

You need to extend your bl_info