def map_pau(selfself, trackMsg): # Final Message to be sent. Currently only m_coeffs has to be remapped msg = pau() #eyes and head remains same. msg.m_headRotation = copy.deepcopy(trackMsg.m_headRotation) # Correction msg.m_headRotation.y = trackMsg.m_headRotation.x msg.m_headRotation.z = -trackMsg.m_headRotation.y msg.m_headRotation.x = -trackMsg.m_headRotation.z msg.m_eyeGazeLeftPitch = math.radians(trackMsg.m_eyeGazeLeftPitch) msg.m_eyeGazeLeftYaw = math.radians(trackMsg.m_eyeGazeLeftYaw) msg.m_eyeGazeRightYaw = math.radians(trackMsg.m_eyeGazeRightYaw) msg.m_eyeGazeRightPitch = math.radians(trackMsg.m_eyeGazeRightPitch) # Empty m_coeffs msg.m_coeffs = [0] * ShapekeyStore.getLength() # Map by shapekeys fs = trackMsg.m_coeffs for i, sk in enumerate(ShapekeyStore.getList()): if sk in blend_shape_names: msg.m_coeffs[i] = fs[blend_shape_names.index(sk)] # Outer brows are same as inner msg.m_coeffs[5] = msg.m_coeffs[3] msg.m_coeffs[6] = msg.m_coeffs[4] msg.m_coeffs[10] = msg.m_coeffs[8] msg.m_coeffs[11] = msg.m_coeffs[9] return msg
def map_pau(selfself, trackMsg): # Final Message to be sent. Currently only m_coeffs has to be remapped msg = pau() #eyes and head remains same. msg.m_headRotation = copy.deepcopy(trackMsg.m_headRotation) # Correction msg.m_headRotation.y = trackMsg.m_headRotation.x msg.m_headRotation.z = -trackMsg.m_headRotation.y msg.m_headRotation.x = -trackMsg.m_headRotation.z msg.m_eyeGazeLeftPitch = math.radians(trackMsg.m_eyeGazeLeftPitch) msg.m_eyeGazeLeftYaw = math.radians(trackMsg.m_eyeGazeLeftYaw) msg.m_eyeGazeRightYaw = math.radians(trackMsg.m_eyeGazeRightYaw) msg.m_eyeGazeRightPitch = math.radians(trackMsg.m_eyeGazeRightPitch) # Empty m_coeffs msg.m_coeffs = [0]*ShapekeyStore.getLength() # Map by shapekeys fs = trackMsg.m_coeffs for i,sk in enumerate(ShapekeyStore.getList()): if sk in blend_shape_names: msg.m_coeffs[i] = fs[blend_shape_names.index(sk)] # Outer brows are same as inner msg.m_coeffs[5] = msg.m_coeffs[3] msg.m_coeffs[6] = msg.m_coeffs[4] msg.m_coeffs[10] = msg.m_coeffs[8] msg.m_coeffs[11] = msg.m_coeffs[9] return msg