Last active
December 19, 2020 05:18
-
-
Save koshishirai/a55f8f22243a47237f99c620beff8bd3 to your computer and use it in GitHub Desktop.
obj2blender.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import bpy | |
#ex. path_to_obj_dir = os.path.join("C:\\Users\\Your Name\\Dropbox\\3d") #Windows | |
obj_path = bpy.path.abspath('絶対PATH') #Mac | |
# ディレクトリ内のすべてのファイルのリストを取得します | |
file_list = sorted(os.listdir(obj_path)) | |
#「obj」で終わるファイルのリストを取得します | |
obj_list = [item for item in file_list if item[-3:] == 'obj'] # obj, fbx, vrm, etc... | |
# obj_listの文字列をループし、ファイルをシーンに追加します | |
for item in obj_list: | |
path_to_file = os.path.join(obj_path, item) | |
bpy.ops.import_scene.obj(filepath = path_to_file) ## obj, fbx, vrm, etc... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment