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
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