What would be best way to add support for more file types with Python?
Currently I am using – argument to pass filename to Blender and Python.
drag_drop_import_files.bat:
"%~dp0\blender.exe" --python "%~dp0\import_file.py" -- '%1'
import_file.py:
import bpy
import sys
argv = sys.argv[sys.argv.index("--") + 1:] # get all args after "--"
file = argv[0].strip("'")
ext = file.split('.')[-1].lower()
if ext == 'blend':
bpy.ops.wm.open_mainfile(filepath = file)
elif ext =='fbx':
bpy.ops.import_scene.fbx(filepath = file)
elif ext =='obj':
bpy.ops.import_scene.obj(filepath = file)