delta.py 文件源码

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

项目:bpy_lambda 作者: bcongdon 项目源码 文件源码
def set_mat(obj, bone_name, matrix):
        """ Sets the bone to have the given transform matrix.
        """
        a = obj.data.edit_bones[bone_name]

        a.head = (0, 0, 0)
        a.tail = (0, 1, 0)

        a.transform(matrix)

        d = acos(a.matrix.to_quaternion().dot(matrix.to_quaternion())) * 2.0

        roll_1 = a.roll + d
        roll_2 = a.roll - d

        a.roll = roll_1
        d1 = a.matrix.to_quaternion().dot(matrix.to_quaternion())
        a.roll = roll_2
        d2 = a.matrix.to_quaternion().dot(matrix.to_quaternion())

        if d1 > d2:
            a.roll = roll_1
        else:
            a.roll = roll_2
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号