Import multiple object files

Hello, I’m looking for way of import multiple object files.(.obj,fbx,other…)
So I found the script Import Multiple FBX files - #9 by renderhjs
I create .py format and paste it. But it could not install for blender… Anybody could any tips for me?
Thank you.

Clever script, though unnecessarily complex on how it was written. :slight_smile: It would be now much more easy to understand and modify.

import bpy
import os

def import_models_from_directory(path):
    path = bpy.path.abspath(path)
    extensions = {
        'fbx' : bpy.ops.import_scene.fbx,
        'obj' : bpy.ops.import_scene.obj,
        '3ds' : bpy.ops.import_scene.autodesk_3ds
    }
    filenames = os.listdir(path)
    for f in filenames:
        ex = os.path.splitext(f)[-1].strip('.')
        if ex in extensions:
            extensions[ex](filepath=os.path.join(path, f))
    
directory = r'C:\Users\cos\Documents\Clay Viewer\tmp'
import_models_from_directory(directory)

1 Like

Thank you again and thank you for great detail! It works well :slight_smile: I learned a lot!

1 Like