Last active
February 25, 2023 13:00
-
-
Save Gus-The-Forklift-Driver/6bb0bb259f9fdc060b3be9f9fb342319 to your computer and use it in GitHub Desktop.
craw within folder to load all files matching the regex
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 re | |
import bpy | |
root = './' | |
def use_regex(input_text): | |
pattern = re.compile(r".+_LOD5\.fbx", re.IGNORECASE) | |
return bool(pattern.match(input_text)) | |
print('==========STARTING=========') | |
for root, dirs, files in os.walk(root): | |
for file in files: | |
print(f'file : {root}/{file}') | |
if use_regex(file) == True: | |
bpy.ops.import_scene.fbx(filepath=root+'/'+file) | |
print(f'importing.') | |
print('==========DONE==========') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment