Skip to content

Instantly share code, notes, and snippets.

@nebadon2025
Last active February 14, 2022 13:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save nebadon2025/8525f19c88c51a22a285ab283b0339fc to your computer and use it in GitHub Desktop.
Save nebadon2025/8525f19c88c51a22a285ab283b0339fc to your computer and use it in GitHub Desktop.
Batch FBX Importer for Blender Python
import os
import bpy
# put the location to the folder where the FBXs are located here in this fashion
# this line will only work on windows ie C:\objects
path_to_obj_dir = os.path.join('C:\\', 'objects')
# get list of all files in directory
file_list = sorted(os.listdir(path_to_obj_dir))
# get a list of files ending in 'fbx'
obj_list = [item for item in file_list if item.endswith('.fbx')]
# 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.fbx(filepath = path_to_file)
# if heavy importing is expected
# you may want use saving to main file after every import
bpy.ops.wm.save_mainfile(filepath = "C:\\To\\Your\\File.blend")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment