From df2296e154463969713cc7a82593d10fe71ab940 Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov <angavrilov@gmail.com> Date: Fri, 11 Feb 2022 11:40:07 +0300 Subject: [PATCH] Fix T95648: Rigify: use eye axis in computing the eyelid tracking weights. If the coordinate space of the eyelids is computed only from the eye rotation center points and corners, it fails if the center is close or in front of the line connecting the corners. Instead, compute the space based on the main eye axis plus the line between corners, which only slightly changes the result compared to the previous method, but is more robust. --- rigify/rigs/face/skin_eye.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/rigify/rigs/face/skin_eye.py b/rigify/rigs/face/skin_eye.py index da4da1e58..16b05b4b1 100644 --- a/rigify/rigs/face/skin_eye.py +++ b/rigify/rigs/face/skin_eye.py @@ -92,13 +92,10 @@ class Rig(BaseSkinRig): if len(self.eye_corner_nodes) != 2: self.raise_error('Expected 2 eye corners, but found {}', len(self.eye_corner_nodes)) - # Build a coordinate space with XY plane based on center and two corners, - # and Y axis oriented as close to the eye axis as possible. - vecs = [(node.point - self.center).normalized() for node in self.eye_corner_nodes] - normal = vecs[0].cross(vecs[1]) - space_axis = self.axis - self.axis.project(normal) + # Build a coordinate space with XY plane based on eye axis and two corners + corner_axis = self.eye_corner_nodes[1].point - self.eye_corner_nodes[0].point - matrix = matrix_from_axis_pair(space_axis, normal, 'z').to_4x4() + matrix = matrix_from_axis_pair(self.axis, corner_axis, 'x').to_4x4() matrix.translation = self.center self.eye_corner_matrix = matrix.inverted() -- GitLab