Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- import bpy
- # Batch Import all OBJ Files
- path_to_obj_dir = os.path.join('D:\Games\steamapps\common\Life Is Strange\Binaries\Win32\models')
- # get list of all files in directory
- file_list = sorted(os.listdir(path_to_obj_dir))
- # get a list of files ending in 'obj'
- obj_list = [item for item in file_list if item.endswith('.obj')]
- # loop through the strings in obj_list and add the files to the scene
- for item in obj_list:
- path_to_file = os.path.join(path_to_obj_dir, item)
- bpy.ops.import_scene.obj(filepath = path_to_file)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement