예제 #1
0
def getTrackingWeight(DOFs, skeleton, weightMap, rootPositionWeight=0.):
    weights = [1.]*skeleton.getJointNum()
    for name, weight in weightMap.items():
        index = skeleton.getJointIndex(name)
        if index is not None:
            weights[index] = weight

    totalDOF = 0
    for dof in DOFs:
        totalDOF += dof

    weights_ext = [None]*totalDOF
    ype.repeatListElements(weights, weights_ext, DOFs)
    weights_ext[0:3] = [rootPositionWeight, rootPositionWeight, rootPositionWeight]

    return weights_ext
예제 #2
0
def getTrackingWeightDart(DOFs, skeleton, weightMap, rootPositionWeight=0.):
    weights = [1.] * skeleton.num_joints()
    for name, weight in weightMap.items():
        index = skeleton.body('h' + name[1:]).index_in_skeleton()
        weights[index] = weight

    totalDOF = 0
    for dof in DOFs:
        totalDOF += dof

    weights_ext = [None] * totalDOF
    ype.repeatListElements(weights, weights_ext, DOFs)
    weights_ext[0:3] = [
        rootPositionWeight, rootPositionWeight, rootPositionWeight
    ]

    return weights_ext