@rig-c/review 0.20.0 → 0.22.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/README.md +6 -2
- package/docs/ANIMATION_INSPECTION.md +1 -1
- package/docs/DESIGN.md +1 -1
- package/docs/PANELS.md +2 -2
- package/package.json +1 -1
- package/src/animation-ops.ts +522 -38
- package/src/applied-context.ts +6 -2
- package/src/compare-html.ts +5 -5
- package/src/rebuild.ts +110 -11
- package/web/animation-inspection.ts +2785 -42
- package/web/compare-picked-tools.ts +445 -155
- package/web/compare.css +86 -15
- package/web/compare.html +1 -1
- package/web/index.html +1 -1
- package/web/inspector-blocks.ts +22 -16
- package/web/main.ts +117 -9
- package/web/preview.ts +31 -0
- package/web/rebuild-client.ts +14 -6
- package/web/requirements-panel.ts +1 -1
- package/web/styles.css +95 -16
- package/web/workspace-preferences.ts +3 -2
- package/web/workspace-ui.ts +10 -9
package/src/applied-context.ts
CHANGED
|
@@ -149,6 +149,8 @@ export interface AppliedAnimation {
|
|
|
149
149
|
check: CheckSummary | null;
|
|
150
150
|
files: FilesDiff | null;
|
|
151
151
|
modelHash: string;
|
|
152
|
+
/** #112: the exported `rigc-environment/1` schedule Apply's check read, when "Use for readings" was on. */
|
|
153
|
+
environment?: { sha256: string; steps: number };
|
|
152
154
|
}
|
|
153
155
|
/** One producer document against the inspected one: `count` differing JSON Pointers, the first `MAX_DIFF_PATHS` listed. */
|
|
154
156
|
export interface DocumentDiff { file: ProducerDocument; count: number; paths: string[] }
|
|
@@ -293,7 +295,7 @@ export function parseAppliedContext(value: unknown): void {
|
|
|
293
295
|
return;
|
|
294
296
|
}
|
|
295
297
|
if (value.schema === APPLIED_ANIMATION_SCHEMA) {
|
|
296
|
-
const v = exact(value,
|
|
298
|
+
const v = exact(value, `animationsFrom,args,buildId,check,compiler,configHash,${Object.hasOwn(value, 'environment') ? 'environment,' : ''}files,line,modelHash,ops,opsSha256,producer,schema`, field);
|
|
297
299
|
if (![v.buildId, v.configHash, v.opsSha256, v.modelHash].every(hex)) throw new Error(`${field}: buildId, configHash, opsSha256 and modelHash are SHA-256 hex`);
|
|
298
300
|
const af = exact(v.animationsFrom, 'afterSha256,beforeSha256,path', `${field}.animationsFrom`);
|
|
299
301
|
if (typeof af.path !== 'string' || !af.path || !hex(af.beforeSha256) || !hex(af.afterSha256)) throw new Error(`${field}.animationsFrom: {path, beforeSha256, afterSha256 (SHA-256 hex)}`);
|
|
@@ -303,6 +305,7 @@ export function parseAppliedContext(value: unknown): void {
|
|
|
303
305
|
tool(v.producer, `${field}.producer`); tool(v.compiler, `${field}.compiler`); lineOrNull(v.line, `${field}.line`);
|
|
304
306
|
parseCheck(v.check, `${field}.check`);
|
|
305
307
|
parseFilesDiff(v.files, `${field}.files`);
|
|
308
|
+
if (Object.hasOwn(v, 'environment')) { const e = exact(v.environment, 'sha256,steps', `${field}.environment`); if (!hex(e.sha256) || !Number.isSafeInteger(e.steps) || (e.steps as number) < 1) throw new Error(`${field}.environment: {sha256 (SHA-256 hex), steps ≥ 1}`); }
|
|
306
309
|
return;
|
|
307
310
|
}
|
|
308
311
|
throw new Error(`${field}.schema: expected ${APPLIED_REGIONS_SCHEMA}, ${APPLIED_PATCH_SCHEMA} (patch ${CONFIG_PATCH_SCHEMA}), ${APPLIED_DELTA_SCHEMA} (mesh-edit delta), ${APPLIED_RETARGET_SCHEMA} (retarget) or ${APPLIED_ANIMATION_SCHEMA} (animation)`);
|
|
@@ -328,8 +331,9 @@ export function appliedSummary(value: unknown): string | null {
|
|
|
328
331
|
const a = value as AppliedAnimation;
|
|
329
332
|
const anims = [...new Set(a.ops.map(o => o.animation))];
|
|
330
333
|
const check = a.check ? `check ${a.check.pass === null ? 'not read' : a.check.pass ? 'PASS' : 'FAIL'}` : 'check not run';
|
|
334
|
+
const env = a.environment ? ` under the exported world (${a.environment.steps} step(s), sha256 ${a.environment.sha256.slice(0, 16)})` : '';
|
|
331
335
|
const diff = a.files ? ` · ${filesDiffText(a.files)}` : '';
|
|
332
|
-
return `animation ${a.opsSha256.slice(0, 12)}… (${a.ops.length} op(s) on ${anims.join(', ')}; ${a.animationsFrom.path} ${a.animationsFrom.beforeSha256.slice(0, 12)}… → ${a.animationsFrom.afterSha256.slice(0, 12)}…) with ${producer.package} ${producer.version} · ${check}${diff} · model ${model}…`;
|
|
336
|
+
return `animation ${a.opsSha256.slice(0, 12)}… (${a.ops.length} op(s) on ${anims.join(', ')}; ${a.animationsFrom.path} ${a.animationsFrom.beforeSha256.slice(0, 12)}… → ${a.animationsFrom.afterSha256.slice(0, 12)}…) with ${producer.package} ${producer.version} · ${check}${env}${diff} · model ${model}…`;
|
|
333
337
|
}
|
|
334
338
|
const a = value as AppliedPatch, paths = a.patch.ops.map(o => `${o.op} ${o.path}`);
|
|
335
339
|
const check = a.check ? `check ${a.check.pass === null ? 'not read' : a.check.pass ? 'PASS' : 'FAIL'}` : 'check not run';
|
package/src/compare-html.ts
CHANGED
|
@@ -71,22 +71,22 @@ const REGIONS: readonly {
|
|
|
71
71
|
key: 'animateBlockRow',
|
|
72
72
|
placeholder: '<!-- shared:animate-block-row -->',
|
|
73
73
|
start: '<nav class="block-row" aria-label="Animate blocks">',
|
|
74
|
-
end: '<section id="
|
|
75
|
-
compareEnd: '<
|
|
74
|
+
end: '<section id="motion-tools">',
|
|
75
|
+
compareEnd: '<div class="compare-info">',
|
|
76
76
|
},
|
|
77
77
|
{
|
|
78
78
|
key: 'transportStrips',
|
|
79
79
|
placeholder: '<!-- shared:transport-strips -->',
|
|
80
80
|
start: '<div id="reading-ticks"',
|
|
81
81
|
end: '</section><section id="frame-controls"',
|
|
82
|
-
compareEnd: '</section><
|
|
82
|
+
compareEnd: '</section><section id="animation-inspection"',
|
|
83
83
|
},
|
|
84
84
|
{
|
|
85
85
|
key: 'animatePanels',
|
|
86
86
|
placeholder: '<!-- shared:animate-panels -->',
|
|
87
87
|
start: '<section id="motion-tools">',
|
|
88
|
-
end: '</section></div></section></main>',
|
|
89
|
-
compareEnd: '</section><section id="inspector-feedback"',
|
|
88
|
+
end: '</div></section></div></section></main>',
|
|
89
|
+
compareEnd: '</div></section><section id="inspector-feedback"',
|
|
90
90
|
},
|
|
91
91
|
];
|
|
92
92
|
|
package/src/rebuild.ts
CHANGED
|
@@ -401,7 +401,7 @@ export function parseAnimationRequest(input: unknown): AnimationRequest {
|
|
|
401
401
|
if (typeof v.animationsFromHash !== 'string' || !/^[a-f0-9]{64}$/.test(v.animationsFromHash)) bad('animationsFromHash');
|
|
402
402
|
const args = parseAnimationArgs(v.args);
|
|
403
403
|
if (!Array.isArray(v.ops)) return bad('ops must be an array');
|
|
404
|
-
if (v.ops.length > MAX_ANIMATION_OPS)
|
|
404
|
+
if (v.ops.length > MAX_ANIMATION_OPS) throw new RebuildError('ANIMATION_OPS_TOO_MANY', `ops must hold at most ${MAX_ANIMATION_OPS} entries (got ${v.ops.length})`);
|
|
405
405
|
if (v.ops.length === 0) throw new RebuildError('ANIMATION_OPS_EMPTY', 'ops must hold at least 1 operation; nothing to apply');
|
|
406
406
|
const ops = v.ops.map((op, i) => {
|
|
407
407
|
try { return parseAnimationSourceOp(op, `ops[${i}]`); }
|
|
@@ -409,9 +409,9 @@ export function parseAnimationRequest(input: unknown): AnimationRequest {
|
|
|
409
409
|
});
|
|
410
410
|
return { configHash: v.configHash as string, animationsFromHash: v.animationsFromHash as string, ops, args };
|
|
411
411
|
}
|
|
412
|
-
/** Deterministic: the package, the config bytes, the handoff animations_from bytes, the canonical ops bytes, both tool versions
|
|
413
|
-
export function animationId(input: { sourceHash: string; configHash: string; animationsFromHash: string; opsText: string; producer: string; compiler: string; args?: readonly string[] }): string {
|
|
414
|
-
return sha256(JSON.stringify([REBUILD_SCHEMA, 'animation', input.sourceHash, input.configHash, input.animationsFromHash, input.opsText, input.producer, input.compiler, ...(input.args?.length ? [input.args] : [])]));
|
|
412
|
+
/** Deterministic: the package, the config bytes, the handoff animations_from bytes, the canonical ops bytes, both tool versions, any non-default rig flags, and any exported environment schedule. No clock. */
|
|
413
|
+
export function animationId(input: { sourceHash: string; configHash: string; animationsFromHash: string; opsText: string; producer: string; compiler: string; args?: readonly string[]; environment?: string }): string {
|
|
414
|
+
return sha256(JSON.stringify([REBUILD_SCHEMA, 'animation', input.sourceHash, input.configHash, input.animationsFromHash, input.opsText, input.producer, input.compiler, ...(input.args?.length ? [input.args] : []), ...(input.environment ? ['environment', input.environment] : [])]));
|
|
415
415
|
}
|
|
416
416
|
export interface AnimationJob {
|
|
417
417
|
schema: typeof REBUILD_SCHEMA; kind: 'animation'; id: string; status: RebuildStatus; reused: boolean; op: 'rig';
|
|
@@ -422,6 +422,15 @@ export interface AnimationJob {
|
|
|
422
422
|
check: CheckSummary | null;
|
|
423
423
|
files: FilesDiff | null;
|
|
424
424
|
build: RebuildBuild | null;
|
|
425
|
+
environment?: ApplyWorld['record'];
|
|
426
|
+
}
|
|
427
|
+
export interface AnimationSourceStatus {
|
|
428
|
+
available: boolean;
|
|
429
|
+
reason: string | null;
|
|
430
|
+
path: string | null;
|
|
431
|
+
sha256: string | null;
|
|
432
|
+
text: string | null;
|
|
433
|
+
easings: Record<string, [number, number, number, number]> | null;
|
|
425
434
|
}
|
|
426
435
|
/**
|
|
427
436
|
* Deterministic: the package, the config bytes, the patch's own bytes and both tool versions. No clock. A retune-routed
|
|
@@ -721,10 +730,81 @@ export function createRebuilds(p: ReviewPackage, options: RebuildOptions) {
|
|
|
721
730
|
producer: resolved.ok ? tool(resolved.producer) : null, compiler: resolved.ok ? tool(resolved.compiler) : null,
|
|
722
731
|
// #114: what the retarget editor offers — the pose producer, the declared sequences, the rig's bones and animations.
|
|
723
732
|
retarget: await retargetStatus(inputs),
|
|
733
|
+
// #235: the handoff's motion.animations_from file (path, sha256, text) and the rig's easings table for the timeline editor.
|
|
734
|
+
animations: await animationsStatus(inputs),
|
|
724
735
|
reason,
|
|
725
736
|
running,
|
|
726
737
|
};
|
|
727
738
|
}
|
|
739
|
+
/** #235: what the keyed animation editor starts from. */
|
|
740
|
+
async function animationsStatus(inputs: ProducerInputs | null): Promise<AnimationSourceStatus> {
|
|
741
|
+
if (!inputs) {
|
|
742
|
+
return {
|
|
743
|
+
available: false,
|
|
744
|
+
reason: p.handoff ? handoffGap(p.handoff) : (p.handoffReason ?? modelingHandoffMissing(null)),
|
|
745
|
+
path: null,
|
|
746
|
+
sha256: null,
|
|
747
|
+
text: null,
|
|
748
|
+
easings: null,
|
|
749
|
+
};
|
|
750
|
+
}
|
|
751
|
+
let easings: Record<string, [number, number, number, number]> | null = null;
|
|
752
|
+
try {
|
|
753
|
+
const rigMotion = JSON.parse(await readFile(join(inputs.rig, 'motion.json'), 'utf8')) as { easings?: unknown };
|
|
754
|
+
if (rigMotion.easings && typeof rigMotion.easings === 'object' && !Array.isArray(rigMotion.easings)) {
|
|
755
|
+
easings = rigMotion.easings as Record<string, [number, number, number, number]>;
|
|
756
|
+
}
|
|
757
|
+
} catch { /* optional */ }
|
|
758
|
+
const configDoc = object(JSON.parse(inputs.configText), 'config');
|
|
759
|
+
const motion = configDoc.motion && typeof configDoc.motion === 'object' && !Array.isArray(configDoc.motion) ? configDoc.motion as Record<string, unknown> : null;
|
|
760
|
+
const relFrom = typeof motion?.animations_from === 'string' && motion.animations_from.trim() ? motion.animations_from : null;
|
|
761
|
+
if (!relFrom) {
|
|
762
|
+
return {
|
|
763
|
+
available: false,
|
|
764
|
+
reason: 'ANIMATION_SOURCE_MISSING: config.json does not declare an "animations_from" motion spec file.',
|
|
765
|
+
path: null,
|
|
766
|
+
sha256: null,
|
|
767
|
+
text: null,
|
|
768
|
+
easings,
|
|
769
|
+
};
|
|
770
|
+
}
|
|
771
|
+
let absFrom: string;
|
|
772
|
+
try { absFrom = await realpath(resolve(dirname(inputs.config), relFrom)); }
|
|
773
|
+
catch {
|
|
774
|
+
return {
|
|
775
|
+
available: false,
|
|
776
|
+
reason: `ANIMATION_SOURCE_MISSING: config motion.animations_from (${relFrom}) does not exist`,
|
|
777
|
+
path: relFrom,
|
|
778
|
+
sha256: null,
|
|
779
|
+
text: null,
|
|
780
|
+
easings,
|
|
781
|
+
};
|
|
782
|
+
}
|
|
783
|
+
const showFrom = relative(await realpath(p.root), absFrom).split(sep).join('/') || '.';
|
|
784
|
+
const handoffFile = inputs.handoff.files.find(f => f.path === showFrom);
|
|
785
|
+
if (!handoffFile) {
|
|
786
|
+
return {
|
|
787
|
+
available: false,
|
|
788
|
+
reason: `ANIMATION_SOURCE_MISSING: config motion.animations_from (${showFrom}) is missing from the handoff`,
|
|
789
|
+
path: showFrom,
|
|
790
|
+
sha256: null,
|
|
791
|
+
text: null,
|
|
792
|
+
easings,
|
|
793
|
+
};
|
|
794
|
+
}
|
|
795
|
+
const text = await readFile(absFrom, 'utf8'), hash = sha256(text);
|
|
796
|
+
if (hash !== handoffFile.sha256) {
|
|
797
|
+
return {
|
|
798
|
+
available: false,
|
|
799
|
+
reason: `REBUILD_INPUTS_CHANGED: ${showFrom} changed since the review was opened; restart review`,
|
|
800
|
+
path: showFrom,
|
|
801
|
+
sha256: hash,
|
|
802
|
+
text: null,
|
|
803
|
+
easings,
|
|
804
|
+
};
|
|
805
|
+
}
|
|
806
|
+
return { available: true, reason: null, path: showFrom, sha256: hash, text, easings };
|
|
807
|
+
}
|
|
728
808
|
/** #111: what the cloth recipe form starts from. */
|
|
729
809
|
async function clothStatus(handoff: Handoff, inputs: ProducerInputs, resolved: ReturnType<typeof resolveProducer>) {
|
|
730
810
|
const config = object(JSON.parse(inputs.configText), 'config');
|
|
@@ -1523,7 +1603,7 @@ export function createRebuilds(p: ReviewPackage, options: RebuildOptions) {
|
|
|
1523
1603
|
}
|
|
1524
1604
|
|
|
1525
1605
|
/** #235: spliced `animations_from` → `<dir>/animations.json`, `<dir>/config.json` pointing at it → `rig-parts rig` → compile → `rig-parts check`. */
|
|
1526
|
-
function executeAnimation(job: AnimationJob, dir: string, inputs: ProducerInputs, resolved: Resolved, scratchConfig: string, splicedAnimations: string): Promise<void> {
|
|
1606
|
+
function executeAnimation(job: AnimationJob, dir: string, inputs: ProducerInputs, resolved: Resolved, scratchConfig: string, splicedAnimations: string, world: ApplyWorld | null = null): Promise<void> {
|
|
1527
1607
|
const args = job.request.args ?? [], producer = resolved.producer;
|
|
1528
1608
|
return apply(job, dir, inputs, resolved, {
|
|
1529
1609
|
cmd: 'rig', spec: 'rig',
|
|
@@ -1541,17 +1621,18 @@ export function createRebuilds(p: ReviewPackage, options: RebuildOptions) {
|
|
|
1541
1621
|
}, {
|
|
1542
1622
|
diff: files => { job.files = files; },
|
|
1543
1623
|
check: (summary: CheckSummary, wallMs: number | null) => { job.wallMs.check = wallMs; job.check = summary; },
|
|
1624
|
+
world,
|
|
1544
1625
|
});
|
|
1545
1626
|
}
|
|
1546
1627
|
|
|
1547
1628
|
/**
|
|
1548
|
-
* `POST /api/rebuild` with `{animation: {configHash, animationsFromHash, ops, args?}}` (#235): applies the cumulative
|
|
1629
|
+
* `POST /api/rebuild` with `{animation: {configHash, animationsFromHash, ops, args?}, environment?}` (#235): applies the cumulative
|
|
1549
1630
|
* span-preserving ops directly to the handoff's `motion.animations_from` text (`REBUILD_ANIMATIONS_STALE` when
|
|
1550
1631
|
* `animationsFromHash` does not match the handoff file), writes `<dir>/animations.json` and `<dir>/config.json` in
|
|
1551
1632
|
* scratch, and runs `rig-parts rig` + `rigc build` + `check`. Empty or no-op ops (leaving `animations_from` equal to
|
|
1552
1633
|
* the handoff text) are refused before anything is written or run; producer refusals return by name with nothing landed.
|
|
1553
1634
|
*/
|
|
1554
|
-
async function startAnimation(input: unknown): Promise<{ status: number; body: unknown }> {
|
|
1635
|
+
async function startAnimation(input: unknown, world: ApplyWorld | null = null, rawEnvironment?: unknown): Promise<{ status: number; body: unknown }> {
|
|
1555
1636
|
const request = parseAnimationRequest(input);
|
|
1556
1637
|
assertStateOutside();
|
|
1557
1638
|
await options.unchanged();
|
|
@@ -1574,7 +1655,15 @@ export function createRebuilds(p: ReviewPackage, options: RebuildOptions) {
|
|
|
1574
1655
|
throw new RebuildError('REBUILD_ANIMATIONS_STALE', 'the animations_from file changed since the editor read it; reload');
|
|
1575
1656
|
}
|
|
1576
1657
|
|
|
1577
|
-
|
|
1658
|
+
let fallbackEasings: Record<string, [number, number, number, number]> | undefined;
|
|
1659
|
+
try {
|
|
1660
|
+
const rigMotion = JSON.parse(await readFile(join(inputs.rig, 'motion.json'), 'utf8')) as { easings?: unknown };
|
|
1661
|
+
if (rigMotion.easings && typeof rigMotion.easings === 'object' && !Array.isArray(rigMotion.easings)) {
|
|
1662
|
+
fallbackEasings = rigMotion.easings as Record<string, [number, number, number, number]>;
|
|
1663
|
+
}
|
|
1664
|
+
} catch { /* optional */ }
|
|
1665
|
+
|
|
1666
|
+
const builder = new AnimationOpBuilder(baseAnimText, fallbackEasings);
|
|
1578
1667
|
try {
|
|
1579
1668
|
for (const op of request.ops) builder.apply(op);
|
|
1580
1669
|
} catch (e) {
|
|
@@ -1594,6 +1683,10 @@ export function createRebuilds(p: ReviewPackage, options: RebuildOptions) {
|
|
|
1594
1683
|
|
|
1595
1684
|
const resolved = resolveProducer(options.starts);
|
|
1596
1685
|
if (!resolved.ok) return { status: 200, body: { status: 'refused', error: resolved.error, producerLine: resolved.error } };
|
|
1686
|
+
if (world && !versionAtLeast(resolved.producer.version, CHECK_ENVIRONMENT_SINCE)) {
|
|
1687
|
+
const error = modelingProducerTooOld(resolved.producer.version || 'unknown', CHECK_ENVIRONMENT_SINCE, 'rig-parts check --environment');
|
|
1688
|
+
return { status: 200, body: { status: 'refused', error, producerLine: error } };
|
|
1689
|
+
}
|
|
1597
1690
|
try { assertWholeRigBaseline(await settledBaseline()); } catch (e) { if (e instanceof BaselineError) throw new RebuildError(e.code, e.message.slice(e.code.length + 2)); throw e; }
|
|
1598
1691
|
|
|
1599
1692
|
const opsText = animationOpsText(effectiveOps), opsSha256 = sha256(opsText), afterSha256 = sha256(splicedAnimText);
|
|
@@ -1605,6 +1698,7 @@ export function createRebuilds(p: ReviewPackage, options: RebuildOptions) {
|
|
|
1605
1698
|
producer: `${resolved.producer.package}@${resolved.producer.version}`,
|
|
1606
1699
|
compiler: `${resolved.compiler.package}@${resolved.compiler.version}`,
|
|
1607
1700
|
args: request.args,
|
|
1701
|
+
...(world ? { environment: world.record.sha256 } : {}),
|
|
1608
1702
|
});
|
|
1609
1703
|
const current = jobs.get(id);
|
|
1610
1704
|
if (current?.status === 'running') return { status: 202, body: snapshot(current) };
|
|
@@ -1620,6 +1714,7 @@ export function createRebuilds(p: ReviewPackage, options: RebuildOptions) {
|
|
|
1620
1714
|
ops: effectiveOps,
|
|
1621
1715
|
...(request.args.length ? { args: request.args } : {}),
|
|
1622
1716
|
},
|
|
1717
|
+
...(world && rawEnvironment !== undefined ? { environment: rawEnvironment } : {}),
|
|
1623
1718
|
};
|
|
1624
1719
|
|
|
1625
1720
|
return reserve(`REBUILD_BUSY: rebuild ${id} is still running`, async () => {
|
|
@@ -1652,9 +1747,10 @@ export function createRebuilds(p: ReviewPackage, options: RebuildOptions) {
|
|
|
1652
1747
|
check: null,
|
|
1653
1748
|
files: null,
|
|
1654
1749
|
build: null,
|
|
1750
|
+
...(world ? { environment: world.record } : {}),
|
|
1655
1751
|
};
|
|
1656
1752
|
jobs.set(id, job); running = id; bodies.set(id, recordedBody);
|
|
1657
|
-
void executeAnimation(job, dir, inputs, resolved, scratchCfgText, splicedAnimText).finally(() => { if (running === id) running = null; });
|
|
1753
|
+
void executeAnimation(job, dir, inputs, resolved, scratchCfgText, splicedAnimText, world).finally(() => { if (running === id) running = null; });
|
|
1658
1754
|
return { status: 202, body: snapshot(job) };
|
|
1659
1755
|
});
|
|
1660
1756
|
}
|
|
@@ -1662,8 +1758,11 @@ export function createRebuilds(p: ReviewPackage, options: RebuildOptions) {
|
|
|
1662
1758
|
/** `POST /api/rebuild`: refusals are returned before anything is written or run. */
|
|
1663
1759
|
async function start(input: unknown): Promise<{ status: number; body: unknown }> {
|
|
1664
1760
|
if (input && typeof input === 'object' && !Array.isArray(input) && Object.hasOwn(input, 'animation')) {
|
|
1665
|
-
|
|
1666
|
-
|
|
1761
|
+
const keys = Object.keys(input).sort().join(',');
|
|
1762
|
+
if (keys !== 'animation' && keys !== 'animation,environment') bad('expected exactly {animation} or {animation, environment}');
|
|
1763
|
+
const rawEnv = Object.hasOwn(input, 'environment') ? (input as { environment: unknown }).environment : undefined;
|
|
1764
|
+
const world = rawEnv !== undefined ? parseApplyWorld(rawEnv) : null;
|
|
1765
|
+
return startAnimation((input as { animation: unknown }).animation, world, rawEnv);
|
|
1667
1766
|
}
|
|
1668
1767
|
if (input && typeof input === 'object' && !Array.isArray(input) && Object.hasOwn(input, 'retarget')) {
|
|
1669
1768
|
if (Object.keys(input).length !== 1) bad('expected exactly {retarget}');
|