wmb_importer.py 文件源码

python
阅读 33 收藏 0 点赞 0 评论 0

项目:Nier2Blender 作者: C4nf3ng 项目源码 文件源码
def construct_armature(name, bone_data_array):          # bone_data =[boneIndex, boneName, parentIndex, parentName, bone_pos, optional ]
    print('[+] importing armature')
    bpy.ops.object.add(
        type='ARMATURE', 
        enter_editmode=True,
        location=(0,0,0))
    ob = bpy.context.object
    ob.show_x_ray = False
    ob.name = name
    amt = ob.data
    amt.name = name +'Amt'
    for bone_data in bone_data_array:   
        bone = amt.edit_bones.new(bone_data[1])
        bone.head = Vector(bone_data[4]) 
        bone.tail = Vector(bone_data[4]) + Vector((0 , 0.01, 0))
    bones = amt.edit_bones
    for bone_data in bone_data_array:
        if bone_data[2] < 0xffff:                       #this value need to edit in different games
            bone = bones[bone_data[1]]
            bone.parent = bones[bone_data[3]]
            bones[bone_data[3]].tail = bone.head
    bpy.ops.object.mode_set(mode='OBJECT')
    ob.rotation_euler = (math.tan(1),0,0)
    #split_armature(amt.name)                           #current not used
    return ob
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号