I have this script here:
import bpy import numpy as np from os import listdir, path def fbx2bvh(data_path, file): sourcepath = data_path+"/"+file bvh_path = data_path+"/"+file.split(".fbx")+".bvh" bpy.ops.import_scene.fbx(filepath=sourcepath) frame_start = 9999 frame_end = -9999 action = bpy.data.actions[-1] if action.frame_range > frame_end: frame_end = action.frame_range if action.frame_range < frame_start: frame_start = action.frame_range frame_end = np.max([60, frame_end]) bpy.ops.export_anim.bvh(filepath=bvh_path, frame_start=frame_start, frame_end=frame_end, root_transform_only=True) bpy.data.actions.remove(bpy.data.actions[-1]) print(data_path+"/"+file+" processed.") if __name__ == '__main__': data_path = "C:\\fbx\\" directories = sorted([f for f in listdir(data_path) if not f.startswith(".")]) for d in directories: files = sorted([f for f in listdir(data_path+d) if f.endswith(".fbx")]) for file in files: fbx2bvh(path.join(data_path,d), file)
and it’s asking for a directory for the data_path variable…I have a folder with a FBX file at the root of my C drive in my C folder named “fbx”… so the actual path is “C:\fbx” in there is a file called Rhumba_Dancing.fbx.
it is a mixamo file I’m trying to make this script so it’ll batch convert a folder full of mixamo files to BVH …
and I was wondering if you could show me how to edit this script so it will parse that folder… I’m not sure if this script will batch convert FBX to BVH files …but if it won’t is there a way you could show me how to edit it so it will that’s what I’m trying to do… And in summary I’m trying to use this script to batch convert a folder of FBX files I got from mixamo to BVH but with the above script what I have so far I get “directory name is invalid” for the data_path variable…line 28_ thanks in advance… for any help