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
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.