diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2022-02-11 11:40:07 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2022-02-11 11:40:07 +0300 |
commit | df2296e154463969713cc7a82593d10fe71ab940 (patch) | |
tree | 37efc8832bdef1a85b87b5f8a0017a017e472b44 | |
parent | bfec050a9716e0867dfe1b884877ac0e5ebcae54 (diff) |
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.
-rw-r--r-- | rigify/rigs/face/skin_eye.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/rigify/rigs/face/skin_eye.py b/rigify/rigs/face/skin_eye.py index da4da1e5..16b05b4b 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() |