@rig-c/parts 1.27.0 → 1.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/rig.ts CHANGED
@@ -165,13 +165,13 @@ import {
165
165
  import { type ContourChainRibs, type ContourReport, contourMesh, type ContourRegion, type ContourRib } from './contour.ts';
166
166
  import { type LocalInfluence, localInfluences } from './localweights.ts';
167
167
  import { artCoverage, ART_ALPHA, latticeMesh, latticeStray, ONE_LOOP_PASSES } from './mesh.ts';
168
- import { BLINK, blinkHoldMisses, blinkSpan, CONTROL_SUFFIX, controlledBones, IDLE_FPS, idleMotion, type MotionSpec, moveKeysToControls } from './motion.ts';
168
+ import { bindFaceSurfaceDeform, BLINK, blinkHoldMisses, blinkSpan, CONTROL_SUFFIX, controlledBones, IDLE_FPS, idleMotion, type MotionSpec, moveKeysToControls } from './motion.ts';
169
169
  import { PAINTING_RUN, type PartsFile, readFrom, tagOf } from './parts.ts';
170
170
  import { EYE_GROUP_TAGS } from './propose.ts';
171
171
  import { alphaAbove, crop, pad, type Raster } from './raster/index.ts';
172
172
  import { pyRound } from './round.ts';
173
173
  import { boneHeat, type HeatDust, heatInfluences, HEAT_LIMITS, heatRow, type HeatRow, latticeSilhouette, tracedSilhouette } from './heat.ts';
174
- import { TURN_BONE, type TurnSpec, turnConstraintName, turnFractions, turnTwin } from './turn.ts';
174
+ import { applyFaceSurfaceDeform, TURN_BONE, type TurnSpec, turnConstraintName, turnFractions, turnTwin } from './turn.ts';
175
175
  import { DISTANCE_EXPONENT, type FloorForm, type Influence, influences, type InfluenceLimits, type MeshInfluences, meshLimits, type Segment } from './weights.ts';
176
176
 
177
177
  /** Transparent pixels added round every part image — the reference's `PAD`. */
@@ -1996,6 +1996,17 @@ export function buildRig(
1996
1996
  // issue #239: the face's line, written only when the face bones were turned to one, so no other rig moves.
1997
1997
  const axes = [faceAxis.axis, faceAxis.tipAxis].flatMap((x) => (x === null ? [] : [x]));
1998
1998
  if (axes.length > 0) rig.invariants = { ...rig.invariants, axes };
1999
+ const faceImg = outImages.find(([k]) => k === 'face.png')?.[1];
2000
+ const facePart = parts.parts.find((p) => p.name === 'face');
2001
+ bindFaceSurfaceDeform(motion, (merged) => {
2002
+ applyFaceSurfaceDeform(rig, merged, {
2003
+ imageWidth: faceImg?.width,
2004
+ imageHeight: faceImg?.height,
2005
+ opaqueWidth: facePart?.w,
2006
+ opaqueHeight: facePart?.h,
2007
+ overrides: cfg.turn?.deform,
2008
+ });
2009
+ });
1999
2010
  return { rig, motion, meshReport, images: outImages, controls, meshKeyed, idleKeys, loopPasses, autoMotion, faceAxis, turn: turned?.rows ?? null };
2000
2011
  }
2001
2012