Files
BvhToDM_Blender/run_CMU_MotionBuilder.py
2020-04-27 15:54:03 +02:00

44 lines
2.4 KiB
Python

import bpy
import sys
import os
mydir = "C:\\UntrackedGit\\BvhToDM_Blender"
if not mydir in sys.path:
sys.path.append(mydir)
print(mydir)
import BvhToDM
import importlib
importlib.reload(BvhToDM)
from BvhToDM import BoneConstructionData, BvhToDM, BvhToDMSettings
target_name = "01_06"
skel_name = "DeepMimicSkeleton"
# Couple every DM_bone to BVH bone
# Structure: (Target_bone_name: str, inherit_bone_length: bool, inherit_bone_pos: bool, use_connect: bool, bone_direction_vec: list[float])
bonedict = {
"root": BoneConstructionData("Hips", False, False, False, [0.0, 0.0, 1.0]),
"spine": BoneConstructionData("LowerBack", True, False, True, [0.0, 0.0, 1.0]),
"chest": BoneConstructionData("Spine", True, False, True, [0.0, 0.0, 1.0], use_DT=True),
"head": BoneConstructionData("Spine1", True, False, True, [0.0, 0.0, 1.0], use_DT=True),
"right_upper_arm": BoneConstructionData("RightArm", True, True, False, [0.0, 0.0, -1.0], use_IK=True, IK_chain_length=1),
"right_lower_arm": BoneConstructionData("RightForeArm", True, False, True, [0.0, 0.0, -1.0], use_IK=True, IK_chain_length=2),
"right_hand": BoneConstructionData("RightHand", True, False, True, [0.0, 0.0, -1.0], use_DT=True),
"left_upper_arm": BoneConstructionData("LeftArm", True, True, False, [0.0, 0.0, -1.0], use_IK=True, IK_chain_length=1),
"left_lower_arm": BoneConstructionData("LeftForeArm", True, False, True, [0.0, 0.0, -1.0], use_IK=True, IK_chain_length=2),
"left_hand": BoneConstructionData("LeftHand", True, False, True, [0.0, 0.0, -1.0], use_DT=True),
"right_thigh": BoneConstructionData("RightUpLeg", True, True, False, [0.0, 0.0, -1.0], use_IK=True, IK_chain_length=1),
"right_shin": BoneConstructionData("RightLeg", True, False, True, [0.0, 0.0, -1.0], use_IK=True, IK_chain_length=2),
"right_foot": BoneConstructionData("RightFoot", True, False, True, [0.0, -1.0, 0.0], use_DT=True),
"left_thigh": BoneConstructionData("LeftUpLeg", True, True, False, [0.0, 0.0, -1.0], use_IK=True, IK_chain_length=1),
"left_shin": BoneConstructionData("LeftLeg", True, False, True, [0.0, 0.0, -1.0], use_IK=True, IK_chain_length=2),
"left_foot": BoneConstructionData("LeftFoot", True, False, True, [0.0, -1.0, 0.0], use_DT=True),
}
settings = BvhToDMSettings(bonedict, target_name)
settings.translation_scale = 0.05
settings.output_path = mydir
converter = BvhToDM(settings)
converter.run()