Skip to content

Instantly share code, notes, and snippets.

@zeffii
Forked from anonymous/verwaarloo.py
Created June 1, 2015 16:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zeffii/5b1fdd5b0f674e836c20 to your computer and use it in GitHub Desktop.
Save zeffii/5b1fdd5b0f674e836c20 to your computer and use it in GitHub Desktop.
#Script to import multiple .obj files into blender
import os
import bpy
# put the location to the folder where the objs are located here in this fashion
path_to_obj_dir = '/home/user/Desktop/brainstem/'
def path_iterator(path_name):
for fp in os.listdir(path_name):
if fp.endswith(".obj"):
yield os.path.join(path_name, fp)
# loop through obj files in path_name and add them to the scene
for obj_path in path_iterator(path_name):
bpy.ops.import_scene.obj(filepath=obj_path)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment