Advertisement
Guest User

Untitled

a guest
Jan 16th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.54 KB | None | 0 0
  1. import os
  2. import bpy
  3.  
  4. # Batch Import all OBJ Files
  5. path_to_obj_dir = os.path.join('D:\Games\steamapps\common\Life Is Strange\Binaries\Win32\models')
  6.  
  7. # get list of all files in directory
  8. file_list = sorted(os.listdir(path_to_obj_dir))
  9.  
  10. # get a list of files ending in 'obj'
  11. obj_list = [item for item in file_list if item.endswith('.obj')]
  12.  
  13. # loop through the strings in obj_list and add the files to the scene
  14. for item in obj_list:
  15.     path_to_file = os.path.join(path_to_obj_dir, item)
  16.     bpy.ops.import_scene.obj(filepath = path_to_file)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement