@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
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
import type { BoneAdjust, ModelAssets, RigPlayer } from '@rig-c/play';
|
|
12
12
|
import type { CompareResponse } from '../src/compare.ts';
|
|
13
13
|
import type { CommentMode } from '../src/stage-comment.ts';
|
|
14
|
-
import { AnimationInspectionPanel } from './animation-inspection.ts';
|
|
14
|
+
import { AnimationInspectionPanel, type AnimationSideState } from './animation-inspection.ts';
|
|
15
|
+
import type { AnimationSourceOp } from '../src/animation-ops.ts';
|
|
15
16
|
import { partBounds, type PartExplorer } from './part-selection.ts';
|
|
16
17
|
import { bindInspectorBlocks, activeBlocksUI, restoreActiveBlocksUI, type InspectorBlocks } from './inspector-blocks.ts';
|
|
17
18
|
import { bindChestEditor, canvasToCrop, bustLabel, bustSides, LANDMARKS, landmarkInputId, rowCircle, type ChestEditor, type LandmarkKey } from './chest-editor.ts';
|
|
@@ -41,10 +42,10 @@ import { bindRetargetPanel, type PoseMap, type RetargetPanel } from './retarget-
|
|
|
41
42
|
import type { RetargetFlags } from '../src/retarget.ts';
|
|
42
43
|
import {
|
|
43
44
|
historyRow, isPatchJob, recordFor, refusedText, retargetStage, undoControl,
|
|
44
|
-
appliedRecord, deltaAppliedRecord, deltaOutcomeLine, designatedRegions, handoffText,
|
|
45
|
+
animationAppliedRecord, animationOutcomeLine, appliedRecord, deltaAppliedRecord, deltaOutcomeLine, designatedRegions, handoffText,
|
|
45
46
|
landmarksRequest, seedLandmarks, makePatch, outcomeLine, patchAppliedRecord, patchOutcomeLine,
|
|
46
47
|
pickPart, runRebuild, seedFields, stageModel, retargetAppliedRecord, retargetOutcomeLine, stripPendingAfter,
|
|
47
|
-
type AppliedHistoryView, type UndoView, type AnyJobView, type AppliedAnimation, type AppliedDelta, type AppliedPatch,
|
|
48
|
+
type AnimationJobView, type AnimationRequestBody, type AppliedHistoryView, type UndoView, type AnyJobView, type AppliedAnimation, type AppliedDelta, type AppliedPatch,
|
|
48
49
|
type AppliedRecord, type AppliedRetarget, type DeltaJobView, type DeltaRequestBody, type ConfigPatch,
|
|
49
50
|
type PatchJobView, type RebuildJobView, type RebuildRefusal, type RebuildRequestBody, type RebuildStatusView,
|
|
50
51
|
type RetargetJobView, type RetargetRequestBody, type StageChange,
|
|
@@ -101,6 +102,8 @@ interface SideBuildState {
|
|
|
101
102
|
readingsJob: ReadingsJobView | null;
|
|
102
103
|
requirementsCatalog: RequirementsCatalogView | null;
|
|
103
104
|
lastOverlay: OverlaySnapshot | null;
|
|
105
|
+
animationState: AnimationSideState | null;
|
|
106
|
+
animAdjust: BoneAdjust | null;
|
|
104
107
|
}
|
|
105
108
|
|
|
106
109
|
function emptySideState(): SideBuildState {
|
|
@@ -123,6 +126,8 @@ function emptySideState(): SideBuildState {
|
|
|
123
126
|
readingsJob: null,
|
|
124
127
|
requirementsCatalog: null,
|
|
125
128
|
lastOverlay: null,
|
|
129
|
+
animationState: null,
|
|
130
|
+
animAdjust: null,
|
|
126
131
|
};
|
|
127
132
|
}
|
|
128
133
|
|
|
@@ -406,11 +411,15 @@ export function mountComparePickedTools(host: ComparePickedToolsHost): ComparePi
|
|
|
406
411
|
const player = host.players[side];
|
|
407
412
|
if (!player) return;
|
|
408
413
|
const baseTurn = host.turnAdjustFor(side);
|
|
409
|
-
|
|
414
|
+
const activeTools = side === pickedSide ? composeAdjust(idleAdjust, dialAdjust) : null;
|
|
415
|
+
player.adjust = composeAdjust(composeAdjust(baseTurn, activeTools), sides[side].animAdjust);
|
|
410
416
|
if (player.current && !host.playing()) {
|
|
411
|
-
player.
|
|
417
|
+
player.seek(host.time());
|
|
412
418
|
player.draw();
|
|
413
419
|
host.parts()?.present(side);
|
|
420
|
+
if (side === pickedSide && sides[side].partModel) {
|
|
421
|
+
animationPanel?.capture(player, host.parts()?.frame(side));
|
|
422
|
+
}
|
|
414
423
|
host.redrawOverlays(true);
|
|
415
424
|
}
|
|
416
425
|
}
|
|
@@ -467,6 +476,9 @@ export function mountComparePickedTools(host: ComparePickedToolsHost): ComparePi
|
|
|
467
476
|
if (sides[prevSide].chestInputs !== null) {
|
|
468
477
|
sides[prevSide].chestInputs = snapshotChestInputs();
|
|
469
478
|
}
|
|
479
|
+
if (animationPanel) {
|
|
480
|
+
sides[prevSide].animationState = animationPanel.exportSideState();
|
|
481
|
+
}
|
|
470
482
|
physicsPanel?.clearPreview();
|
|
471
483
|
idleAdjust = null;
|
|
472
484
|
dialAdjust = null;
|
|
@@ -484,12 +496,6 @@ export function mountComparePickedTools(host: ComparePickedToolsHost): ComparePi
|
|
|
484
496
|
steppedLive = false;
|
|
485
497
|
if (workspaceMode !== 'compare') host.syncFeedbackSide(pickedSide);
|
|
486
498
|
applyEnvironment();
|
|
487
|
-
const nextPlayer = currentPlayer();
|
|
488
|
-
if (nextPlayer?.current && !host.playing()) {
|
|
489
|
-
nextPlayer.repose();
|
|
490
|
-
nextPlayer.draw();
|
|
491
|
-
host.parts()?.present(pickedSide);
|
|
492
|
-
}
|
|
493
499
|
syncPickedBanner();
|
|
494
500
|
moveStageHandlesToPickedSide();
|
|
495
501
|
const currentPart = host.parts()?.value();
|
|
@@ -508,13 +514,23 @@ export function mountComparePickedTools(host: ComparePickedToolsHost): ComparePi
|
|
|
508
514
|
}
|
|
509
515
|
switchingSide = true;
|
|
510
516
|
try {
|
|
517
|
+
const nextAnimState = sides[nextSide].animationState;
|
|
518
|
+
if (nextAnimState && sides[nextSide].partModel && nextAnimState.document !== sides[nextSide].partModel) {
|
|
519
|
+
nextAnimState.document = null;
|
|
520
|
+
nextAnimState.baseInspection = null;
|
|
521
|
+
}
|
|
522
|
+
animationPanel?.importSideState(nextAnimState);
|
|
511
523
|
clearChestInputs();
|
|
512
524
|
populateChestBones();
|
|
513
525
|
applySideStateToPanels();
|
|
514
526
|
updateChestMapping();
|
|
527
|
+
if (animationPanel) {
|
|
528
|
+
sides[nextSide].animationState = animationPanel.exportSideState();
|
|
529
|
+
}
|
|
515
530
|
} finally {
|
|
516
531
|
switchingSide = false;
|
|
517
532
|
}
|
|
533
|
+
setAdjust(nextSide);
|
|
518
534
|
host.redrawOverlays(true);
|
|
519
535
|
host.saveDraft();
|
|
520
536
|
}
|
|
@@ -739,7 +755,7 @@ export function mountComparePickedTools(host: ComparePickedToolsHost): ComparePi
|
|
|
739
755
|
const state = currentState();
|
|
740
756
|
if (state.inspectedDocumentReason) { physicsPanel.load({ available: false, reason: state.inspectedDocumentReason }, []); return; }
|
|
741
757
|
if (!state.inspectedDocument) return;
|
|
742
|
-
if (!state.rebuildStatus) { text('physics-panel-state', 'Reading the producer handoff…'); return; }
|
|
758
|
+
if (!state.rebuildStatus) { text('physics-panel-state', 'Reading the producer handoff…'); text('idle-tracks-state', 'Reading the producer handoff…'); return; }
|
|
743
759
|
if (!state.rebuildStatus.inputs || !state.rebuildStatus.producer) {
|
|
744
760
|
physicsPanel.load({ available: false, reason: state.rebuildStatus.reason ?? 'PHYSICS_TUNING_UNAVAILABLE: no producer handoff' }, []);
|
|
745
761
|
return;
|
|
@@ -776,6 +792,7 @@ export function mountComparePickedTools(host: ComparePickedToolsHost): ComparePi
|
|
|
776
792
|
const state = currentState();
|
|
777
793
|
const on = appliedBlockOps(state.appliedOnStage);
|
|
778
794
|
cutsPanel?.applied(on.cuts); clothPanel?.applied(on.cloth);
|
|
795
|
+
animationPanel?.reconcileStageApplied(state.appliedOnStage?.schema === 'rig-review-applied/5' ? state.appliedOnStage : null);
|
|
779
796
|
for (const block of staleReadouts(state.readoutStage, state.appliedOnStage)) {
|
|
780
797
|
(block === 'cuts' ? cutsPanel : clothPanel)?.shown(null);
|
|
781
798
|
}
|
|
@@ -843,6 +860,9 @@ export function mountComparePickedTools(host: ComparePickedToolsHost): ComparePi
|
|
|
843
860
|
cutsPanel?.load(status.inputs && status.cuts ? status.cuts.config : null, status.bones ?? [], status.inputs ? null : status.reason ?? 'CUTS_UNAVAILABLE: no producer handoff', status.cuts?.build ?? null);
|
|
844
861
|
meshPanel?.load(status.inputs ? status.meshes ?? {} : null, status.inputs ? null : status.reason ?? 'MESH_PANEL_UNAVAILABLE: no producer handoff');
|
|
845
862
|
meshPanel?.select(currentSlot);
|
|
863
|
+
animationPanel?.loadSource(status.animations ?? null, status.reason);
|
|
864
|
+
} else {
|
|
865
|
+
animationPanel?.setSourceLoading();
|
|
846
866
|
}
|
|
847
867
|
if (state.requirementsCatalog) {
|
|
848
868
|
requirementsPanel?.load(state.requirementsCatalog, state.requirementsCatalog.reason);
|
|
@@ -862,7 +882,11 @@ export function mountComparePickedTools(host: ComparePickedToolsHost): ComparePi
|
|
|
862
882
|
sides[side].rebuildStatus = await host.api<RebuildStatusView>(`${sideApiPrefix(side)}/rebuild`);
|
|
863
883
|
} catch (error) {
|
|
864
884
|
sides[side].rebuildStatus = null;
|
|
865
|
-
|
|
885
|
+
const reason = `REBUILD_STATUS_UNAVAILABLE: ${errorText(error)}`;
|
|
886
|
+
if (side === pickedSide) {
|
|
887
|
+
chestEditor?.notify(reason, true);
|
|
888
|
+
animationPanel?.loadSource(null, reason);
|
|
889
|
+
}
|
|
866
890
|
return null;
|
|
867
891
|
}
|
|
868
892
|
if (side === pickedSide) applySideStateToPanels();
|
|
@@ -1102,7 +1126,11 @@ export function mountComparePickedTools(host: ComparePickedToolsHost): ComparePi
|
|
|
1102
1126
|
|
|
1103
1127
|
async function swapPickedSide(side: Side, modelUrl: string, prefix: string, sha256: string, clipName?: string): Promise<void> {
|
|
1104
1128
|
await host.swapSideRig(side, modelUrl, prefix, sha256, clipName);
|
|
1129
|
+
setAdjust(side);
|
|
1105
1130
|
applyEnvironment();
|
|
1131
|
+
if (side === pickedSide) {
|
|
1132
|
+
refreshAnimationInspection();
|
|
1133
|
+
}
|
|
1106
1134
|
}
|
|
1107
1135
|
|
|
1108
1136
|
async function applyRebuild(): Promise<void> {
|
|
@@ -1113,60 +1141,72 @@ export function mountComparePickedTools(host: ComparePickedToolsHost): ComparePi
|
|
|
1113
1141
|
const status = state.rebuildStatus ?? await loadRebuildStatus(side);
|
|
1114
1142
|
if (!status || !status.available || !status.inputs) {
|
|
1115
1143
|
const reason = status?.reason ?? 'REBUILD_STATUS_UNAVAILABLE';
|
|
1116
|
-
chestEditor?.notify(reason, true, [reason]);
|
|
1144
|
+
if (pickedSide === side) chestEditor?.notify(reason, true, [reason]);
|
|
1145
|
+
host.message(reason, true);
|
|
1146
|
+
return;
|
|
1117
1147
|
}
|
|
1118
1148
|
let part: string, body: RebuildRequestBody;
|
|
1119
1149
|
const lines: string[] = [];
|
|
1120
1150
|
if (chestEditor?.mode() === 'landmarks') {
|
|
1121
1151
|
const request = landmarksRequest(status, chestEditor.landmarks());
|
|
1122
|
-
if ('error' in request) {
|
|
1152
|
+
if ('error' in request) {
|
|
1153
|
+
if (pickedSide === side) chestEditor.notify(request.error, true, [request.error]);
|
|
1154
|
+
host.message(request.error, true);
|
|
1155
|
+
return;
|
|
1156
|
+
}
|
|
1123
1157
|
({ part, body } = request);
|
|
1124
1158
|
} else {
|
|
1125
1159
|
const designated = designatedRegions(chestField);
|
|
1126
|
-
if ('error' in designated) { chestEditor?.notify(designated.error, true); return; }
|
|
1160
|
+
if ('error' in designated) { if (pickedSide === side) chestEditor?.notify(designated.error, true); return; }
|
|
1127
1161
|
const picked = pickPart(status, designated.regions);
|
|
1128
|
-
if (!picked) { chestEditor?.notify(`REBUILD_PART_AMBIGUOUS: the config states ${status.parts.length} contour meshes and the designated bones name none of them alone`, true); return; }
|
|
1162
|
+
if (!picked) { if (pickedSide === side) chestEditor?.notify(`REBUILD_PART_AMBIGUOUS: the config states ${status.parts.length} contour meshes and the designated bones name none of them alone`, true); return; }
|
|
1129
1163
|
part = picked; body = { part, regions: designated.regions, configHash: status.inputs.configHash };
|
|
1130
1164
|
}
|
|
1131
1165
|
rebuildBusy = true; rebuildState();
|
|
1132
|
-
chestEditor?.notify(`Rebuilding ${part} on Build ${side.toUpperCase()} with ${status.producer?.package} ${status.producer?.version}…`, false, []);
|
|
1166
|
+
if (pickedSide === side) chestEditor?.notify(`Rebuilding ${part} on Build ${side.toUpperCase()} with ${status.producer?.package} ${status.producer?.version}…`, false, []);
|
|
1133
1167
|
try {
|
|
1134
1168
|
const result = await runRebuild(body, {
|
|
1135
1169
|
post: value => host.api<RebuildJobView | RebuildRefusal>(`${sideApiPrefix(side)}/rebuild`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(value) }),
|
|
1136
1170
|
get: id => host.api<RebuildJobView>(`${sideApiPrefix(side)}/rebuild/${id}`),
|
|
1137
1171
|
sleep: ms => new Promise(resolve => setTimeout(resolve, ms)),
|
|
1138
|
-
onLine: line => { lines.push(line); chestEditor?.notify(line.trim() || '…', false, lines.slice(-6)); },
|
|
1172
|
+
onLine: line => { lines.push(line); if (pickedSide === side) chestEditor?.notify(line.trim() || '…', false, lines.slice(-6)); },
|
|
1139
1173
|
});
|
|
1140
1174
|
const outcome = outcomeLine(result);
|
|
1141
1175
|
if (!('id' in result) || result.status !== 'built' || !result.build) {
|
|
1142
|
-
chestEditor?.notify(outcome.text, true, [...lines.slice(-5), outcome.text]);
|
|
1176
|
+
if (pickedSide === side) chestEditor?.notify(outcome.text, true, [...lines.slice(-5), outcome.text]);
|
|
1143
1177
|
host.message(outcome.text, true);
|
|
1144
1178
|
return;
|
|
1145
1179
|
}
|
|
1146
1180
|
await swapPickedSide(side, new URL(host.route(result.build.modelUrl), location.href).href, host.route(`/compare-rebuild/${side}/${result.id}/`), result.build.modelHash);
|
|
1147
1181
|
state.appliedOnStage = appliedRecord(result); state.stageCheck = null; stageChanged(side, { kind: 'apply', via: 'regions' });
|
|
1148
|
-
|
|
1149
|
-
|
|
1182
|
+
if (pickedSide === side) {
|
|
1183
|
+
const draft = el<HTMLTextAreaElement>('rebuild-applied'); draft.value = JSON.stringify(state.appliedOnStage); draft.dispatchEvent(new Event('input', { bubbles: true }));
|
|
1184
|
+
chestEditor?.notify(outcome.text, false, []);
|
|
1185
|
+
} else if (state.animationState) {
|
|
1186
|
+
state.animationState.appliedOps = [];
|
|
1187
|
+
}
|
|
1188
|
+
host.message(outcome.text);
|
|
1150
1189
|
} catch (error) {
|
|
1151
|
-
chestEditor?.notify(`REBUILD_FAILED: ${errorText(error)}`, true);
|
|
1190
|
+
if (pickedSide === side) chestEditor?.notify(`REBUILD_FAILED: ${errorText(error)}`, true);
|
|
1152
1191
|
host.message(`REBUILD_FAILED: ${errorText(error)}`, true);
|
|
1153
1192
|
} finally {
|
|
1154
1193
|
rebuildBusy = false; rebuildState();
|
|
1155
1194
|
}
|
|
1156
1195
|
}
|
|
1157
1196
|
|
|
1158
|
-
async function applyPatch(patch: ConfigPatch, _world: StageWorld | null = null): Promise<PatchJobView | RebuildRefusal> {
|
|
1197
|
+
async function applyPatch(patch: ConfigPatch, _world: StageWorld | null = null, side: Side = pickedSide): Promise<PatchJobView | RebuildRefusal> {
|
|
1159
1198
|
if (rebuildBusy) return { status: 'refused', error: 'REBUILD_BUSY: an Apply is still running', producerLine: null };
|
|
1160
1199
|
const ro = host.readOnly();
|
|
1161
|
-
if (ro) { chestEditor?.notify(ro, true); return { status: 'refused', error: ro, producerLine: null }; }
|
|
1162
|
-
const
|
|
1200
|
+
if (ro) { if (pickedSide === side) chestEditor?.notify(ro, true); return { status: 'refused', error: ro, producerLine: null }; }
|
|
1201
|
+
const state = sides[side];
|
|
1163
1202
|
const lines: string[] = [];
|
|
1164
1203
|
rebuildBusy = true; rebuildState();
|
|
1165
|
-
chestEditor?.notify(`Applying patch on Build ${side.toUpperCase()} (${patch.op.cmd}, ${patch.ops.length} op(s))…`, false, []);
|
|
1204
|
+
if (pickedSide === side) chestEditor?.notify(`Applying patch on Build ${side.toUpperCase()} (${patch.op.cmd}, ${patch.ops.length} op(s))…`, false, []);
|
|
1166
1205
|
try {
|
|
1167
1206
|
const scheduled = useWorld() ? worldFor(checkAnimation(side), side) : null;
|
|
1168
1207
|
if (scheduled && 'error' in scheduled) {
|
|
1169
|
-
|
|
1208
|
+
if (pickedSide === side) chestEditor?.notify(scheduled.error, true);
|
|
1209
|
+
host.message(scheduled.error, true);
|
|
1170
1210
|
return { status: 'refused', error: scheduled.error, producerLine: scheduled.error };
|
|
1171
1211
|
}
|
|
1172
1212
|
const result = await runRebuild<{ patch: ConfigPatch; environment?: WorldExport['schedule'] }, PatchJobView>(
|
|
@@ -1175,12 +1215,12 @@ export function mountComparePickedTools(host: ComparePickedToolsHost): ComparePi
|
|
|
1175
1215
|
post: value => host.api<PatchJobView | RebuildRefusal>(`${sideApiPrefix(side)}/rebuild`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(value) }),
|
|
1176
1216
|
get: id => host.api<PatchJobView>(`${sideApiPrefix(side)}/rebuild/${id}`),
|
|
1177
1217
|
sleep: ms => new Promise(resolve => setTimeout(resolve, ms)),
|
|
1178
|
-
onLine: line => { lines.push(line); chestEditor?.notify(line.trim() || '…', false, lines.slice(-6)); },
|
|
1218
|
+
onLine: line => { lines.push(line); if (pickedSide === side) chestEditor?.notify(line.trim() || '…', false, lines.slice(-6)); },
|
|
1179
1219
|
},
|
|
1180
1220
|
);
|
|
1181
1221
|
const outcome = patchOutcomeLine(result), next = stageModel(result, { url: '', hash: state.stageModelHash ?? '' });
|
|
1182
1222
|
if (next.id === null || !('id' in result)) {
|
|
1183
|
-
chestEditor?.notify(outcome.text, true, [...lines.slice(-5), outcome.text]);
|
|
1223
|
+
if (pickedSide === side) chestEditor?.notify(outcome.text, true, [...lines.slice(-5), outcome.text]);
|
|
1184
1224
|
host.message(outcome.text, true);
|
|
1185
1225
|
return result;
|
|
1186
1226
|
}
|
|
@@ -1188,12 +1228,18 @@ export function mountComparePickedTools(host: ComparePickedToolsHost): ComparePi
|
|
|
1188
1228
|
state.appliedOnStage = patchAppliedRecord(result);
|
|
1189
1229
|
state.stageCheck = { lines: [...result.lines], check: result.check };
|
|
1190
1230
|
stageChanged(side, { kind: 'apply', via: 'patch' });
|
|
1191
|
-
|
|
1192
|
-
|
|
1231
|
+
if (pickedSide === side) {
|
|
1232
|
+
const draft = el<HTMLTextAreaElement>('rebuild-applied'); draft.value = JSON.stringify(state.appliedOnStage); draft.dispatchEvent(new Event('input', { bubbles: true }));
|
|
1233
|
+
chestEditor?.notify(outcome.text, outcome.error, []);
|
|
1234
|
+
} else if (state.animationState) {
|
|
1235
|
+
state.animationState.appliedOps = [];
|
|
1236
|
+
}
|
|
1237
|
+
host.message(outcome.text, outcome.error);
|
|
1193
1238
|
return result;
|
|
1194
1239
|
} catch (error) {
|
|
1195
1240
|
const textMsg = `REBUILD_FAILED: ${errorText(error)}`;
|
|
1196
|
-
|
|
1241
|
+
if (pickedSide === side) chestEditor?.notify(textMsg, true);
|
|
1242
|
+
host.message(textMsg, true);
|
|
1197
1243
|
return { status: 'refused', error: textMsg, producerLine: null };
|
|
1198
1244
|
} finally {
|
|
1199
1245
|
rebuildBusy = false; rebuildState();
|
|
@@ -1214,13 +1260,17 @@ export function mountComparePickedTools(host: ComparePickedToolsHost): ComparePi
|
|
|
1214
1260
|
post: value => host.api<DeltaJobView | RebuildRefusal>(`${sideApiPrefix(side)}/rebuild`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(value) }),
|
|
1215
1261
|
get: id => host.api<DeltaJobView>(`${sideApiPrefix(side)}/rebuild/${id}`),
|
|
1216
1262
|
sleep: ms => new Promise(resolve => setTimeout(resolve, ms)),
|
|
1217
|
-
onLine: textLine => line(textLine),
|
|
1263
|
+
onLine: textLine => { if (pickedSide === side) line(textLine); },
|
|
1218
1264
|
});
|
|
1219
1265
|
const outcome = deltaOutcomeLine(result), next = stageModel(result, { url: '', hash: state.stageModelHash ?? '' });
|
|
1220
1266
|
if (next.id === null || !('id' in result)) { host.message(outcome.text, true); return { built: false, text: outcome.text, error: true }; }
|
|
1221
1267
|
await swapPickedSide(side, new URL(host.route(next.url), location.href).href, host.route(`/compare-rebuild/${side}/${next.id}/`), next.hash);
|
|
1222
1268
|
state.appliedOnStage = deltaAppliedRecord(result); state.stageCheck = null; stageChanged(side, { kind: 'apply', via: 'delta' });
|
|
1223
|
-
|
|
1269
|
+
if (pickedSide === side) {
|
|
1270
|
+
const draft = el<HTMLTextAreaElement>('rebuild-applied'); draft.value = JSON.stringify(state.appliedOnStage); draft.dispatchEvent(new Event('input', { bubbles: true }));
|
|
1271
|
+
} else if (state.animationState) {
|
|
1272
|
+
state.animationState.appliedOps = [];
|
|
1273
|
+
}
|
|
1224
1274
|
host.message(outcome.text);
|
|
1225
1275
|
return { built: true, text: outcome.text, error: false };
|
|
1226
1276
|
} catch (error) {
|
|
@@ -1237,44 +1287,62 @@ export function mountComparePickedTools(host: ComparePickedToolsHost): ComparePi
|
|
|
1237
1287
|
if (ro) { retargetPanel?.status(ro, true); return null; }
|
|
1238
1288
|
const side = pickedSide, state = sides[side];
|
|
1239
1289
|
const status = state.rebuildStatus ?? await loadRebuildStatus(side);
|
|
1240
|
-
if (!status?.inputs) { retargetPanel?.status(status?.reason ?? 'REBUILD_STATUS_UNAVAILABLE', true); return null; }
|
|
1290
|
+
if (!status?.inputs) { if (pickedSide === side) retargetPanel?.status(status?.reason ?? 'REBUILD_STATUS_UNAVAILABLE', true); return null; }
|
|
1241
1291
|
const request: RetargetRequestBody = { retarget: { ...body, configHash: status.inputs.configHash } };
|
|
1242
|
-
rebuildBusy = true; rebuildState();
|
|
1243
|
-
|
|
1292
|
+
rebuildBusy = true; rebuildState();
|
|
1293
|
+
if (pickedSide === side) {
|
|
1294
|
+
retargetPanel?.busy(true); retargetPanel?.result(null);
|
|
1295
|
+
retargetPanel?.status(`Retargeting ${body.sequence} as "${body.flags.animation}" on Build ${side.toUpperCase()}…`, false);
|
|
1296
|
+
}
|
|
1244
1297
|
try {
|
|
1245
1298
|
const result = await runRebuild<RetargetRequestBody, RetargetJobView>(request, {
|
|
1246
1299
|
post: value => host.api<RetargetJobView | RebuildRefusal>(`${sideApiPrefix(side)}/rebuild`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(value) }),
|
|
1247
1300
|
get: id => host.api<RetargetJobView>(`${sideApiPrefix(side)}/rebuild/${id}`),
|
|
1248
1301
|
sleep: ms => new Promise(resolve => setTimeout(resolve, ms)),
|
|
1249
|
-
onLine: textLine => retargetPanel?.line(textLine),
|
|
1302
|
+
onLine: textLine => { if (pickedSide === side) retargetPanel?.line(textLine); },
|
|
1250
1303
|
});
|
|
1251
1304
|
const outcome = retargetOutcomeLine(result), next = stageModel(result, { url: '', hash: state.stageModelHash ?? '' });
|
|
1252
|
-
|
|
1305
|
+
if (pickedSide === side) {
|
|
1306
|
+
retargetPanel?.result(result); retargetPanel?.status(outcome.text, outcome.error);
|
|
1307
|
+
}
|
|
1253
1308
|
if (next.id === null || !('id' in result)) { host.message(outcome.text, true); return result; }
|
|
1254
1309
|
await swapPickedSide(side, new URL(host.route(next.url), location.href).href, host.route(`/compare-rebuild/${side}/${next.id}/`), next.hash, result.request.record.flags.animation);
|
|
1255
1310
|
state.appliedOnStage = retargetAppliedRecord(result); state.stageCheck = null; stageChanged(side, { kind: 'apply', via: 'retarget' });
|
|
1256
|
-
|
|
1311
|
+
if (pickedSide === side) {
|
|
1312
|
+
const draft = el<HTMLTextAreaElement>('rebuild-applied'); draft.value = JSON.stringify(state.appliedOnStage); draft.dispatchEvent(new Event('input', { bubbles: true }));
|
|
1313
|
+
} else if (state.animationState) {
|
|
1314
|
+
state.animationState.appliedOps = [];
|
|
1315
|
+
}
|
|
1257
1316
|
host.message(outcome.text, outcome.error);
|
|
1258
1317
|
return result;
|
|
1259
1318
|
} catch (error) {
|
|
1260
|
-
const textMsg = `REBUILD_FAILED: ${errorText(error)}`;
|
|
1319
|
+
const textMsg = `REBUILD_FAILED: ${errorText(error)}`;
|
|
1320
|
+
if (pickedSide === side) retargetPanel?.status(textMsg, true);
|
|
1321
|
+
host.message(textMsg, true);
|
|
1261
1322
|
return { status: 'refused', error: textMsg, producerLine: null };
|
|
1262
1323
|
} finally {
|
|
1263
1324
|
rebuildBusy = false; rebuildState(); retargetPanel?.busy(false);
|
|
1264
1325
|
}
|
|
1265
1326
|
}
|
|
1266
1327
|
|
|
1267
|
-
async function resetRebuild(_world: StageWorld | null = null): Promise<void> {
|
|
1268
|
-
const
|
|
1328
|
+
async function resetRebuild(_world: StageWorld | null = null, side: Side = pickedSide): Promise<void> {
|
|
1329
|
+
const state = sides[side];
|
|
1269
1330
|
if (rebuildBusy || (!state.appliedOnStage && !state.stripPending) || !state.inspectedModel) return;
|
|
1270
1331
|
rebuildBusy = true; rebuildState();
|
|
1271
1332
|
try {
|
|
1272
1333
|
await swapPickedSide(side, state.inspectedModel.url, state.inspectedModel.prefix, state.inspectedModel.sha256);
|
|
1273
1334
|
state.appliedOnStage = null; state.stageCheck = null; stageChanged(side, { kind: 'reset' });
|
|
1274
|
-
|
|
1335
|
+
if (pickedSide === side) {
|
|
1336
|
+
animationPanel?.reconcileStageApplied(null);
|
|
1337
|
+
if (animationPanel) state.animationState = animationPanel.exportSideState();
|
|
1338
|
+
const draft = el<HTMLTextAreaElement>('rebuild-applied'); draft.value = ''; draft.dispatchEvent(new Event('input', { bubbles: true }));
|
|
1339
|
+
chestEditor?.notify(`Reset: Build ${side.toUpperCase()} is back on its inspected build.`, false);
|
|
1340
|
+
} else if (state.animationState) {
|
|
1341
|
+
state.animationState.appliedOps = [];
|
|
1342
|
+
}
|
|
1275
1343
|
host.message(`Reset Build ${side.toUpperCase()} to its inspected build.`);
|
|
1276
1344
|
} catch (error) {
|
|
1277
|
-
chestEditor?.notify(`REBUILD_RESET_FAILED: ${errorText(error)}`, true);
|
|
1345
|
+
if (pickedSide === side) chestEditor?.notify(`REBUILD_RESET_FAILED: ${errorText(error)}`, true);
|
|
1278
1346
|
} finally {
|
|
1279
1347
|
rebuildBusy = false; rebuildState();
|
|
1280
1348
|
}
|
|
@@ -1296,15 +1364,23 @@ export function mountComparePickedTools(host: ComparePickedToolsHost): ComparePi
|
|
|
1296
1364
|
while (job.status === 'running') {
|
|
1297
1365
|
await new Promise(resolve => setTimeout(resolve, 700));
|
|
1298
1366
|
job = await host.api<AnyJobView>(`${sideApiPrefix(side)}/rebuild/${job.id}`);
|
|
1299
|
-
|
|
1367
|
+
if (pickedSide === side) {
|
|
1368
|
+
for (; seen < job.lines.length; seen++) appliedStatus(job.lines[seen]!.trim() || '…');
|
|
1369
|
+
}
|
|
1300
1370
|
}
|
|
1301
1371
|
if (job.status !== 'built') {
|
|
1302
|
-
const textMsg = refusedText(job);
|
|
1372
|
+
const textMsg = refusedText(job);
|
|
1373
|
+
if (pickedSide === side) appliedStatus(textMsg, true);
|
|
1374
|
+
host.message(textMsg, true);
|
|
1303
1375
|
return { status: 'refused', error: textMsg, producerLine: job.producerLine };
|
|
1304
1376
|
}
|
|
1305
1377
|
result = { status: 'built', undone, job, history: await host.api<AppliedHistoryView>(`${sideApiPrefix(side)}/rebuild/history`) };
|
|
1306
1378
|
}
|
|
1307
|
-
if (result.status === 'refused') {
|
|
1379
|
+
if (result.status === 'refused') {
|
|
1380
|
+
if (pickedSide === side) appliedStatus(result.error, true);
|
|
1381
|
+
host.message(result.error, true);
|
|
1382
|
+
return result;
|
|
1383
|
+
}
|
|
1308
1384
|
let ops: PatchOp[] | null = null;
|
|
1309
1385
|
if (result.status === 'inspected') {
|
|
1310
1386
|
await swapPickedSide(side, state.inspectedModel.url, state.inspectedModel.prefix, state.inspectedModel.sha256);
|
|
@@ -1317,16 +1393,27 @@ export function mountComparePickedTools(host: ComparePickedToolsHost): ComparePi
|
|
|
1317
1393
|
if ((job as PatchJobView).kind === 'patch') ops = (job as PatchJobView).request.patch.ops;
|
|
1318
1394
|
}
|
|
1319
1395
|
stageChanged(side, { kind: 'undo' });
|
|
1320
|
-
physicsPanel?.applied(ops); idlePanel?.applied(ops); rigFieldsPanel?.applied(ops); bonesPanel?.applied(ops);
|
|
1321
|
-
const restored = result.status === 'built' && isPatchJob(result.job) ? result.job : null, block = recordBlock(state.appliedOnStage);
|
|
1322
|
-
cutsPanel?.shown(block === 'cuts' ? restored : null); clothPanel?.shown(block === 'cloth' ? restored : null);
|
|
1323
|
-
const draft = el<HTMLTextAreaElement>('rebuild-applied'); draft.value = state.appliedOnStage ? JSON.stringify(state.appliedOnStage) : ''; draft.dispatchEvent(new Event('input', { bubbles: true }));
|
|
1324
1396
|
state.appliedHistory = result.history;
|
|
1325
1397
|
const textMsg = `Undid ${result.undone.slice(0, 12)}… on Build ${side.toUpperCase()} · ${result.history.depth} applied record(s) left`;
|
|
1326
|
-
|
|
1398
|
+
if (pickedSide === side) {
|
|
1399
|
+
physicsPanel?.applied(ops); idlePanel?.applied(ops); rigFieldsPanel?.applied(ops); bonesPanel?.applied(ops);
|
|
1400
|
+
animationPanel?.reconcileStageApplied(state.appliedOnStage?.schema === 'rig-review-applied/5' ? state.appliedOnStage : null);
|
|
1401
|
+
if (animationPanel) state.animationState = animationPanel.exportSideState();
|
|
1402
|
+
const restored = result.status === 'built' && isPatchJob(result.job) ? result.job : null, block = recordBlock(state.appliedOnStage);
|
|
1403
|
+
cutsPanel?.shown(block === 'cuts' ? restored : null); clothPanel?.shown(block === 'cloth' ? restored : null);
|
|
1404
|
+
const draft = el<HTMLTextAreaElement>('rebuild-applied'); draft.value = state.appliedOnStage ? JSON.stringify(state.appliedOnStage) : ''; draft.dispatchEvent(new Event('input', { bubbles: true }));
|
|
1405
|
+
appliedStatus(textMsg);
|
|
1406
|
+
} else if (state.animationState) {
|
|
1407
|
+
state.animationState.appliedOps = state.appliedOnStage?.schema === 'rig-review-applied/5'
|
|
1408
|
+
? state.appliedOnStage.ops.map(o => structuredClone(o))
|
|
1409
|
+
: [];
|
|
1410
|
+
}
|
|
1411
|
+
host.message(textMsg); host.redrawOverlays(true);
|
|
1327
1412
|
return result;
|
|
1328
1413
|
} catch (error) {
|
|
1329
|
-
const textMsg = `UNDO_FAILED: ${errorText(error)}`;
|
|
1414
|
+
const textMsg = `UNDO_FAILED: ${errorText(error)}`;
|
|
1415
|
+
if (pickedSide === side) appliedStatus(textMsg, true);
|
|
1416
|
+
host.message(textMsg, true);
|
|
1330
1417
|
return { status: 'refused', error: textMsg, producerLine: null };
|
|
1331
1418
|
} finally {
|
|
1332
1419
|
rebuildBusy = false; rebuildState();
|
|
@@ -1351,17 +1438,18 @@ export function mountComparePickedTools(host: ComparePickedToolsHost): ComparePi
|
|
|
1351
1438
|
const side = pickedSide, state = sides[side];
|
|
1352
1439
|
const status = state.rebuildStatus ?? await loadRebuildStatus(side);
|
|
1353
1440
|
const patch = status && ops.length ? makePatch(status, ops, { cmd: 'rig' }) : null;
|
|
1354
|
-
if (!patch) { const reason = !ops.length ? 'PHYSICS_NOTHING_PENDING: no pending ops' : status?.reason ?? 'REBUILD_STATUS_UNAVAILABLE'; physicsPanel?.status(reason, true); return null; }
|
|
1355
|
-
physicsPanel?.clearPreview();
|
|
1441
|
+
if (!patch) { const reason = !ops.length ? 'PHYSICS_NOTHING_PENDING: no pending ops' : status?.reason ?? 'REBUILD_STATUS_UNAVAILABLE'; if (pickedSide === side) physicsPanel?.status(reason, true); return null; }
|
|
1442
|
+
if (pickedSide === side) physicsPanel?.clearPreview();
|
|
1356
1443
|
const world = stageWorld(), before = state.stageCheck;
|
|
1357
|
-
physicsPanel?.busy(true); physicsPanel?.status(`Applying ${ops.length} op(s) on Build ${side.toUpperCase()}…`, false);
|
|
1444
|
+
if (pickedSide === side) { physicsPanel?.busy(true); physicsPanel?.status(`Applying ${ops.length} op(s) on Build ${side.toUpperCase()}…`, false); }
|
|
1358
1445
|
try {
|
|
1359
|
-
const result = await applyPatch(patch, world);
|
|
1360
|
-
const outcome = patchOutcomeLine(result);
|
|
1446
|
+
const result = await applyPatch(patch, world, side);
|
|
1447
|
+
const outcome = patchOutcomeLine(result);
|
|
1448
|
+
if (pickedSide === side) physicsPanel?.status(outcome.text, outcome.error);
|
|
1361
1449
|
if ('id' in result && result.status === 'built') {
|
|
1362
|
-
physicsPanel?.applied(result.request.patch.ops);
|
|
1450
|
+
if (pickedSide === side) physicsPanel?.applied(result.request.patch.ops);
|
|
1363
1451
|
const after = { lines: [...result.lines], check: result.check };
|
|
1364
|
-
const show = () => physicsPanel?.readout(readoutRows(before, before ? null : inspectedCheckView(side), after));
|
|
1452
|
+
const show = () => { if (pickedSide === side) physicsPanel?.readout(readoutRows(before, before ? null : inspectedCheckView(side), after)); };
|
|
1365
1453
|
show(); if (!before) void followInspectedCheck(show, side);
|
|
1366
1454
|
}
|
|
1367
1455
|
return result;
|
|
@@ -1369,25 +1457,27 @@ export function mountComparePickedTools(host: ComparePickedToolsHost): ComparePi
|
|
|
1369
1457
|
}
|
|
1370
1458
|
|
|
1371
1459
|
async function resetPhysicsBuild(): Promise<void> {
|
|
1460
|
+
const side = pickedSide, state = sides[side];
|
|
1372
1461
|
physicsPanel?.clear(); physicsPanel?.applied(null); physicsPanel?.readout([]);
|
|
1373
|
-
if (
|
|
1374
|
-
physicsPanel?.status('Reset: the inspected build is on the stage; no pending ops.', false);
|
|
1462
|
+
if (state.appliedOnStage) { physicsPanel?.busy(true); try { await resetRebuild(stageWorld(), side); } finally { physicsPanel?.busy(false); } }
|
|
1463
|
+
if (pickedSide === side) physicsPanel?.status('Reset: the inspected build is on the stage; no pending ops.', false);
|
|
1375
1464
|
}
|
|
1376
1465
|
|
|
1377
1466
|
async function applyIdle(ops: PatchOp[], keys: 'ctl' | 'direct' | null): Promise<PatchJobView | RebuildRefusal | null> {
|
|
1378
1467
|
const side = pickedSide, state = sides[side];
|
|
1379
1468
|
const status = state.rebuildStatus ?? await loadRebuildStatus(side);
|
|
1380
1469
|
const patch = status && ops.length ? makePatch(status, ops, { cmd: 'rig', args: keys ? ['--idle-keys', keys] : [] }) : null;
|
|
1381
|
-
if (!patch) { const reason = !ops.length ? 'IDLE_NOTHING_PENDING: no pending ops' : status?.reason ?? 'REBUILD_STATUS_UNAVAILABLE'; idlePanel?.status(reason, true); return null; }
|
|
1470
|
+
if (!patch) { const reason = !ops.length ? 'IDLE_NOTHING_PENDING: no pending ops' : status?.reason ?? 'REBUILD_STATUS_UNAVAILABLE'; if (pickedSide === side) idlePanel?.status(reason, true); return null; }
|
|
1382
1471
|
const world = stageWorld(), before = state.stageCheck;
|
|
1383
|
-
idlePanel?.busy(true); idlePanel?.status(`Applying ${ops.length} op(s) on Build ${side.toUpperCase()}…`, false);
|
|
1472
|
+
if (pickedSide === side) { idlePanel?.busy(true); idlePanel?.status(`Applying ${ops.length} op(s) on Build ${side.toUpperCase()}…`, false); }
|
|
1384
1473
|
try {
|
|
1385
|
-
const result = await applyPatch(patch, world);
|
|
1386
|
-
const outcome = patchOutcomeLine(result);
|
|
1474
|
+
const result = await applyPatch(patch, world, side);
|
|
1475
|
+
const outcome = patchOutcomeLine(result);
|
|
1476
|
+
if (pickedSide === side) idlePanel?.status(outcome.text, outcome.error);
|
|
1387
1477
|
if ('id' in result && result.status === 'built') {
|
|
1388
|
-
idlePanel?.applied(result.request.patch.ops);
|
|
1478
|
+
if (pickedSide === side) idlePanel?.applied(result.request.patch.ops);
|
|
1389
1479
|
const after = { lines: [...result.lines], check: result.check };
|
|
1390
|
-
const show = () => idlePanel?.readout(readoutRows(before, before ? null : inspectedCheckView(side), after, IDLE_READOUT_BARS));
|
|
1480
|
+
const show = () => { if (pickedSide === side) idlePanel?.readout(readoutRows(before, before ? null : inspectedCheckView(side), after, IDLE_READOUT_BARS)); };
|
|
1391
1481
|
show(); if (!before) void followInspectedCheck(show, side);
|
|
1392
1482
|
}
|
|
1393
1483
|
return result;
|
|
@@ -1395,9 +1485,122 @@ export function mountComparePickedTools(host: ComparePickedToolsHost): ComparePi
|
|
|
1395
1485
|
}
|
|
1396
1486
|
|
|
1397
1487
|
async function resetIdleBuild(): Promise<void> {
|
|
1488
|
+
const side = pickedSide, state = sides[side];
|
|
1398
1489
|
idlePanel?.clear(); idlePanel?.applied(null); idlePanel?.readout([]);
|
|
1399
|
-
if (
|
|
1400
|
-
idlePanel?.status('Reset: the inspected build is on the stage; no pending ops; the preview is cleared.', false);
|
|
1490
|
+
if (state.appliedOnStage) { idlePanel?.busy(true); try { await resetRebuild(stageWorld(), side); } finally { idlePanel?.busy(false); } }
|
|
1491
|
+
if (pickedSide === side) idlePanel?.status('Reset: the inspected build is on the stage; no pending ops; the preview is cleared.', false);
|
|
1492
|
+
}
|
|
1493
|
+
|
|
1494
|
+
async function applyAnimation(ops: readonly AnimationSourceOp[]): Promise<AnimationJobView | RebuildRefusal | null> {
|
|
1495
|
+
if (rebuildBusy) { animationPanel?.setEditorStatus('REBUILD_BUSY: an Apply is still running', true); return null; }
|
|
1496
|
+
const ro = host.readOnly();
|
|
1497
|
+
if (ro) { animationPanel?.setEditorStatus(ro, true); return null; }
|
|
1498
|
+
if (!ops.length) { animationPanel?.setEditorStatus('ANIMATION_OPS_EMPTY: no pending animation ops to apply', true); return null; }
|
|
1499
|
+
const side = pickedSide, state = sides[side];
|
|
1500
|
+
const status = state.rebuildStatus ?? await loadRebuildStatus(side);
|
|
1501
|
+
if (!status?.inputs) {
|
|
1502
|
+
const r = status?.reason ?? 'REBUILD_STATUS_UNAVAILABLE';
|
|
1503
|
+
if (pickedSide === side) animationPanel?.setEditorStatus(r, true);
|
|
1504
|
+
return null;
|
|
1505
|
+
}
|
|
1506
|
+
const animSource = status.animations;
|
|
1507
|
+
if (!animSource?.available || !animSource.sha256) {
|
|
1508
|
+
const r = animSource?.reason ?? 'ANIMATION_SOURCE_MISSING: config.json does not declare an "animations_from" motion spec file.';
|
|
1509
|
+
if (pickedSide === side) animationPanel?.setEditorStatus(r, true);
|
|
1510
|
+
return null;
|
|
1511
|
+
}
|
|
1512
|
+
const scheduled = useWorld() ? worldFor(checkAnimation(side), side) : null;
|
|
1513
|
+
if (scheduled && 'error' in scheduled) {
|
|
1514
|
+
if (pickedSide === side) animationPanel?.setEditorStatus(scheduled.error, true);
|
|
1515
|
+
host.message(scheduled.error, true);
|
|
1516
|
+
return { status: 'refused', error: scheduled.error, producerLine: scheduled.error };
|
|
1517
|
+
}
|
|
1518
|
+
const keying = status.idle?.keying, keys = keying && 'keys' in keying ? keying.keys : null;
|
|
1519
|
+
const request: AnimationRequestBody = {
|
|
1520
|
+
animation: {
|
|
1521
|
+
configHash: status.inputs.configHash,
|
|
1522
|
+
animationsFromHash: animSource.sha256,
|
|
1523
|
+
ops: [...ops],
|
|
1524
|
+
...(keys ? { args: ['--idle-keys', keys] } : {}),
|
|
1525
|
+
},
|
|
1526
|
+
...(scheduled ? { environment: scheduled.schedule } : {}),
|
|
1527
|
+
};
|
|
1528
|
+
rebuildBusy = true; rebuildState();
|
|
1529
|
+
if (pickedSide === side) {
|
|
1530
|
+
animationPanel?.busy(true);
|
|
1531
|
+
animationPanel?.setEditorStatus(`Applying ${ops.length} animation op(s) on Build ${side.toUpperCase()} (${animSource.path ?? 'animations_from'}: rig-parts rig → rigc build → rig-parts check)…`, false);
|
|
1532
|
+
}
|
|
1533
|
+
try {
|
|
1534
|
+
const result = await runRebuild<AnimationRequestBody, AnimationJobView>(request, {
|
|
1535
|
+
post: value => host.api<AnimationJobView | RebuildRefusal>(`${sideApiPrefix(side)}/rebuild`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(value) }),
|
|
1536
|
+
get: id => host.api<AnimationJobView>(`${sideApiPrefix(side)}/rebuild/${id}`),
|
|
1537
|
+
sleep: ms => new Promise(resolve => setTimeout(resolve, ms)),
|
|
1538
|
+
onLine: line => { if (pickedSide === side) animationPanel?.setEditorStatus(line.trim() || '…', false); },
|
|
1539
|
+
});
|
|
1540
|
+
const outcome = animationOutcomeLine(result), next = stageModel(result, { url: '', hash: state.stageModelHash ?? '' });
|
|
1541
|
+
if (next.id === null || !('id' in result)) {
|
|
1542
|
+
if (pickedSide === side) animationPanel?.setEditorStatus(outcome.text, true);
|
|
1543
|
+
host.message(outcome.text, true);
|
|
1544
|
+
return result;
|
|
1545
|
+
}
|
|
1546
|
+
if (pickedSide === side) {
|
|
1547
|
+
animationPanel?.markApplied(ops, outcome.text, outcome.error);
|
|
1548
|
+
}
|
|
1549
|
+
await swapPickedSide(side, new URL(host.route(next.url), location.href).href, host.route(`/compare-rebuild/${side}/${next.id}/`), next.hash);
|
|
1550
|
+
state.appliedOnStage = animationAppliedRecord(result);
|
|
1551
|
+
state.stageCheck = { lines: [...result.lines], check: result.check };
|
|
1552
|
+
stageChanged(side, { kind: 'apply', via: 'animation' });
|
|
1553
|
+
if (pickedSide === side) {
|
|
1554
|
+
const draft = el<HTMLTextAreaElement>('rebuild-applied');
|
|
1555
|
+
draft.value = JSON.stringify(state.appliedOnStage);
|
|
1556
|
+
draft.dispatchEvent(new Event('input', { bubbles: true }));
|
|
1557
|
+
animationPanel?.setEditorStatus(outcome.text, outcome.error);
|
|
1558
|
+
state.animationState = animationPanel?.exportSideState() ?? state.animationState;
|
|
1559
|
+
} else if (state.animationState) {
|
|
1560
|
+
state.animationState.appliedOps = ops.map(o => structuredClone(o));
|
|
1561
|
+
state.animationState.editorStatus = { text: outcome.text, error: outcome.error };
|
|
1562
|
+
}
|
|
1563
|
+
host.message(outcome.text, outcome.error);
|
|
1564
|
+
return result;
|
|
1565
|
+
} catch (error) {
|
|
1566
|
+
const textMsg = `REBUILD_FAILED: ${errorText(error)}`;
|
|
1567
|
+
if (pickedSide === side) animationPanel?.setEditorStatus(textMsg, true);
|
|
1568
|
+
host.message(textMsg, true);
|
|
1569
|
+
return { status: 'refused', error: textMsg, producerLine: null };
|
|
1570
|
+
} finally {
|
|
1571
|
+
rebuildBusy = false; rebuildState(); animationPanel?.busy(false);
|
|
1572
|
+
}
|
|
1573
|
+
}
|
|
1574
|
+
|
|
1575
|
+
async function resetAnimationBuild(): Promise<void> {
|
|
1576
|
+
const side = pickedSide, state = sides[side];
|
|
1577
|
+
const resetMsg = `Reset: Build ${side.toUpperCase()} is back on its inspected build; no pending animation ops.`;
|
|
1578
|
+
animationPanel?.resetEdits();
|
|
1579
|
+
animationPanel?.setEditorStatus(resetMsg, false);
|
|
1580
|
+
if (animationPanel) state.animationState = animationPanel.exportSideState();
|
|
1581
|
+
state.animAdjust = null;
|
|
1582
|
+
setAdjust(side);
|
|
1583
|
+
if (state.appliedOnStage) {
|
|
1584
|
+
animationPanel?.busy(true);
|
|
1585
|
+
try {
|
|
1586
|
+
await resetRebuild(stageWorld(), side);
|
|
1587
|
+
} finally {
|
|
1588
|
+
animationPanel?.busy(false);
|
|
1589
|
+
if (pickedSide === side) {
|
|
1590
|
+
animationPanel?.resetEdits();
|
|
1591
|
+
} else if (state.animationState) {
|
|
1592
|
+
state.animationState.appliedOps = [];
|
|
1593
|
+
state.animationState.selectedKey = null;
|
|
1594
|
+
state.animationState.selectedKeys = [];
|
|
1595
|
+
}
|
|
1596
|
+
}
|
|
1597
|
+
}
|
|
1598
|
+
if (pickedSide === side) {
|
|
1599
|
+
animationPanel?.setEditorStatus(resetMsg, false);
|
|
1600
|
+
if (animationPanel) state.animationState = animationPanel.exportSideState();
|
|
1601
|
+
} else if (state.animationState) {
|
|
1602
|
+
state.animationState.editorStatus = { text: resetMsg, error: false };
|
|
1603
|
+
}
|
|
1401
1604
|
}
|
|
1402
1605
|
|
|
1403
1606
|
async function checkBones(ops: PatchOp[]): Promise<BonesCheckView> {
|
|
@@ -1410,74 +1613,84 @@ export function mountComparePickedTools(host: ComparePickedToolsHost): ComparePi
|
|
|
1410
1613
|
async function applyBones(ops: PatchOp[]): Promise<PatchJobView | RebuildRefusal | null> {
|
|
1411
1614
|
const side = pickedSide, status = sides[side].rebuildStatus ?? await loadRebuildStatus(side);
|
|
1412
1615
|
const patch = status && ops.length ? makePatch(status, ops, { cmd: 'rig' }) : null;
|
|
1413
|
-
if (!patch) { const reason = !ops.length ? 'BONES_NOTHING_PENDING: no pending ops' : status?.reason ?? 'REBUILD_STATUS_UNAVAILABLE'; bonesPanel?.status(reason, true); return null; }
|
|
1414
|
-
bonesPanel?.busy(true); bonesPanel?.status(`Applying ${ops.length} op(s) on Build ${side.toUpperCase()}…`, false);
|
|
1616
|
+
if (!patch) { const reason = !ops.length ? 'BONES_NOTHING_PENDING: no pending ops' : status?.reason ?? 'REBUILD_STATUS_UNAVAILABLE'; if (pickedSide === side) bonesPanel?.status(reason, true); return null; }
|
|
1617
|
+
if (pickedSide === side) { bonesPanel?.busy(true); bonesPanel?.status(`Applying ${ops.length} op(s) on Build ${side.toUpperCase()}…`, false); }
|
|
1415
1618
|
try {
|
|
1416
|
-
const result = await applyPatch(patch, stageWorld());
|
|
1417
|
-
const outcome = patchOutcomeLine(result);
|
|
1418
|
-
if (
|
|
1619
|
+
const result = await applyPatch(patch, stageWorld(), side);
|
|
1620
|
+
const outcome = patchOutcomeLine(result);
|
|
1621
|
+
if (pickedSide === side) bonesPanel?.status(outcome.text, outcome.error);
|
|
1622
|
+
if ('id' in result && result.status === 'built') {
|
|
1623
|
+
if (pickedSide === side) bonesPanel?.applied(result.request.patch.ops);
|
|
1624
|
+
host.redrawOverlays(true);
|
|
1625
|
+
}
|
|
1419
1626
|
return result;
|
|
1420
1627
|
} finally { bonesPanel?.busy(false); }
|
|
1421
1628
|
}
|
|
1422
1629
|
|
|
1423
1630
|
async function resetBonesBuild(): Promise<void> {
|
|
1631
|
+
const side = pickedSide, state = sides[side];
|
|
1424
1632
|
bonesPanel?.clear(); bonesPanel?.applied(null);
|
|
1425
|
-
if (
|
|
1426
|
-
bonesPanel?.status('Reset: the inspected build is on the stage; no pending ops.', false);
|
|
1633
|
+
if (state.appliedOnStage) { bonesPanel?.busy(true); try { await resetRebuild(stageWorld(), side); } finally { bonesPanel?.busy(false); } }
|
|
1634
|
+
if (pickedSide === side) bonesPanel?.status('Reset: the inspected build is on the stage; no pending ops.', false);
|
|
1427
1635
|
}
|
|
1428
1636
|
|
|
1429
1637
|
async function applyCuts(ops: PatchOp[]): Promise<PatchJobView | RebuildRefusal | null> {
|
|
1430
1638
|
const side = pickedSide, status = sides[side].rebuildStatus ?? await loadRebuildStatus(side);
|
|
1431
1639
|
const patch = status && ops.length ? makePatch(status, ops, { cmd: 'rig' }) : null;
|
|
1432
|
-
if (!patch) { const reason = !ops.length ? 'CUTS_NOTHING_PENDING: no pending ops' : status?.reason ?? 'REBUILD_STATUS_UNAVAILABLE'; cutsPanel?.status(reason, true); return null; }
|
|
1433
|
-
cutsPanel?.busy(true); cutsPanel?.status(`Applying ${ops.length} op(s) on Build ${side.toUpperCase()}…`, false);
|
|
1640
|
+
if (!patch) { const reason = !ops.length ? 'CUTS_NOTHING_PENDING: no pending ops' : status?.reason ?? 'REBUILD_STATUS_UNAVAILABLE'; if (pickedSide === side) cutsPanel?.status(reason, true); return null; }
|
|
1641
|
+
if (pickedSide === side) { cutsPanel?.busy(true); cutsPanel?.status(`Applying ${ops.length} op(s) on Build ${side.toUpperCase()}…`, false); }
|
|
1434
1642
|
try {
|
|
1435
|
-
const result = await applyPatch(patch, stageWorld());
|
|
1436
|
-
const outcome = patchOutcomeLine(result);
|
|
1643
|
+
const result = await applyPatch(patch, stageWorld(), side);
|
|
1644
|
+
const outcome = patchOutcomeLine(result);
|
|
1645
|
+
if (pickedSide === side) cutsPanel?.status(outcome.text, outcome.error);
|
|
1437
1646
|
if ('id' in result && result.status === 'built') host.redrawOverlays(true);
|
|
1438
1647
|
return result;
|
|
1439
1648
|
} finally { cutsPanel?.busy(false); }
|
|
1440
1649
|
}
|
|
1441
1650
|
|
|
1442
1651
|
async function resetCutsBuild(): Promise<void> {
|
|
1652
|
+
const side = pickedSide, state = sides[side];
|
|
1443
1653
|
cutsPanel?.clear(); cutsPanel?.shown(null);
|
|
1444
|
-
if (
|
|
1445
|
-
cutsPanel?.status('Reset: the inspected build is on the stage; no pending ops.', false);
|
|
1654
|
+
if (state.appliedOnStage) { cutsPanel?.busy(true); try { await resetRebuild(stageWorld(), side); } finally { cutsPanel?.busy(false); } }
|
|
1655
|
+
if (pickedSide === side) cutsPanel?.status('Reset: the inspected build is on the stage; no pending ops.', false);
|
|
1446
1656
|
}
|
|
1447
1657
|
|
|
1448
1658
|
async function applyCloth(ops: PatchOp[]): Promise<PatchJobView | RebuildRefusal | null> {
|
|
1449
1659
|
const side = pickedSide, status = sides[side].rebuildStatus ?? await loadRebuildStatus(side);
|
|
1450
1660
|
const patch = status && ops.length ? makePatch(status, ops, { cmd: 'rig' }) : null;
|
|
1451
|
-
if (!patch) { const reason = !ops.length ? 'CLOTH_NOTHING_PENDING: no pending ops' : status?.reason ?? 'REBUILD_STATUS_UNAVAILABLE'; clothPanel?.status(reason, true); return null; }
|
|
1452
|
-
clothPanel?.busy(true); clothPanel?.status(`Applying ${ops.length} op(s) on Build ${side.toUpperCase()}…`, false);
|
|
1661
|
+
if (!patch) { const reason = !ops.length ? 'CLOTH_NOTHING_PENDING: no pending ops' : status?.reason ?? 'REBUILD_STATUS_UNAVAILABLE'; if (pickedSide === side) clothPanel?.status(reason, true); return null; }
|
|
1662
|
+
if (pickedSide === side) { clothPanel?.busy(true); clothPanel?.status(`Applying ${ops.length} op(s) on Build ${side.toUpperCase()}…`, false); }
|
|
1453
1663
|
try {
|
|
1454
|
-
const result = await applyPatch(patch, stageWorld());
|
|
1455
|
-
const outcome = patchOutcomeLine(result);
|
|
1664
|
+
const result = await applyPatch(patch, stageWorld(), side);
|
|
1665
|
+
const outcome = patchOutcomeLine(result);
|
|
1666
|
+
if (pickedSide === side) clothPanel?.status(outcome.text, outcome.error);
|
|
1456
1667
|
if ('id' in result && result.status === 'built') host.redrawOverlays(true);
|
|
1457
1668
|
return result;
|
|
1458
1669
|
} finally { clothPanel?.busy(false); }
|
|
1459
1670
|
}
|
|
1460
1671
|
|
|
1461
1672
|
async function resetClothBuild(): Promise<void> {
|
|
1673
|
+
const side = pickedSide, state = sides[side];
|
|
1462
1674
|
clothPanel?.clear(); clothPanel?.shown(null);
|
|
1463
|
-
if (
|
|
1464
|
-
clothPanel?.status('Reset: the inspected build is on the stage; no pending ops.', false);
|
|
1675
|
+
if (state.appliedOnStage) { clothPanel?.busy(true); try { await resetRebuild(stageWorld(), side); } finally { clothPanel?.busy(false); } }
|
|
1676
|
+
if (pickedSide === side) clothPanel?.status('Reset: the inspected build is on the stage; no pending ops.', false);
|
|
1465
1677
|
}
|
|
1466
1678
|
|
|
1467
1679
|
async function applyRigFields(ops: PatchOp[]): Promise<PatchJobView | RebuildRefusal | null> {
|
|
1468
1680
|
const side = pickedSide, state = sides[side], status = state.rebuildStatus ?? await loadRebuildStatus(side);
|
|
1469
|
-
try { assertRigFieldOps(ops); } catch (error) { rigFieldsPanel?.status(errorText(error), true); return null; }
|
|
1681
|
+
try { assertRigFieldOps(ops); } catch (error) { if (pickedSide === side) rigFieldsPanel?.status(errorText(error), true); return null; }
|
|
1470
1682
|
const patch = status && ops.length ? makePatch(status, ops, { cmd: 'rig' }) : null;
|
|
1471
|
-
if (!patch) { const reason = !ops.length ? 'RIG_FIELDS_NOTHING_PENDING: no pending ops' : status?.reason ?? 'REBUILD_STATUS_UNAVAILABLE'; rigFieldsPanel?.status(reason, true); return null; }
|
|
1683
|
+
if (!patch) { const reason = !ops.length ? 'RIG_FIELDS_NOTHING_PENDING: no pending ops' : status?.reason ?? 'REBUILD_STATUS_UNAVAILABLE'; if (pickedSide === side) rigFieldsPanel?.status(reason, true); return null; }
|
|
1472
1684
|
const world = stageWorld(), before = state.stageCheck;
|
|
1473
|
-
rigFieldsPanel?.busy(true); rigFieldsPanel?.status(`Applying ${ops.length} op(s) on Build ${side.toUpperCase()}…`, false);
|
|
1685
|
+
if (pickedSide === side) { rigFieldsPanel?.busy(true); rigFieldsPanel?.status(`Applying ${ops.length} op(s) on Build ${side.toUpperCase()}…`, false); }
|
|
1474
1686
|
try {
|
|
1475
|
-
const result = await applyPatch(patch, world);
|
|
1476
|
-
const outcome = patchOutcomeLine(result);
|
|
1687
|
+
const result = await applyPatch(patch, world, side);
|
|
1688
|
+
const outcome = patchOutcomeLine(result);
|
|
1689
|
+
if (pickedSide === side) rigFieldsPanel?.status(outcome.text, outcome.error);
|
|
1477
1690
|
if ('id' in result && result.status === 'built') {
|
|
1478
|
-
rigFieldsPanel?.applied(result.request.patch.ops);
|
|
1691
|
+
if (pickedSide === side) rigFieldsPanel?.applied(result.request.patch.ops);
|
|
1479
1692
|
const after = { lines: [...result.lines], check: result.check };
|
|
1480
|
-
const show = () => rigFieldsPanel?.readout(readoutRows(before, before ? null : inspectedCheckView(side), after, RIG_FIELDS_READOUT_BARS));
|
|
1693
|
+
const show = () => { if (pickedSide === side) rigFieldsPanel?.readout(readoutRows(before, before ? null : inspectedCheckView(side), after, RIG_FIELDS_READOUT_BARS)); };
|
|
1481
1694
|
show(); if (!before) void followInspectedCheck(show, side);
|
|
1482
1695
|
}
|
|
1483
1696
|
return result;
|
|
@@ -1485,25 +1698,26 @@ export function mountComparePickedTools(host: ComparePickedToolsHost): ComparePi
|
|
|
1485
1698
|
}
|
|
1486
1699
|
|
|
1487
1700
|
async function resetRigFieldsBuild(): Promise<void> {
|
|
1701
|
+
const side = pickedSide, state = sides[side];
|
|
1488
1702
|
rigFieldsPanel?.setDial(0); rigFieldsPanel?.clear(); rigFieldsPanel?.applied(null); rigFieldsPanel?.readout([]);
|
|
1489
|
-
if (
|
|
1490
|
-
rigFieldsPanel?.status('Reset: the inspected build is on the stage; no pending ops; the dial is at 0.', false);
|
|
1703
|
+
if (state.appliedOnStage) { rigFieldsPanel?.busy(true); try { await resetRebuild(stageWorld(), side); } finally { rigFieldsPanel?.busy(false); } }
|
|
1704
|
+
if (pickedSide === side) rigFieldsPanel?.status('Reset: the inspected build is on the stage; no pending ops; the dial is at 0.', false);
|
|
1491
1705
|
}
|
|
1492
1706
|
|
|
1493
1707
|
async function applyMesh(part: string, entry: MeshEntry): Promise<PatchJobView | RebuildRefusal | null> {
|
|
1494
1708
|
const side = pickedSide, state = sides[side], status = state.rebuildStatus ?? await loadRebuildStatus(side);
|
|
1495
1709
|
const problems = meshPanel?.precheck() ?? [];
|
|
1496
|
-
if (problems.length) { meshPanel?.status(`${problems[0]} (review pre-check; nothing sent)`, true); return null; }
|
|
1710
|
+
if (problems.length) { if (pickedSide === side) meshPanel?.status(`${problems[0]} (review pre-check; nothing sent)`, true); return null; }
|
|
1497
1711
|
const patch = status ? makePatch(status, meshPatchOps(part, entry), { cmd: 'remesh', args: ['--part', part] }) : null;
|
|
1498
|
-
if (!patch) { meshPanel?.status(status?.reason ?? 'REBUILD_STATUS_UNAVAILABLE', true); return null; }
|
|
1499
|
-
try { assertMeshPatch(patch, part); } catch (error) { meshPanel?.status(errorText(error), true); return null; }
|
|
1712
|
+
if (!patch) { if (pickedSide === side) meshPanel?.status(status?.reason ?? 'REBUILD_STATUS_UNAVAILABLE', true); return null; }
|
|
1713
|
+
try { assertMeshPatch(patch, part); } catch (error) { if (pickedSide === side) meshPanel?.status(errorText(error), true); return null; }
|
|
1500
1714
|
lastMeshPatch = patch;
|
|
1501
1715
|
const world = stageWorld(), before = state.stageCheck;
|
|
1502
|
-
meshPanel?.busy(true); meshPanel?.status(`Applying meshes.${part} on Build ${side.toUpperCase()} with ${patch.producer.name} ${patch.producer.version}: remesh --mesh, compile, check…`, false);
|
|
1716
|
+
if (pickedSide === side) { meshPanel?.busy(true); meshPanel?.status(`Applying meshes.${part} on Build ${side.toUpperCase()} with ${patch.producer.name} ${patch.producer.version}: remesh --mesh, compile, check…`, false); }
|
|
1503
1717
|
try {
|
|
1504
|
-
const result = await applyPatch(patch, world);
|
|
1718
|
+
const result = await applyPatch(patch, world, side);
|
|
1505
1719
|
const outcome = meshApplyOutcome(result as Parameters<typeof meshApplyOutcome>[0]);
|
|
1506
|
-
meshPanel?.status(outcome.text, outcome.error);
|
|
1720
|
+
if (pickedSide === side) meshPanel?.status(outcome.text, outcome.error);
|
|
1507
1721
|
if ('id' in result && result.status === 'built') {
|
|
1508
1722
|
if (!host.layers.mesh) { host.layers.mesh = true; input('layer-mesh').checked = true; }
|
|
1509
1723
|
const player = host.players[side];
|
|
@@ -1511,12 +1725,14 @@ export function mountComparePickedTools(host: ComparePickedToolsHost): ComparePi
|
|
|
1511
1725
|
host.redrawOverlays(true);
|
|
1512
1726
|
const counts = result.remesh ?? null, overlay = state.lastOverlay?.meshTriangles[part] ?? null;
|
|
1513
1727
|
const agree = triangleAgreement(counts, counts?.modelTriangles ?? null, overlay);
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1728
|
+
if (pickedSide === side) {
|
|
1729
|
+
meshPanel?.counts([
|
|
1730
|
+
...(counts ? [{ label: 'BEFORE', text: `${counts.part} ${countsText(counts.before)} (remesh.json)` }, { label: 'AFTER', text: `${counts.part} ${countsText(counts.after)} (remesh.json)` }] : []),
|
|
1731
|
+
{ label: agree.ok ? 'AGREE' : 'DIFFER', text: agree.line, error: !agree.ok },
|
|
1732
|
+
]);
|
|
1733
|
+
}
|
|
1518
1734
|
const after = { lines: [...result.lines], check: result.check };
|
|
1519
|
-
const show = () => meshPanel?.readout(readoutRows(before, before ? null : inspectedCheckView(side), after, ['TEXTURE_STRETCH']));
|
|
1735
|
+
const show = () => { if (pickedSide === side) meshPanel?.readout(readoutRows(before, before ? null : inspectedCheckView(side), after, ['TEXTURE_STRETCH'])); };
|
|
1520
1736
|
show(); if (!before) void followInspectedCheck(show, side);
|
|
1521
1737
|
}
|
|
1522
1738
|
return result;
|
|
@@ -1524,14 +1740,18 @@ export function mountComparePickedTools(host: ComparePickedToolsHost): ComparePi
|
|
|
1524
1740
|
}
|
|
1525
1741
|
|
|
1526
1742
|
async function resetMeshBuild(): Promise<void> {
|
|
1743
|
+
const side = pickedSide, state = sides[side];
|
|
1527
1744
|
meshPanel?.counts([]); meshPanel?.readout([]);
|
|
1528
|
-
if (
|
|
1529
|
-
meshPanel?.busy(true); try { await resetRebuild(stageWorld()); } finally { meshPanel?.busy(false); }
|
|
1745
|
+
if (state.appliedOnStage || state.stripPending) {
|
|
1746
|
+
meshPanel?.busy(true); try { await resetRebuild(stageWorld(), side); } finally { meshPanel?.busy(false); }
|
|
1530
1747
|
}
|
|
1531
|
-
meshPanel?.status('Reset: the inspected build is on the stage; the pending entry is the config\'s.', false);
|
|
1748
|
+
if (pickedSide === side) meshPanel?.status('Reset: the inspected build is on the stage; the pending entry is the config\'s.', false);
|
|
1532
1749
|
}
|
|
1533
1750
|
|
|
1534
|
-
const densityLine = (msg: string, error = false
|
|
1751
|
+
const densityLine = (msg: string, error = false, side: Side = pickedSide) => {
|
|
1752
|
+
if (pickedSide === side) densityStrip?.status(msg, error);
|
|
1753
|
+
if (error) host.message(msg, true);
|
|
1754
|
+
};
|
|
1535
1755
|
const renderStrip = () => {
|
|
1536
1756
|
const state = currentState();
|
|
1537
1757
|
densityStrip?.show(state.stripView, state.stripPending && state.stripView?.id === state.stripPending.id ? state.stripPending.index : null, densityBusy || rebuildBusy || !!host.readOnly());
|
|
@@ -1548,9 +1768,9 @@ export function mountComparePickedTools(host: ComparePickedToolsHost): ComparePi
|
|
|
1548
1768
|
if (ro) { densityLine(ro, true); return { error: ro }; }
|
|
1549
1769
|
const side = pickedSide, state = sides[side];
|
|
1550
1770
|
const status = state.rebuildStatus ?? await loadRebuildStatus(side), part = meshPanel?.part() ?? null, entry = meshPanel?.entry() ?? null;
|
|
1551
|
-
if (!status || !part || !entry) { const t = status?.reason ?? 'MESH_PANEL_NO_PART: select a mesh part'; densityLine(t, true); return { error: t }; }
|
|
1771
|
+
if (!status || !part || !entry) { const t = status?.reason ?? 'MESH_PANEL_NO_PART: select a mesh part'; densityLine(t, true, side); return { error: t }; }
|
|
1552
1772
|
const problems = meshPanel?.precheck() ?? [];
|
|
1553
|
-
if (problems.length) { const t = `${problems[0]} (review pre-check; nothing sent)`; densityLine(t, true); return { error: t }; }
|
|
1773
|
+
if (problems.length) { const t = `${problems[0]} (review pre-check; nothing sent)`; densityLine(t, true, side); return { error: t }; }
|
|
1554
1774
|
let patches: ConfigPatch[];
|
|
1555
1775
|
try {
|
|
1556
1776
|
const field = densityField(entry, part);
|
|
@@ -1560,26 +1780,26 @@ export function mountComparePickedTools(host: ComparePickedToolsHost): ComparePi
|
|
|
1560
1780
|
assertMeshPatch(patch, part);
|
|
1561
1781
|
return patch;
|
|
1562
1782
|
});
|
|
1563
|
-
} catch (error) { const t = errorText(error); densityLine(t, true); return { error: t }; }
|
|
1564
|
-
if (state.stripPending) await stripBack();
|
|
1565
|
-
densityBusy = true; renderStrip();
|
|
1566
|
-
densityLine(`Building a strip of ${values.length} on ${part} (Build ${side.toUpperCase()}): ${values.join(', ')}
|
|
1783
|
+
} catch (error) { const t = errorText(error); densityLine(t, true, side); return { error: t }; }
|
|
1784
|
+
if (state.stripPending) await stripBack(side);
|
|
1785
|
+
densityBusy = true; if (pickedSide === side) renderStrip();
|
|
1786
|
+
densityLine(`Building a strip of ${values.length} on ${part} (Build ${side.toUpperCase()}): ${values.join(', ')}…`, false, side);
|
|
1567
1787
|
const t0 = performance.now();
|
|
1568
1788
|
try {
|
|
1569
1789
|
let view: DensityStripViewLike | { status: string; error: string };
|
|
1570
1790
|
try { view = await host.api<DensityStripViewLike | { status: string; error: string }>(`${sideApiPrefix(side)}/density-strip`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ patches }) }); }
|
|
1571
|
-
catch (error) { const t = errorText(error); densityLine(t, true); return { error: t }; }
|
|
1572
|
-
if ('error' in view) { densityLine(view.error, true); return { error: view.error }; }
|
|
1573
|
-
state.stripView = view; renderStrip();
|
|
1791
|
+
catch (error) { const t = errorText(error); densityLine(t, true, side); return { error: t }; }
|
|
1792
|
+
if ('error' in view) { densityLine(view.error, true, side); return { error: view.error }; }
|
|
1793
|
+
state.stripView = view; if (pickedSide === side) renderStrip();
|
|
1574
1794
|
while (state.stripView.status === 'running') {
|
|
1575
1795
|
await new Promise(resolve => setTimeout(resolve, 1500));
|
|
1576
1796
|
state.stripView = await host.api<DensityStripViewLike>(`${sideApiPrefix(side)}/density-strip/${state.stripView.id}`);
|
|
1577
|
-
renderStrip();
|
|
1797
|
+
if (pickedSide === side) renderStrip();
|
|
1578
1798
|
const settled = state.stripView.rows.filter(r => r.status !== 'running').length;
|
|
1579
|
-
densityLine(`Strip ${state.stripView.id.slice(0, 12)}…: ${settled} of ${state.stripView.rows.length} settled · ${((performance.now() - t0) / 1000).toFixed(0)} s
|
|
1799
|
+
densityLine(`Strip ${state.stripView.id.slice(0, 12)}…: ${settled} of ${state.stripView.rows.length} settled · ${((performance.now() - t0) / 1000).toFixed(0)} s`, false, side);
|
|
1580
1800
|
}
|
|
1581
1801
|
const passing = state.stripView.rows.filter(r => r.verdict === 'PASS').length;
|
|
1582
|
-
densityLine(`Strip of ${state.stripView.rows.length} on ${state.stripView.part} settled: ${passing} passing
|
|
1802
|
+
densityLine(`Strip of ${state.stripView.rows.length} on ${state.stripView.part} settled: ${passing} passing.`, false, side);
|
|
1583
1803
|
return state.stripView;
|
|
1584
1804
|
} finally { densityBusy = false; renderStrip(); }
|
|
1585
1805
|
}
|
|
@@ -1588,7 +1808,7 @@ export function mountComparePickedTools(host: ComparePickedToolsHost): ComparePi
|
|
|
1588
1808
|
const side = pickedSide, state = sides[side];
|
|
1589
1809
|
const view = state.stripView, row = view?.rows[index];
|
|
1590
1810
|
if (!view || !row) return { error: 'DENSITY_STRIP_NOT_FOUND' };
|
|
1591
|
-
if (!row.modelUrl || !row.modelHash) { const t = `DENSITY_STRIP_ROW_NOT_LOADABLE: ${row.value} — ${row.applied ? 'applied already' : row.verdict}`; densityLine(t, true); return { error: t }; }
|
|
1811
|
+
if (!row.modelUrl || !row.modelHash) { const t = `DENSITY_STRIP_ROW_NOT_LOADABLE: ${row.value} — ${row.applied ? 'applied already' : row.verdict}`; densityLine(t, true, side); return { error: t }; }
|
|
1592
1812
|
if (rebuildBusy || densityBusy) return { error: 'REBUILD_BUSY' };
|
|
1593
1813
|
const back = state.stripPending?.back ?? {
|
|
1594
1814
|
url: state.stageSource?.url ?? state.inspectedModel!.url,
|
|
@@ -1602,42 +1822,51 @@ export function mountComparePickedTools(host: ComparePickedToolsHost): ComparePi
|
|
|
1602
1822
|
await swapPickedSide(side, new URL(host.route(row.modelUrl), location.href).href, host.route(`/compare-density-strip/${side}/${view.id}/${row.id}/`), row.modelHash);
|
|
1603
1823
|
state.stripPending = { index, id: view.id, candidate: row.id, back };
|
|
1604
1824
|
state.appliedOnStage = null; state.stageCheck = null;
|
|
1605
|
-
|
|
1606
|
-
|
|
1825
|
+
if (pickedSide === side) {
|
|
1826
|
+
const draft = el<HTMLTextAreaElement>('rebuild-applied'); draft.value = ''; draft.dispatchEvent(new Event('input', { bubbles: true }));
|
|
1827
|
+
meshPanel?.setEntry(row.entry as MeshEntry);
|
|
1828
|
+
} else if (state.animationState) {
|
|
1829
|
+
state.animationState.appliedOps = [];
|
|
1830
|
+
}
|
|
1607
1831
|
if (!host.layers.mesh) { host.layers.mesh = true; input('layer-mesh').checked = true; }
|
|
1608
1832
|
host.redrawOverlays(true);
|
|
1609
1833
|
const c = row.counts ? { vertices: row.counts.vertices, triangles: row.counts.triangles, hull: 0 } : null;
|
|
1610
1834
|
const agree = triangleAgreement(c ? { part: view.part, before: c, after: c } : null, row.modelTriangles, state.lastOverlay?.meshTriangles[view.part] ?? null);
|
|
1611
|
-
|
|
1612
|
-
|
|
1835
|
+
if (pickedSide === side) {
|
|
1836
|
+
meshPanel?.counts([{ label: 'PENDING', text: `${view.field} ${row.value} — not applied` }, { label: agree.ok ? 'AGREE' : 'DIFFER', text: agree.line, error: !agree.ok }]);
|
|
1837
|
+
}
|
|
1838
|
+
densityLine(`Pending on Build ${side.toUpperCase()}: ${view.part} ${view.field} ${row.value} (strip row ${index + 1}) — not applied.`, !agree.ok, side);
|
|
1613
1839
|
return { line: agree.line, ok: agree.ok };
|
|
1614
|
-
} catch (error) { const t = `DENSITY_STRIP_LOAD_FAILED: ${errorText(error)}`; densityLine(t, true); return { error: t }; }
|
|
1840
|
+
} catch (error) { const t = `DENSITY_STRIP_LOAD_FAILED: ${errorText(error)}`; densityLine(t, true, side); return { error: t }; }
|
|
1615
1841
|
finally { rebuildBusy = false; rebuildState(); renderStrip(); }
|
|
1616
1842
|
}
|
|
1617
1843
|
|
|
1618
|
-
async function stripBack(): Promise<void> {
|
|
1619
|
-
const
|
|
1844
|
+
async function stripBack(side: Side = pickedSide): Promise<void> {
|
|
1845
|
+
const state = sides[side], pending = state.stripPending;
|
|
1620
1846
|
if (!pending || rebuildBusy) return;
|
|
1621
1847
|
rebuildBusy = true; rebuildState();
|
|
1622
1848
|
try {
|
|
1623
1849
|
await swapPickedSide(side, pending.back.url, pending.back.prefix, pending.back.hash);
|
|
1624
1850
|
state.appliedOnStage = pending.back.applied; state.stageCheck = pending.back.check; state.stripPending = null;
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1851
|
+
if (pickedSide === side) {
|
|
1852
|
+
const draft = el<HTMLTextAreaElement>('rebuild-applied'); draft.value = state.appliedOnStage ? JSON.stringify(state.appliedOnStage) : ''; draft.dispatchEvent(new Event('input', { bubbles: true }));
|
|
1853
|
+
meshPanel?.counts([]);
|
|
1854
|
+
}
|
|
1855
|
+
host.redrawOverlays(true);
|
|
1856
|
+
densityLine(`Back: Build ${side.toUpperCase()} shows ${state.appliedOnStage ? 'the last applied record' : 'the inspected build'}.`, false, side);
|
|
1857
|
+
} catch (error) { densityLine(`DENSITY_STRIP_BACK_FAILED: ${errorText(error)}`, true, side); }
|
|
1629
1858
|
finally { rebuildBusy = false; rebuildState(); renderStrip(); }
|
|
1630
1859
|
}
|
|
1631
1860
|
|
|
1632
1861
|
async function closeDensityStrip(): Promise<{ status: string; error?: string }> {
|
|
1633
1862
|
const side = pickedSide, state = sides[side], view = state.stripView;
|
|
1634
1863
|
if (!view) return { status: 'closed' };
|
|
1635
|
-
if (state.stripPending && state.stripPending.id === view.id) await stripBack();
|
|
1864
|
+
if (state.stripPending && state.stripPending.id === view.id) await stripBack(side);
|
|
1636
1865
|
try {
|
|
1637
1866
|
const r = await host.api<{ status: string; error?: string }>(`${sideApiPrefix(side)}/density-strip/close`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ id: view.id }) });
|
|
1638
|
-
if (r.status !== 'closed') { densityLine(r.error ?? 'DENSITY_STRIP_CLOSE_REFUSED', true); return r; }
|
|
1639
|
-
state.stripView = null; renderStrip(); densityLine('Strip closed; its scratch is removed.'); return r;
|
|
1640
|
-
} catch (error) { const t = errorText(error); densityLine(t, true); return { status: 'refused', error: t }; }
|
|
1867
|
+
if (r.status !== 'closed') { densityLine(r.error ?? 'DENSITY_STRIP_CLOSE_REFUSED', true, side); return r; }
|
|
1868
|
+
state.stripView = null; if (pickedSide === side) renderStrip(); densityLine('Strip closed; its scratch is removed.', false, side); return r;
|
|
1869
|
+
} catch (error) { const t = errorText(error); densityLine(t, true, side); return { status: 'refused', error: t }; }
|
|
1641
1870
|
}
|
|
1642
1871
|
|
|
1643
1872
|
async function runReadings(override?: { readings: import('../src/readings.ts').ReadingRequest[] }): Promise<ReadingsJobView | ReadingsRefusal | null> {
|
|
@@ -1658,19 +1887,26 @@ export function mountComparePickedTools(host: ComparePickedToolsHost): ComparePi
|
|
|
1658
1887
|
let job = await host.api<ReadingsJobView | ReadingsRefusal>(`${sideApiPrefix(side)}/readings`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) }).catch(error => ({ status: 'refused' as const, error: errorText(error).replace(/^\d+: /, '') }));
|
|
1659
1888
|
if (!('id' in job)) {
|
|
1660
1889
|
const textMsg = (() => { try { return (JSON.parse(job.error) as { error?: string }).error ?? job.error; } catch { return job.error; } })();
|
|
1661
|
-
readingsPanel.status(textMsg, true);
|
|
1890
|
+
if (pickedSide === side) readingsPanel.status(textMsg, true);
|
|
1891
|
+
return { status: 'refused', error: textMsg };
|
|
1662
1892
|
}
|
|
1663
1893
|
while (job.status === 'running') {
|
|
1664
1894
|
await new Promise(resolve => setTimeout(resolve, 800));
|
|
1665
1895
|
job = await host.api<ReadingsJobView>(`${sideApiPrefix(side)}/readings/${job.id}`);
|
|
1666
1896
|
}
|
|
1667
|
-
if (job.status === 'failed') {
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1897
|
+
if (job.status === 'failed') {
|
|
1898
|
+
if (pickedSide === side) readingsPanel.status(job.error ?? 'READINGS_FAILED', true);
|
|
1899
|
+
return job;
|
|
1900
|
+
}
|
|
1901
|
+
sides[side].readingsJob = job;
|
|
1902
|
+
if (pickedSide === side) {
|
|
1903
|
+
readingsPanel.lines(job);
|
|
1904
|
+
const ticks = job.runs.map(r => `${r.build} ${r.results.reduce((n, x) => n + x.frames.length, 0)} tick(s)`).join(' · ');
|
|
1905
|
+
const refused = job.runs.flatMap(r => r.results).find(r => r.status !== 'read');
|
|
1906
|
+
readingsPanel.status(`${refused ? `${refused.refusal} · ` : ''}Readings of ${job.request.animation}: ${ticks} · ${((performance.now() - started) / 1000).toFixed(1)} s`, !!refused);
|
|
1907
|
+
}
|
|
1672
1908
|
return job;
|
|
1673
|
-
} catch (error) { readingsPanel.status(`READINGS_FAILED: ${errorText(error)}`, true); return null; }
|
|
1909
|
+
} catch (error) { if (pickedSide === side) readingsPanel.status(`READINGS_FAILED: ${errorText(error)}`, true); return null; }
|
|
1674
1910
|
finally { readingsBusy = false; readingsPanel.busy(false); }
|
|
1675
1911
|
}
|
|
1676
1912
|
|
|
@@ -1694,16 +1930,17 @@ export function mountComparePickedTools(host: ComparePickedToolsHost): ComparePi
|
|
|
1694
1930
|
}
|
|
1695
1931
|
|
|
1696
1932
|
async function meshFolds(): Promise<string[]> {
|
|
1697
|
-
const animation = host.data().animation;
|
|
1933
|
+
const side = pickedSide, animation = host.data().animation;
|
|
1698
1934
|
meshPanel?.status(`Running the folds reading of ${animation}…`, false);
|
|
1699
1935
|
const job = await runReadings({ readings: [{ kind: 'folds' }] });
|
|
1700
1936
|
if (!job || !('runs' in job)) {
|
|
1701
1937
|
const textMsg = job && 'error' in job && job.error ? job.error : 'READINGS_UNAVAILABLE: no reading ran';
|
|
1702
|
-
meshPanel?.status(textMsg, true);
|
|
1938
|
+
if (pickedSide === side) meshPanel?.status(textMsg, true);
|
|
1939
|
+
return [textMsg];
|
|
1703
1940
|
}
|
|
1704
1941
|
const lines = job.runs.map(run => { const r = run.results[0]; return r ? worstLine(run.build, r) : `${run.build} · folds: not run`; });
|
|
1705
1942
|
if (job.runs.length < 2) lines.push('scratch · folds: no scratch build yet (Apply builds one)');
|
|
1706
|
-
meshPanel?.status(lines.join(' | '), job.runs.some(run => run.results.some(r => r.status !== 'read')));
|
|
1943
|
+
if (pickedSide === side) meshPanel?.status(lines.join(' | '), job.runs.some(run => run.results.some(r => r.status !== 'read')));
|
|
1707
1944
|
return lines;
|
|
1708
1945
|
}
|
|
1709
1946
|
|
|
@@ -1726,6 +1963,7 @@ export function mountComparePickedTools(host: ComparePickedToolsHost): ComparePi
|
|
|
1726
1963
|
const side = pickedSide, state = sides[side];
|
|
1727
1964
|
const out = el('environment-check-lines');
|
|
1728
1965
|
const show = (rows: { kind: string; text: string }[]) => {
|
|
1966
|
+
if (pickedSide !== side) return;
|
|
1729
1967
|
out.replaceChildren(...rows.map(row => { const line = document.createElement('div'); line.className = `env-${row.kind}`; line.textContent = row.text; return line; }));
|
|
1730
1968
|
};
|
|
1731
1969
|
const name = checkAnimation(side), world = worldFor(name, side);
|
|
@@ -1895,6 +2133,14 @@ export function mountComparePickedTools(host: ComparePickedToolsHost): ComparePi
|
|
|
1895
2133
|
stage: viewportProxy,
|
|
1896
2134
|
project: (x, y) => rigProject()(x, y),
|
|
1897
2135
|
enabled: () => !!currentState().partModel && currentInspector() === 'playback',
|
|
2136
|
+
readOnlyReason: () => host.readOnly(),
|
|
2137
|
+
pause: () => host.pause(),
|
|
2138
|
+
preview: fn => {
|
|
2139
|
+
sides[pickedSide].animAdjust = fn;
|
|
2140
|
+
setAdjust(pickedSide);
|
|
2141
|
+
},
|
|
2142
|
+
apply: ops => applyAnimation(ops),
|
|
2143
|
+
reset: () => resetAnimationBuild(),
|
|
1898
2144
|
seek: exact => {
|
|
1899
2145
|
if (!Number.isFinite(exact) || exact < 0 || exact > host.duration()) {
|
|
1900
2146
|
host.message('KEY_TIME_OUT_OF_DOMAIN: no substitute time was used.', true);
|
|
@@ -2289,6 +2535,46 @@ export function mountComparePickedTools(host: ComparePickedToolsHost): ComparePi
|
|
|
2289
2535
|
lines: () => retargetPanel?.shownLines() ?? [],
|
|
2290
2536
|
refusals: () => [...document.querySelectorAll('#retarget-refusals code')].map(c => c.textContent),
|
|
2291
2537
|
},
|
|
2538
|
+
animation: {
|
|
2539
|
+
ops: () => animationPanel?.ops() ?? [],
|
|
2540
|
+
unappliedOps: () => animationPanel?.unappliedOps() ?? [],
|
|
2541
|
+
hasPreview: () => animationPanel?.hasUnappliedPreview() ?? false,
|
|
2542
|
+
source: () => animationPanel?.sourceInfo() ?? null,
|
|
2543
|
+
setSourceLoading: () => animationPanel?.setSourceLoading(),
|
|
2544
|
+
setSource: (source: Parameters<AnimationInspectionPanel['loadSource']>[0], fallbackReason?: string | null) => animationPanel?.loadSource(source, fallbackReason),
|
|
2545
|
+
gate: () => animationPanel?.gateInfo() ?? null,
|
|
2546
|
+
tracks: () => animationPanel?.tracksInfo() ?? [],
|
|
2547
|
+
selectedKey: () => animationPanel?.selectedKeyInfo() ?? null,
|
|
2548
|
+
selectedKeys: () => animationPanel?.selectedKeysInfo() ?? [],
|
|
2549
|
+
selectKey: (track: number, key: number) => animationPanel?.selectKey(track, key) ?? false,
|
|
2550
|
+
selectKeys: (selections: ReadonlyArray<{ track: number; key: number }>) => animationPanel?.selectKeys(selections) ?? false,
|
|
2551
|
+
toggleKeySelection: (track: number, key: number) => animationPanel?.toggleKeySelection(track, key) ?? false,
|
|
2552
|
+
deleteSelection: () => animationPanel?.deleteSelection() ?? { ok: false, error: 'ANIMATION_PANEL_UNAVAILABLE' },
|
|
2553
|
+
stagePoseMode: () => animationPanel?.stagePoseMode() ?? 'rotate',
|
|
2554
|
+
setStagePoseMode: (mode: 'rotate' | 'translate') => animationPanel?.setStagePoseMode(mode),
|
|
2555
|
+
poseBone: (boneName: string, arg2: 'rotate' | 'translate' | number, arg3: number, arg4: number | 'rotate' | 'translate') => {
|
|
2556
|
+
const mode = typeof arg2 === 'string' ? arg2 : (arg4 as 'rotate' | 'translate');
|
|
2557
|
+
const clientX = typeof arg2 === 'number' ? arg2 : arg3;
|
|
2558
|
+
const clientY = typeof arg2 === 'number' ? arg3 : (arg4 as number);
|
|
2559
|
+
return animationPanel?.poseBoneOnStage(boneName, mode, clientX, clientY) ?? { ok: false, error: 'ANIMATION_PANEL_UNAVAILABLE' };
|
|
2560
|
+
},
|
|
2561
|
+
overlaid: () => animationPanel?.overlaidInspection() ?? null,
|
|
2562
|
+
boneWorld: (boneName: string) => animationPanel?.boneWorldMatrix(boneName) ?? null,
|
|
2563
|
+
setKeyTime: (track: number, key: number, t: number) => animationPanel?.setKeyTime(track, key, t) ?? { ok: false, error: 'ANIMATION_PANEL_UNAVAILABLE' },
|
|
2564
|
+
setKeyValue: (track: number, key: number, channel: number | undefined, value: number | readonly number[]) => animationPanel?.setKeyValue(track, key, channel, value) ?? { ok: false, error: 'ANIMATION_PANEL_UNAVAILABLE' },
|
|
2565
|
+
setKeyCurve: (track: number, key: number, curve: readonly number[] | 'stepped' | null) => animationPanel?.setKeyCurve(track, key, curve) ?? { ok: false, error: 'ANIMATION_PANEL_UNAVAILABLE' },
|
|
2566
|
+
setKeyEase: (track: number, key: number, ease: string | null) => animationPanel?.setKeyEase(track, key, ease) ?? { ok: false, error: 'ANIMATION_PANEL_UNAVAILABLE' },
|
|
2567
|
+
insertKey: (track: number, t: number, value?: readonly number[]) => animationPanel?.insertKey(track, t, value) ?? { ok: false, error: 'ANIMATION_PANEL_UNAVAILABLE' },
|
|
2568
|
+
deleteKey: (track: number, key: number) => animationPanel?.deleteKey(track, key) ?? { ok: false, error: 'ANIMATION_PANEL_UNAVAILABLE' },
|
|
2569
|
+
moveSelection: (selections: ReadonlyArray<{ track: number; key: number }>, deltaTime: number) => animationPanel?.moveSelection(selections, deltaTime) ?? { ok: false, error: 'ANIMATION_PANEL_UNAVAILABLE' },
|
|
2570
|
+
undoOp: () => animationPanel?.undoOp() ?? false,
|
|
2571
|
+
clearPending: () => animationPanel?.clearPending(),
|
|
2572
|
+
zoom: () => animationPanel?.zoomLevel() ?? 1,
|
|
2573
|
+
setZoom: (z: number) => animationPanel?.setZoom(z),
|
|
2574
|
+
apply: () => applyAnimation(animationPanel?.ops() ?? []),
|
|
2575
|
+
reset: () => resetAnimationBuild(),
|
|
2576
|
+
status: () => document.querySelector('[data-animation-editor-status]')?.textContent ?? '',
|
|
2577
|
+
},
|
|
2292
2578
|
stage: (side: Side = pickedSide) => ({
|
|
2293
2579
|
side,
|
|
2294
2580
|
modelHash: sides[side].stageModelHash,
|
|
@@ -2315,6 +2601,10 @@ export function mountComparePickedTools(host: ComparePickedToolsHost): ComparePi
|
|
|
2315
2601
|
st.stageSource = { url: modelUrl, prefix, hash: sha256 };
|
|
2316
2602
|
st.stageModelHash = sha256;
|
|
2317
2603
|
st.partModel = partModel;
|
|
2604
|
+
if (side !== pickedSide && st.animationState) {
|
|
2605
|
+
st.animationState.document = null;
|
|
2606
|
+
st.animationState.baseInspection = null;
|
|
2607
|
+
}
|
|
2318
2608
|
void loadModelDocument(modelUrl, sha256).then(loaded => {
|
|
2319
2609
|
if (loaded.ok) {
|
|
2320
2610
|
st.inspectedDocument = loaded.document;
|
|
@@ -2382,10 +2672,10 @@ export function mountComparePickedTools(host: ComparePickedToolsHost): ComparePi
|
|
|
2382
2672
|
requirementsPanel?.selectionChanged();
|
|
2383
2673
|
},
|
|
2384
2674
|
overlayInputFor: side => {
|
|
2385
|
-
animationPanel?.redraw(host.layers.bones);
|
|
2386
2675
|
if (side !== pickedSide) {
|
|
2387
2676
|
return { regions: [], circles: [], markers: [], meshEdit: null, weights: null, anchors: null };
|
|
2388
2677
|
}
|
|
2678
|
+
animationPanel?.redraw(host.layers.bones);
|
|
2389
2679
|
idlePanel?.place(host.duration());
|
|
2390
2680
|
rigFieldsPanel?.place();
|
|
2391
2681
|
return {
|
|
@@ -2431,7 +2721,7 @@ export function mountComparePickedTools(host: ComparePickedToolsHost): ComparePi
|
|
|
2431
2721
|
if (rebuildBusy) {
|
|
2432
2722
|
return 'COMMENT_SOURCE_BUSY: wait for the rebuild or candidate model replacement before commenting';
|
|
2433
2723
|
}
|
|
2434
|
-
const preview = idleAdjust ? 'Idle tracks' : dialAdjust ? 'Rig fields turn dial' : physicsPreview.read().length ? 'Physics live overrides' :
|
|
2724
|
+
const preview = idleAdjust ? 'Idle tracks' : (sides.a.animAdjust || sides.b.animAdjust) ? 'Keyed animation preview' : dialAdjust ? 'Rig fields turn dial' : physicsPreview.read().length ? 'Physics live overrides' :
|
|
2435
2725
|
(sides.a.stripPending || sides.b.stripPending) ? 'Density strip candidate' :
|
|
2436
2726
|
meshEditor?.overlay() ? 'Edit Mesh' : bonesPanel?.overlay() ? 'Bones anchors' :
|
|
2437
2727
|
cutsPanel && (cutsPanel.overlayRegions().length || cutsPanel.overlayMarkers().length) ? 'Cuts/patches/joints' :
|