MMD绑骨骼注意事项

Zane133 于 2020-02-21 发布

mmd的骨骼必须名字要对,不对的话导出的动画是不会播放的。 注意,命名的时候不要复制excel表格里的文字,因为会带上制表符,回车啥的,从而导致导出有问题 导入fbx的时候,需要先导出为bvh格式再导入 导出的时候需要勾选Treat current pose as Rest Pose 导出vmd前需要先设置成A pose

基本流程

物体的缩放

脚部骨骼陷入地面的问题

导入unity脚步有滑动

手部骨骼动作不准确的问题

重命名脚本

import bpy
prefix_str = "mixamorig:" 
for x in bpy.context.object.data.bones:
    x.name = x.name.replace(prefix_str + 'Hips','センター')
    x.name = x.name.replace(prefix_str + 'Spine2','上半身2')
    x.name = x.name.replace(prefix_str + 'Spine','上半身')
    x.name = x.name.replace(prefix_str + 'LeftShoulder','左肩')
    x.name = x.name.replace(prefix_str + 'LeftArm','左腕')
    x.name = x.name.replace(prefix_str + 'LeftForeArm','左ひじ')
    x.name = x.name.replace(prefix_str + 'RightShoulder','右肩')
    x.name = x.name.replace(prefix_str + 'RightArm','右腕')
    x.name = x.name.replace(prefix_str + 'RightForeArm','右ひじ')
    x.name = x.name.replace(prefix_str + 'RightLeg','右ひざ')
    x.name = x.name.replace(prefix_str + 'LeftLeg','左ひざ')
    x.name = x.name.replace(prefix_str + 'RightHand','右手首')
    x.name = x.name.replace(prefix_str + 'LeftHand','左手首')
    x.name = x.name.replace(prefix_str + 'RightUpLeg','右足')
    x.name = x.name.replace(prefix_str + 'LeftUpLeg','左足')
    x.name = x.name.replace(prefix_str + 'RightFoot','右足首')
    x.name = x.name.replace(prefix_str + 'LeftFoot','左足首')
    x.name = x.name.replace(prefix_str + 'Neck','首')
    x.name = x.name.replace(prefix_str + 'Head','頭')
    

镜像改名

ctrl + m之后

import bpy
for x in bpy.context.object.data.bones:
    if x.name.find('.001') > 0:
        x.name = x.name.replace('左','右')
        x.name = x.name.replace('.001','')  

导入指定文件夹文件

import os
import bpy

# put the location to the folder where the objs are located here in this fashion
path_to_obj_dir = os.path.join('C:\\', 'Users', 'you login name', 'Desktop', 'ss') #<-WINDOWS_OS
#path_to_obj_dir = bpy.path.abspath('//OBJ/')

# get list of all files in directory
file_list = sorted(os.listdir(path_to_obj_dir))

# get a list of files ending in 'obj'
obj_list = [item for item in file_list if item[-3:] == 'pmx']

# 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.mmd_tools.import_model(filepath=path_to_file)

Blender导出fbx动作有大幅度飘移