# Stage B/C recipes. One candidate per line; candidates whose shapes are missing are skipped.
# All available candidates are generated (splits at several falloffs) and the best score wins.
# Syntax: see Editor/Core/Recipe.cs.  @Key = shape mapped to that key, @v_xx = descriptor viseme.
#   split(expr, Left|Right[, falloff m])   mask(expr, region[, falloff IOD])   a + b   a - b   0.5*a
# Regions: upperLip lowerLip mouth jaw nose cheekL cheekR eyeL eyeR browL browR upperFace lowerFace
#   deform(seed, dx, dy, dz, radius[, toCentre])  stage D in Blender; IOD units; seeds: upperRim lowerRim rim corners
#   jawBake(degrees)                               stage D: bake the humanoid Jaw bone (needs a Jaw bone)

# --- Eyes (fallbacks when no one-sided blink exists) ---
EyeClosedLeft:  split(vrc.blink, Left)
EyeClosedLeft:  split(Blink, Left)
EyeClosedRight: split(vrc.blink, Right)
EyeClosedRight: split(Blink, Right)
EyeDilationLeft:   split(eye_pupil_big, Left)
EyeDilationRight:  split(eye_pupil_big, Right)
EyeConstrictLeft:  split(eye_pupil_small, Left)
EyeConstrictRight: split(eye_pupil_small, Right)
EyeDilationLeft:   split(瞳大, Left)
EyeDilationRight:  split(瞳大, Right)
EyeConstrictLeft:  split(瞳小, Left)
EyeConstrictRight: split(瞳小, Right)

# --- Brows ---
BrowPinchLeft:  split(eyebrow_close, Left)
BrowPinchRight: split(eyebrow_close, Right)

# --- Jaw / mouth ---
JawOpen: jawBake(20)
JawOpen: @v_aa
# With a blendshape jaw, MouthClosed must cancel JawOpen exactly so JawOpen + MouthClosed = closed lips.
MouthClosed: -1*@JawOpen
# 「い」: the upper lip lifts and the lower lip drops, showing teeth.
MouthUpperUpLeft:    split(mask(@v_ih, upperLip), Left)
MouthUpperUpRight:   split(mask(@v_ih, upperLip), Right)
MouthLowerDownLeft:  split(mask(@v_ih, lowerLip), Left)
MouthLowerDownRight: split(mask(@v_ih, lowerLip), Right)
# Stage D alternatives for meshes with modelled lips. On texture-drawn mouths they stretch the drawn line into a
# blotch (the scorer cannot see that), so they are off by default; enable per avatar via the profile's extra recipes.
# MouthUpperUpLeft:    split(deform(upperRim, 0, 0.06, 0.01, 0.25), Left)
# MouthLowerDownLeft:  split(deform(lowerRim, 0, -0.06, 0.01, 0.25), Left)
# Pucker: lips forward and together. On a texture-drawn mouth the two lips must move as one unit, or the drawn
# line stretches into a blotch; so both pucker keys push the whole rim, each with half the motion.
LipPuckerUpperLeft:  split(deform(rim, 0, 0, 0.03, 0.2, 0.02), Left)
LipPuckerUpperRight: split(deform(rim, 0, 0, 0.03, 0.2, 0.02), Right)
LipPuckerLowerLeft:  split(deform(rim, 0, 0, 0.03, 0.2, 0.02), Left)
LipPuckerLowerRight: split(deform(rim, 0, 0, 0.03, 0.2, 0.02), Right)
# Funnel: lips forward, the upper one slightly raised (parting the lower one stretches drawn mouth lines).
LipFunnelUpperLeft:  split(deform(upperRim, 0, 0.01, 0.04, 0.15), Left)
LipFunnelUpperRight: split(deform(upperRim, 0, 0.01, 0.04, 0.15), Right)
LipFunnelLowerLeft:  split(deform(lowerRim, 0, 0, 0.04, 0.15), Left)
LipFunnelLowerRight: split(deform(lowerRim, 0, 0, 0.04, 0.15), Right)
# Suck: lips roll inward/back. Press: lips pressed back. Raiser: lip pushed up (chin raiser / upper shrug).
LipSuckUpperLeft:  split(deform(upperRim, 0, -0.02, -0.04, 0.15), Left)
LipSuckUpperRight: split(deform(upperRim, 0, -0.02, -0.04, 0.15), Right)
LipSuckLowerLeft:  split(deform(lowerRim, 0, 0.02, -0.04, 0.15), Left)
LipSuckLowerRight: split(deform(lowerRim, 0, 0.02, -0.04, 0.15), Right)
MouthPressLeft:  split(deform(rim, 0, 0, -0.02, 0.15, 0.02), Left)
MouthPressRight: split(deform(rim, 0, 0, -0.02, 0.15, 0.02), Right)
MouthRaiserUpper: deform(upperRim, 0, 0.02, 0.02, 0.3)
MouthRaiserLower: deform(lowerRim, 0, 0.03, 0.02, 0.35)
# Corners: dimple (back and out), tightener (in), slant (up without widening).
MouthDimpleLeft:      split(deform(corners, 0, 0, -0.03, 0.15, -0.02), Left)
MouthDimpleRight:     split(deform(corners, 0, 0, -0.03, 0.15, -0.02), Right)
MouthTightenerLeft:   split(deform(corners, 0, 0, 0, 0.12, 0.03), Left)
MouthTightenerRight:  split(deform(corners, 0, 0, 0, 0.12, 0.03), Right)
MouthCornerSlantLeft:  split(deform(corners, 0, 0.04, 0, 0.15), Left)
MouthCornerSlantRight: split(deform(corners, 0, 0.04, 0, 0.15), Right)
# Fallbacks from visemes: 「う」 pushes lips forward (pucker), 「お」 rounds them (funnel).
LipPuckerUpperLeft:  split(mask(@v_ou, upperLip), Left)
LipPuckerUpperRight: split(mask(@v_ou, upperLip), Right)
LipPuckerLowerLeft:  split(mask(@v_ou, lowerLip), Left)
LipPuckerLowerRight: split(mask(@v_ou, lowerLip), Right)
LipFunnelUpperLeft:  split(mask(@v_oh, upperLip), Left)
LipFunnelUpperRight: split(mask(@v_oh, upperLip), Right)
LipFunnelLowerLeft:  split(mask(@v_oh, lowerLip), Left)
LipFunnelLowerRight: split(mask(@v_oh, lowerLip), Right)
MouthFrownLeft:  split(口角下げ, Left)
MouthFrownRight: split(口角下げ, Right)
MouthFrownLeft:  split(mouth_Λ_1, Left)
MouthFrownRight: split(mouth_Λ_1, Right)
