@rig-c/parts 1.70.1 → 1.71.1
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/docs/AUTHORING.md +21 -13
- package/docs/STABILITY.md +4 -1
- package/package.json +1 -1
- package/src/assemble.ts +62 -8
- package/src/build.ts +1 -0
- package/src/config.ts +563 -46
- package/src/rig.ts +527 -135
- package/src/turn.ts +202 -53
package/src/turn.ts
CHANGED
|
@@ -232,6 +232,10 @@ export const FACESHIFT_BONE = 'faceshift';
|
|
|
232
232
|
export const REAR_SHIFT_BONE = 'rear_shift';
|
|
233
233
|
export const YAW_DIAL_BONE = 'yaw_dial';
|
|
234
234
|
export const PITCH_DIAL_BONE = 'pitch_dial';
|
|
235
|
+
export const BODYSHIFT_BONE = 'bodyshift';
|
|
236
|
+
export const BODY_REAR_SHIFT_BONE = 'body_rear_shift';
|
|
237
|
+
export const BODY_YAW_DIAL_BONE = 'body_yaw_dial';
|
|
238
|
+
export const BODY_TURN_ANIM = 'body_turn';
|
|
235
239
|
export const TURN_DIAL_SCALE = 0.0625;
|
|
236
240
|
export const TURN_GRID_MAX_TRIANGLES_PER_SLOT = 2400;
|
|
237
241
|
export const TURN_GRID_MAX_TRIANGLES_TOTAL = 4000;
|
|
@@ -241,11 +245,28 @@ export function turnSurfaceBone(part: string): string {
|
|
|
241
245
|
return `${part}_surface`;
|
|
242
246
|
}
|
|
243
247
|
|
|
244
|
-
/**
|
|
248
|
+
/** The carrier bone that carries a 2.5D `'unit'` mesh part (`<part>_unit`) under `faceshift` / `bodyshift` (#790). */
|
|
249
|
+
export function turnUnitBone(part: string): string {
|
|
250
|
+
return `${part}_unit`;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/** Optional 2.5D body-yaw turn block under `config.turn.body` (#787). */
|
|
254
|
+
export interface TurnBodySpec {
|
|
255
|
+
pivot?: number;
|
|
256
|
+
roles: Record<string, TurnRole>;
|
|
257
|
+
bone?: string;
|
|
258
|
+
slider?: string;
|
|
259
|
+
counter?: number;
|
|
260
|
+
grid?: [number, number] | Record<string, [number, number]>;
|
|
261
|
+
unitDepths?: Record<string, number>;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/** `config.turn`: either the legacy `{ pivot, depths }` turn spec or the 2.5D depth-sampled `{ roles, body?, pivot?, counter?, grid?, unitDepths?, band? }` spec (#763, #787). */
|
|
245
265
|
export interface TurnSpec {
|
|
246
266
|
pivot?: number;
|
|
247
267
|
depths?: Record<string, number>;
|
|
248
268
|
roles?: Record<string, TurnRole>;
|
|
269
|
+
body?: TurnBodySpec;
|
|
249
270
|
counter?: number;
|
|
250
271
|
grid?: [number, number] | Record<string, [number, number]>;
|
|
251
272
|
unitDepths?: Record<string, number>;
|
|
@@ -256,13 +277,19 @@ export interface TurnSpec {
|
|
|
256
277
|
deform?: Partial<FaceDeformFractions>;
|
|
257
278
|
}
|
|
258
279
|
|
|
259
|
-
/** Resolve `[cols, rows]` for a `'surface'` part under `config.turn`. */
|
|
260
|
-
export function resolveTurnGrid(
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
280
|
+
/** Resolve `[cols, rows]` for a `'surface'` part under `config.turn` or `config.turn.body`. */
|
|
281
|
+
export function resolveTurnGrid(
|
|
282
|
+
spec: { grid?: [number, number] | Record<string, [number, number]> } | null | undefined,
|
|
283
|
+
part: string,
|
|
284
|
+
fallback?: { grid?: [number, number] | Record<string, [number, number]> } | null,
|
|
285
|
+
): [number, number] {
|
|
286
|
+
for (const s of [spec, fallback]) {
|
|
287
|
+
const g = s?.grid;
|
|
288
|
+
if (Array.isArray(g) && g.length === 2) return [g[0], g[1]];
|
|
289
|
+
if (g !== undefined && !Array.isArray(g) && Object.hasOwn(g, part)) {
|
|
290
|
+
const entry = g[part];
|
|
291
|
+
return [entry[0], entry[1]];
|
|
292
|
+
}
|
|
266
293
|
}
|
|
267
294
|
return [DEFAULT_TURN_GRID_25D[0], DEFAULT_TURN_GRID_25D[1]];
|
|
268
295
|
}
|
|
@@ -1455,12 +1482,27 @@ export interface Depth25DTurnOptions {
|
|
|
1455
1482
|
hasAlternateFaceSet: boolean;
|
|
1456
1483
|
}
|
|
1457
1484
|
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1485
|
+
interface Depth25DGroupSpec {
|
|
1486
|
+
fieldPrefix: 'config.turn' | 'config.turn.body';
|
|
1487
|
+
roles: Record<string, TurnRole>;
|
|
1488
|
+
pivot: number;
|
|
1489
|
+
counter: number;
|
|
1490
|
+
unitDepths?: Record<string, number>;
|
|
1491
|
+
carrierBone: string;
|
|
1492
|
+
rearCarrierBone: string;
|
|
1493
|
+
unitGroupName: string;
|
|
1494
|
+
useEyeLandmarksForZRef: boolean;
|
|
1495
|
+
checkEarBehindCheek: boolean;
|
|
1496
|
+
axes: ReadonlyArray<{
|
|
1497
|
+
kind: 'yaw' | 'pitch';
|
|
1498
|
+
animName: string;
|
|
1499
|
+
sliderName: string;
|
|
1500
|
+
dialBone: string;
|
|
1501
|
+
maxDeg: number;
|
|
1502
|
+
}>;
|
|
1503
|
+
}
|
|
1504
|
+
|
|
1505
|
+
function buildDepth25DTurnGroup(
|
|
1464
1506
|
rig: {
|
|
1465
1507
|
bones: Array<{ name: string; parent?: string; x: number; y: number; rotation?: number; length?: number }>;
|
|
1466
1508
|
slots: Array<{ name: string; bone: string; attachment: string | null }>;
|
|
@@ -1471,13 +1513,14 @@ export function buildDepth25DTurn(
|
|
|
1471
1513
|
animations: Record<string, unknown>;
|
|
1472
1514
|
},
|
|
1473
1515
|
opts: Depth25DTurnOptions,
|
|
1516
|
+
group: Depth25DGroupSpec,
|
|
1517
|
+
problems: Problem[],
|
|
1474
1518
|
): void {
|
|
1475
|
-
const roles =
|
|
1476
|
-
if (roles === undefined) return;
|
|
1477
|
-
const problems: Problem[] = [];
|
|
1519
|
+
const { roles } = group;
|
|
1478
1520
|
const partMap = new Map(opts.parts.map((p) => [p.name, p]));
|
|
1521
|
+
const startProblems = problems.length;
|
|
1479
1522
|
|
|
1480
|
-
//
|
|
1523
|
+
// All turn-bound parts in the group that carry a depth sheet must share one near and one zScale.
|
|
1481
1524
|
let sharedNear: PartDepthReference['near'] | null = null;
|
|
1482
1525
|
let sharedZScale: number | null = null;
|
|
1483
1526
|
let sharedFirstPart: string | null = null;
|
|
@@ -1492,7 +1535,7 @@ export function buildDepth25DTurn(
|
|
|
1492
1535
|
problems.push({
|
|
1493
1536
|
code: 'RIG_TURN_SHARED_DEPTH_SCALE',
|
|
1494
1537
|
object: `parts.json part "${part}".depth`,
|
|
1495
|
-
detail: `states near="${rec.depth.near}", zScale=${rec.depth.zScale}, which disagrees with "${sharedFirstPart}" (near="${sharedNear}", zScale=${sharedZScale}); all parts bound to one
|
|
1538
|
+
detail: `states near="${rec.depth.near}", zScale=${rec.depth.zScale}, which disagrees with "${sharedFirstPart}" (near="${sharedNear}", zScale=${sharedZScale}); all parts bound to one 2.5D turn group must share one near polarity and one zScale so Core's sampled z values are in one coordinate space`,
|
|
1496
1539
|
});
|
|
1497
1540
|
}
|
|
1498
1541
|
}
|
|
@@ -1514,7 +1557,7 @@ export function buildDepth25DTurn(
|
|
|
1514
1557
|
if (rec === undefined || rec.depth === undefined || art === undefined || scalar === undefined) {
|
|
1515
1558
|
problems.push({
|
|
1516
1559
|
code: 'RIG_TURN_SURFACE_DEPTH_REQUIRED',
|
|
1517
|
-
object:
|
|
1560
|
+
object: `${group.fieldPrefix}.roles.${part}`,
|
|
1518
1561
|
detail: `declares role "surface" for "${part}", which requires a depth sheet in parts.json; run assemble with config.depth or provide "${part}_depth.png"`,
|
|
1519
1562
|
});
|
|
1520
1563
|
continue;
|
|
@@ -1527,8 +1570,8 @@ export function buildDepth25DTurn(
|
|
|
1527
1570
|
const ly = Math.max(0, Math.min(ext.height - 1, Math.round(cy - rec.y + padY)));
|
|
1528
1571
|
return levelToDepthZ(ext.data[(ly * ext.width + lx) * 4], rec.depth as PartDepthReference);
|
|
1529
1572
|
};
|
|
1530
|
-
const eyeR = opts.boneLandmarks.get('eye_r');
|
|
1531
|
-
const eyeL = opts.boneLandmarks.get('eye_l');
|
|
1573
|
+
const eyeR = group.useEyeLandmarksForZRef ? opts.boneLandmarks.get('eye_r') : undefined;
|
|
1574
|
+
const eyeL = group.useEyeLandmarksForZRef ? opts.boneLandmarks.get('eye_l') : undefined;
|
|
1532
1575
|
let zRef: number;
|
|
1533
1576
|
if (eyeR !== undefined && eyeL !== undefined) {
|
|
1534
1577
|
zRef = pyRound(0.5 * (sampleExtAtCrop(eyeR[0], eyeR[1]) + sampleExtAtCrop(eyeL[0], eyeL[1])), 4);
|
|
@@ -1537,20 +1580,20 @@ export function buildDepth25DTurn(
|
|
|
1537
1580
|
}
|
|
1538
1581
|
surfaceSheets.set(part, { rec: rec as { name: string; x: number; y: number; w: number; h: number; depth: PartDepthReference }, ext, zRef });
|
|
1539
1582
|
}
|
|
1540
|
-
|
|
1583
|
+
if (problems.length > startProblems) return;
|
|
1541
1584
|
|
|
1542
|
-
const primarySurface = surfaceSheets.get('face') ?? [...surfaceSheets.values()][0];
|
|
1543
|
-
const pivot = pyRound(
|
|
1544
|
-
const counter =
|
|
1585
|
+
const primarySurface = (group.useEyeLandmarksForZRef ? surfaceSheets.get('face') : undefined) ?? [...surfaceSheets.values()][0];
|
|
1586
|
+
const pivot = pyRound(group.pivot, 4);
|
|
1587
|
+
const counter = group.counter;
|
|
1545
1588
|
const rearDepth = pyRound(-counter * pivot, 4);
|
|
1546
1589
|
const hasRear = Object.values(roles).includes('rear');
|
|
1547
1590
|
|
|
1548
|
-
// Collect unit bones that sit directly under
|
|
1549
|
-
const
|
|
1591
|
+
// Collect unit bones that sit directly under carrierBone and resolve one scalar depth per unit bone.
|
|
1592
|
+
const carrierChildren = new Set(rig.bones.filter((b) => b.parent === group.carrierBone).map((b) => b.name));
|
|
1550
1593
|
const unitDepthMap: Record<string, number> = {};
|
|
1551
1594
|
const unitBones: string[] = [];
|
|
1552
1595
|
const addUnitBone = (bone: string, depth: number): void => {
|
|
1553
|
-
if (!
|
|
1596
|
+
if (!carrierChildren.has(bone)) return;
|
|
1554
1597
|
if (!unitBones.includes(bone)) unitBones.push(bone);
|
|
1555
1598
|
unitDepthMap[bone] = pyRound(depth, 4);
|
|
1556
1599
|
};
|
|
@@ -1558,22 +1601,47 @@ export function buildDepth25DTurn(
|
|
|
1558
1601
|
for (const [part, role] of Object.entries(roles)) {
|
|
1559
1602
|
if (role !== 'unit') continue;
|
|
1560
1603
|
const regSpec = opts.regions[part];
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1604
|
+
let baseBone: string | undefined;
|
|
1605
|
+
let candidateBones: string[] = [];
|
|
1606
|
+
if (regSpec !== undefined) {
|
|
1607
|
+
baseBone = typeof regSpec === 'string' ? regSpec : regSpec.bone;
|
|
1608
|
+
const stillBone = opts.stills[part]?.bone;
|
|
1609
|
+
candidateBones = [baseBone, ...(stillBone === undefined ? [] : [stillBone])].filter((b) => carrierChildren.has(b));
|
|
1610
|
+
} else {
|
|
1611
|
+
const uBone = turnUnitBone(part);
|
|
1612
|
+
if (carrierChildren.has(uBone)) candidateBones = [uBone];
|
|
1613
|
+
}
|
|
1565
1614
|
if (candidateBones.length === 0) continue;
|
|
1566
1615
|
|
|
1567
1616
|
for (const bName of candidateBones) {
|
|
1568
|
-
const explicitPartDepth =
|
|
1569
|
-
const explicitBoneDepth =
|
|
1617
|
+
const explicitPartDepth = group.unitDepths?.[part];
|
|
1618
|
+
const explicitBoneDepth = group.unitDepths?.[bName];
|
|
1570
1619
|
let resolved: number | null = null;
|
|
1571
1620
|
if (typeof explicitPartDepth === 'number' && Number.isFinite(explicitPartDepth)) {
|
|
1572
1621
|
resolved = explicitPartDepth;
|
|
1573
1622
|
} else if (typeof explicitBoneDepth === 'number' && Number.isFinite(explicitBoneDepth)) {
|
|
1574
1623
|
resolved = explicitBoneDepth;
|
|
1575
1624
|
} else if (primarySurface !== undefined) {
|
|
1576
|
-
|
|
1625
|
+
let pt: readonly [number, number] | undefined =
|
|
1626
|
+
opts.boneLandmarks.get(bName) ??
|
|
1627
|
+
(baseBone === undefined ? undefined : opts.boneLandmarks.get(baseBone));
|
|
1628
|
+
if (pt === undefined && regSpec === undefined) {
|
|
1629
|
+
const childPts: Array<readonly [number, number]> = [];
|
|
1630
|
+
for (const child of rig.bones) {
|
|
1631
|
+
if (child.parent !== bName) continue;
|
|
1632
|
+
const bare = child.name.endsWith('_ctl') ? child.name.slice(0, -4) : child.name;
|
|
1633
|
+
const cp = opts.boneLandmarks.get(child.name) ?? opts.boneLandmarks.get(bare);
|
|
1634
|
+
if (cp !== undefined) childPts.push(cp);
|
|
1635
|
+
}
|
|
1636
|
+
if (childPts.length > 0) {
|
|
1637
|
+
const sx = childPts.reduce((acc, p) => acc + p[0], 0) / childPts.length;
|
|
1638
|
+
const sy = childPts.reduce((acc, p) => acc + p[1], 0) / childPts.length;
|
|
1639
|
+
pt = [sx, sy];
|
|
1640
|
+
} else {
|
|
1641
|
+
const partRec = partMap.get(part);
|
|
1642
|
+
if (partRec !== undefined) pt = [partRec.x + partRec.w / 2, partRec.y + partRec.h / 2];
|
|
1643
|
+
}
|
|
1644
|
+
}
|
|
1577
1645
|
if (pt !== undefined) {
|
|
1578
1646
|
const { rec, ext, zRef } = primarySurface;
|
|
1579
1647
|
const padX = Math.floor((ext.width - rec.w) / 2);
|
|
@@ -1595,12 +1663,12 @@ export function buildDepth25DTurn(
|
|
|
1595
1663
|
if (resolved === null) {
|
|
1596
1664
|
problems.push({
|
|
1597
1665
|
code: 'RIG_TURN_UNIT_DEPTH_REQUIRED',
|
|
1598
|
-
object:
|
|
1599
|
-
detail: `declares role "unit" for "${part}" (bone "${bName}"), and neither a surface depth sheet nor a part depth sheet nor
|
|
1666
|
+
object: `${group.fieldPrefix}.roles.${part}`,
|
|
1667
|
+
detail: `declares role "unit" for "${part}" (bone "${bName}"), and neither a surface depth sheet nor a part depth sheet nor ${group.fieldPrefix}.unitDepths.${part} provides its depth`,
|
|
1600
1668
|
});
|
|
1601
1669
|
continue;
|
|
1602
1670
|
}
|
|
1603
|
-
if ((bName === 'ear_r' || bName === 'ear_l') && primarySurface !== undefined) {
|
|
1671
|
+
if (group.checkEarBehindCheek && (bName === 'ear_r' || bName === 'ear_l') && primarySurface !== undefined) {
|
|
1604
1672
|
const pt = opts.boneLandmarks.get(bName);
|
|
1605
1673
|
if (pt !== undefined) {
|
|
1606
1674
|
const { rec, ext, zRef } = primarySurface;
|
|
@@ -1612,7 +1680,7 @@ export function buildDepth25DTurn(
|
|
|
1612
1680
|
if (resolved > cheekDepth) {
|
|
1613
1681
|
problems.push({
|
|
1614
1682
|
code: 'RIG_TURN_EAR_DEPTH_BEHIND_CHEEK',
|
|
1615
|
-
object:
|
|
1683
|
+
object: `${group.fieldPrefix}.unitDepths.${part}`,
|
|
1616
1684
|
detail: `places "${bName}" at depth ${pyRound(resolved, 4)}, which is in front of the adjacent cheek edge (${cheekDepth}); an ear depth at or behind ${cheekDepth} is required so the ear recedes behind the cheek`,
|
|
1617
1685
|
});
|
|
1618
1686
|
continue;
|
|
@@ -1622,7 +1690,7 @@ export function buildDepth25DTurn(
|
|
|
1622
1690
|
addUnitBone(bName, resolved);
|
|
1623
1691
|
}
|
|
1624
1692
|
}
|
|
1625
|
-
|
|
1693
|
+
if (problems.length > startProblems) return;
|
|
1626
1694
|
|
|
1627
1695
|
// Order unitBones in rig.bones declaration order for determinism.
|
|
1628
1696
|
const boneIndex = new Map(rig.bones.map((b, i) => [b.name, i]));
|
|
@@ -1632,12 +1700,10 @@ export function buildDepth25DTurn(
|
|
|
1632
1700
|
|
|
1633
1701
|
if (unitBones.length > 0) {
|
|
1634
1702
|
motion.groups ??= {};
|
|
1635
|
-
motion.groups.
|
|
1703
|
+
motion.groups[group.unitGroupName] = unitBones;
|
|
1636
1704
|
}
|
|
1637
1705
|
|
|
1638
|
-
const
|
|
1639
|
-
const buildAxisAnim = (kind: 'yaw' | 'pitch', maxDeg: number): void => {
|
|
1640
|
-
const animName = kind === 'yaw' ? 'turn' : 'tilt';
|
|
1706
|
+
const buildAxisAnim = (kind: 'yaw' | 'pitch', animName: string, maxDeg: number): void => {
|
|
1641
1707
|
const prop = kind === 'yaw' ? 'translatex' : 'translatey';
|
|
1642
1708
|
const duration = pyRound(2 * maxDeg * TURN_DIAL_SCALE, 6);
|
|
1643
1709
|
const step = maxDeg / 2;
|
|
@@ -1665,7 +1731,7 @@ export function buildDepth25DTurn(
|
|
|
1665
1731
|
}>;
|
|
1666
1732
|
}> = [
|
|
1667
1733
|
{
|
|
1668
|
-
bone:
|
|
1734
|
+
bone: group.carrierBone,
|
|
1669
1735
|
property: prop,
|
|
1670
1736
|
keys: keyList.map(({ t, deg }) =>
|
|
1671
1737
|
deg === 0
|
|
@@ -1676,7 +1742,7 @@ export function buildDepth25DTurn(
|
|
|
1676
1742
|
];
|
|
1677
1743
|
if (hasRear && rearDepth !== 0) {
|
|
1678
1744
|
tracks.push({
|
|
1679
|
-
bone:
|
|
1745
|
+
bone: group.rearCarrierBone,
|
|
1680
1746
|
property: prop,
|
|
1681
1747
|
keys: keyList.map(({ t, deg }) =>
|
|
1682
1748
|
deg === 0
|
|
@@ -1701,7 +1767,7 @@ export function buildDepth25DTurn(
|
|
|
1701
1767
|
}
|
|
1702
1768
|
if (unitBones.length > 0) {
|
|
1703
1769
|
tracks.push({
|
|
1704
|
-
group:
|
|
1770
|
+
group: group.unitGroupName,
|
|
1705
1771
|
property: prop,
|
|
1706
1772
|
keys: keyList.map(({ t, deg }) =>
|
|
1707
1773
|
deg === 0
|
|
@@ -1762,11 +1828,17 @@ export function buildDepth25DTurn(
|
|
|
1762
1828
|
};
|
|
1763
1829
|
};
|
|
1764
1830
|
|
|
1765
|
-
buildAxisAnim('yaw', yawMax);
|
|
1766
|
-
buildAxisAnim('pitch', pitchMax);
|
|
1767
|
-
|
|
1768
1831
|
rig.constraints ??= [];
|
|
1769
1832
|
const upsertSlider = (name: string, animName: string, dialBone: string, maxDeg: number): void => {
|
|
1833
|
+
const colliding = rig.constraints?.find((c) => c.type === 'slider' && c.name === name && c.animation !== animName);
|
|
1834
|
+
if (colliding !== undefined) {
|
|
1835
|
+
problems.push({
|
|
1836
|
+
code: 'CONFIG_TURN_SLIDER_NAME_FREE',
|
|
1837
|
+
object: `${group.fieldPrefix}.slider`,
|
|
1838
|
+
detail: `is "${name}", which collides with an existing slider constraint "${name}"; choose a distinct slider name`,
|
|
1839
|
+
});
|
|
1840
|
+
return;
|
|
1841
|
+
}
|
|
1770
1842
|
const existing = rig.constraints?.find((c) => c.type === 'slider' && c.animation === animName);
|
|
1771
1843
|
if (existing !== undefined) {
|
|
1772
1844
|
existing.bone = dialBone;
|
|
@@ -1795,6 +1867,83 @@ export function buildDepth25DTurn(
|
|
|
1795
1867
|
});
|
|
1796
1868
|
}
|
|
1797
1869
|
};
|
|
1798
|
-
|
|
1799
|
-
|
|
1870
|
+
|
|
1871
|
+
for (const axis of group.axes) {
|
|
1872
|
+
buildAxisAnim(axis.kind, axis.animName, axis.maxDeg);
|
|
1873
|
+
upsertSlider(axis.sliderName, axis.animName, axis.dialBone, axis.maxDeg);
|
|
1874
|
+
}
|
|
1875
|
+
}
|
|
1876
|
+
|
|
1877
|
+
/**
|
|
1878
|
+
* Issues #763 & #787: build the 2.5D head-turn (`turn`, `tilt`) and optional
|
|
1879
|
+
* body-turn (`body_turn`) animations and slider constraints using Core's native
|
|
1880
|
+
* `derive` and `deform` `transform` (`depth: true, narrowing: false`).
|
|
1881
|
+
*/
|
|
1882
|
+
export function buildDepth25DTurn(
|
|
1883
|
+
rig: {
|
|
1884
|
+
bones: Array<{ name: string; parent?: string; x: number; y: number; rotation?: number; length?: number }>;
|
|
1885
|
+
slots: Array<{ name: string; bone: string; attachment: string | null }>;
|
|
1886
|
+
constraints?: Array<Record<string, unknown>>;
|
|
1887
|
+
},
|
|
1888
|
+
motion: {
|
|
1889
|
+
groups?: Record<string, string[]>;
|
|
1890
|
+
animations: Record<string, unknown>;
|
|
1891
|
+
},
|
|
1892
|
+
opts: Depth25DTurnOptions,
|
|
1893
|
+
): void {
|
|
1894
|
+
const problems: Problem[] = [];
|
|
1895
|
+
const { yaw: yawMax, pitch: pitchMax } = resolveTurnBands(opts.turn);
|
|
1896
|
+
|
|
1897
|
+
if (opts.turn.roles !== undefined) {
|
|
1898
|
+
buildDepth25DTurnGroup(
|
|
1899
|
+
rig,
|
|
1900
|
+
motion,
|
|
1901
|
+
opts,
|
|
1902
|
+
{
|
|
1903
|
+
fieldPrefix: 'config.turn',
|
|
1904
|
+
roles: opts.turn.roles,
|
|
1905
|
+
pivot: opts.turn.pivot ?? DEFAULT_TURN_PIVOT_25D,
|
|
1906
|
+
counter: opts.turn.counter ?? DEFAULT_TURN_COUNTER_25D,
|
|
1907
|
+
unitDepths: opts.turn.unitDepths,
|
|
1908
|
+
carrierBone: FACESHIFT_BONE,
|
|
1909
|
+
rearCarrierBone: REAR_SHIFT_BONE,
|
|
1910
|
+
unitGroupName: 'turn_units',
|
|
1911
|
+
useEyeLandmarksForZRef: true,
|
|
1912
|
+
checkEarBehindCheek: true,
|
|
1913
|
+
axes: [
|
|
1914
|
+
{ kind: 'yaw', animName: 'turn', sliderName: 'yaw', dialBone: YAW_DIAL_BONE, maxDeg: yawMax },
|
|
1915
|
+
{ kind: 'pitch', animName: 'tilt', sliderName: 'pitch', dialBone: PITCH_DIAL_BONE, maxDeg: pitchMax },
|
|
1916
|
+
],
|
|
1917
|
+
},
|
|
1918
|
+
problems,
|
|
1919
|
+
);
|
|
1920
|
+
}
|
|
1921
|
+
|
|
1922
|
+
if (opts.turn.body !== undefined) {
|
|
1923
|
+
const body = opts.turn.body;
|
|
1924
|
+
const bodySlider = typeof body.slider === 'string' && body.slider.trim().length > 0 ? body.slider : BODY_YAW_DIAL_BONE;
|
|
1925
|
+
buildDepth25DTurnGroup(
|
|
1926
|
+
rig,
|
|
1927
|
+
motion,
|
|
1928
|
+
opts,
|
|
1929
|
+
{
|
|
1930
|
+
fieldPrefix: 'config.turn.body',
|
|
1931
|
+
roles: body.roles,
|
|
1932
|
+
pivot: body.pivot ?? opts.turn.pivot ?? DEFAULT_TURN_PIVOT_25D,
|
|
1933
|
+
counter: body.counter ?? opts.turn.counter ?? DEFAULT_TURN_COUNTER_25D,
|
|
1934
|
+
unitDepths: body.unitDepths ?? opts.turn.unitDepths,
|
|
1935
|
+
carrierBone: BODYSHIFT_BONE,
|
|
1936
|
+
rearCarrierBone: BODY_REAR_SHIFT_BONE,
|
|
1937
|
+
unitGroupName: 'body_turn_units',
|
|
1938
|
+
useEyeLandmarksForZRef: false,
|
|
1939
|
+
checkEarBehindCheek: false,
|
|
1940
|
+
axes: [
|
|
1941
|
+
{ kind: 'yaw', animName: BODY_TURN_ANIM, sliderName: bodySlider, dialBone: bodySlider, maxDeg: yawMax },
|
|
1942
|
+
],
|
|
1943
|
+
},
|
|
1944
|
+
problems,
|
|
1945
|
+
);
|
|
1946
|
+
}
|
|
1947
|
+
|
|
1948
|
+
refuseIfAny(problems);
|
|
1800
1949
|
}
|