Mixamo2 / try_import_blender.py
jasongzy's picture
✨ feat: update readme & scripts
d356cac
raw
history blame
1.16 kB
import os
import sys
from glob import glob
import bpy
from tqdm import tqdm
class HiddenPrints:
def __init__(self, disable=False):
self.disable = disable
def __enter__(self):
if self.disable:
return
self._original_stdout = sys.stdout
sys.stdout = open(os.devnull, "w")
def __exit__(self, exc_type, exc_val, exc_tb):
if self.disable:
return
sys.stdout.close()
sys.stdout = self._original_stdout
if __name__ == "__main__":
input_dir = "."
character_list = sorted(glob(os.path.join(input_dir, "character", "*.fbx")))
# animation_list = sorted(glob(os.path.join(input_dir, "animation", "*.fbx")))
for filepath in tqdm(character_list, dynamic_ncols=True):
try:
with HiddenPrints():
bpy.ops.import_scene.fbx(filepath=filepath)
except Exception as e:
tqdm.write(filepath)
with open("character_old_fbx.txt", "a") as f:
f.write(f"{filepath}\n")
# https://aps.autodesk.com/developer/overview/fbx-converter-archives
# Manually convert and replace FBX in the txt