Skip to content
Snippets Groups Projects
Commit df2296e1 authored by Alexander Gavrilov's avatar Alexander Gavrilov
Browse files

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.
parent bfec050a
No related branches found
No related tags found
No related merge requests found
......@@ -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()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment