@rig-c/review 4.0.2 → 4.2.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/docs/DESIGN.md +60 -2
- package/package.json +2 -2
- package/src/compare-html.ts +5 -5
- package/src/handoff.ts +1 -1
- package/src/job-source.ts +4 -1
- package/web/animation-inspection.ts +2 -0
- package/web/catalog-en.ts +21 -3
- package/web/catalog-ko.ts +42 -24
- package/web/compare-picked-tools.ts +1 -0
- package/web/compare.css +156 -146
- package/web/compare.html +1 -1
- package/web/compare.ts +4 -3
- package/web/inspection-persistence.ts +34 -22
- package/web/inspector-blocks.ts +112 -38
- package/web/interview-panel.ts +24 -8
- package/web/job-rig-screen.ts +3 -3
- package/web/job-session.ts +27 -57
- package/web/main.ts +210 -46
- package/web/part-selection.ts +5 -0
- package/web/parts-viewport-provider.ts +19 -9
- package/web/stage-comments.ts +20 -11
- package/web/styles.css +359 -270
- package/web/view-controls.ts +26 -15
- package/web/workspace-ui.ts +19 -11
package/web/main.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {hasTransientQuestionImage} from './interview-panel.ts';
|
|
1
2
|
import {bindScenePlates,loadScenePlates,takeSample} from './scene-plates.ts';
|
|
2
3
|
import type {SceneInspection} from '../src/scene-inspection.ts';
|
|
3
4
|
import type {InterviewSubjectEntry} from '../src/joined-project.ts';
|
|
@@ -135,20 +136,28 @@ const rigStatusBar=mountStatusBar({
|
|
|
135
136
|
app.querySelector<HTMLElement>('[data-workspace-status]')!.replaceWith(rigStatusBar.footer);
|
|
136
137
|
for(const id of ['layout-state','idle-state','control-state','draft-state'])el(id).setAttribute('role','status');
|
|
137
138
|
el('layout-state').setAttribute('aria-label','Effective layout');el('renderer-state').setAttribute('aria-label','Last draw backend');el('draft-state').setAttribute('aria-live','polite');el('view-coordinates').setAttribute('aria-label','Current numeric inspection region');
|
|
138
|
-
const shell=mountWorkspaceShell({compatibility:'rigStep1',embedded:new URLSearchParams(location.search).has('stageEmbed')&&!location.pathname.endsWith('/stage-interview.html')});app.prepend(shell.header);
|
|
139
|
+
const shell=mountWorkspaceShell({compatibility:'rigStep1',pendingActRow:!!host,embedded:new URLSearchParams(location.search).has('stageEmbed')&&!location.pathname.endsWith('/stage-interview.html')});app.prepend(shell.header,...shell.actRow?[shell.actRow]:[]);
|
|
139
140
|
el('app').querySelector<HTMLElement>('[data-workspace-comment]')!.innerHTML=sharedCommentMarkup;
|
|
140
141
|
el('app').querySelector<HTMLElement>('[data-workspace-layers]')!.append(createRigLayerControls());
|
|
141
142
|
el('app').querySelector<HTMLElement>('[data-workspace-view-tools]')!.innerHTML=sharedViewToolsMarkup;
|
|
142
143
|
const controls=createViewControls({layout:'rigStep1',viewSwitch:inspectionViewSwitch(chooseInspectionView,true)}),cameraControls=el('app').querySelector<HTMLElement>('[data-workspace-camera]')!;cameraControls.append(controls.syncLabel,controls.zoomGroup!);
|
|
144
|
+
cameraControls.insertBefore(button('play'),controls.zoomGroup!);button('play').hidden=true;
|
|
143
145
|
const primaryToolbar=app.querySelector<HTMLElement>('.viewbar')!;primaryToolbar.classList.add('workspace-main-toolbar');
|
|
144
146
|
const secondaryToolbar=document.createElement('div');secondaryToolbar.className='workspace-secondary-toolbar';secondaryToolbar.append(app.querySelector<HTMLElement>('[data-workspace-layers]')!,app.querySelector<HTMLElement>('[data-workspace-view-tools]')!);primaryToolbar.after(secondaryToolbar);
|
|
145
147
|
for(const event of ['click','change'])secondaryToolbar.addEventListener(event,()=>{if(rigDifference){leaveRigDifference();renderLayout();}},true);
|
|
146
|
-
const rigInspector=mountRigInspector();
|
|
147
|
-
|
|
148
|
+
const rigInspector=mountRigInspector(document,shell.actRow??undefined);
|
|
149
|
+
if(host)rigInspector.act.hidden=true;
|
|
150
|
+
const rigAsk=panelMake('button',{className:'workspace-act-ask',id:'workspace-pending-ask',hidden:true});rigAsk.type='button';
|
|
151
|
+
const askHeadline=panelMake('span',{id:'workspace-ask-headline',className:'workspace-act-ask',hidden:true});
|
|
152
|
+
const requestChanges=panelMake('button',{id:'request-changes',type:'button',hidden:true});
|
|
153
|
+
rigInspector.act.prepend(askHeadline,rigAsk);button('save').after(requestChanges);
|
|
154
|
+
let pendingAnswers:readonly {kind:string;stage?:string}[]=[],answerSaved=false;
|
|
155
|
+
let partsAnswerBlocked:()=>boolean=()=>false;
|
|
148
156
|
mountViewportPair(el('stage-layout'));
|
|
149
157
|
const viewportState=createViewportState();
|
|
150
158
|
const partsCanvas=document.createElement('canvas'),partsReference=document.createElement('canvas');partsCanvas.width=partsCanvas.height=partsReference.width=partsReference.height=0;
|
|
151
159
|
let partsSubject:ReturnType<typeof bindPartsSubject>|null=null;
|
|
160
|
+
let setupPartsPersistence:(()=>Promise<void>)|null=null;
|
|
152
161
|
let rigDifference:{assets:ModelAssets;painting:HTMLImageElement;camera:ReturnType<typeof createViewportState>;hidden:Map<HTMLElement,boolean>;label:string;bookmark:InspectionBookmark}|null=null;
|
|
153
162
|
let rigDifferenceFailure:string|null=null;
|
|
154
163
|
const rigRaster={el,canvas:partsCanvas,message,reference:()=>null,frameSize:()=>({w:partsCanvas.width,h:partsCanvas.height}),active:()=>!!rigDifference};
|
|
@@ -156,7 +165,9 @@ if(partsOnly){partsCanvas.id='parts-canvas';el('rig-root').append(partsCanvas);e
|
|
|
156
165
|
let sceneComposite:ReturnType<typeof bindScenePlates>|undefined;
|
|
157
166
|
const activeScene=()=>sceneComposite&&data.direction&&(!stageSource||stageSource.url===inspectedModel?.url)?data.direction:undefined;
|
|
158
167
|
const sceneBox=()=>{const direction=activeScene();return direction?takeSample(direction,time).box:null;};
|
|
159
|
-
const
|
|
168
|
+
const rebuildFramingBoxes=new WeakMap<ModelAssets,PoseBounds>();
|
|
169
|
+
const viewportProvider=partsOnly?createPartsViewportProvider({el,canvas:partsCanvas,message,reference:()=>partsReference.width>0?partsReference:null,frameSize:target=>target==='reference'&&activeInterviewImage&&referenceSize?{w:referenceSize.width,h:referenceSize.height}:partsSubject?.frameSize(target)??null},viewportState):createRigViewportProvider({fitLabel:'Fit',framingBox:()=>sceneBox()??(assets?rebuildFramingBoxes.get(assets)??null:null),el,player:()=>player,assets:()=>assets,referenceSize:()=>referenceSize,view:()=>view,referenceGeneration:()=>referenceGeneration,parts:()=>parts,text,message,redrawOverlay,raster:rigRaster},viewportState);
|
|
170
|
+
const viewport=createViewportController(viewportProvider,viewportState);
|
|
160
171
|
const {fitCamera,paneFrame,availableCamera,alignCameras,renderCameraControls,setCameraSync,cameraAction,updateCamera,fitActiveCamera}=viewport;
|
|
161
172
|
// First, before any URL use: take the `#cap=` handoff into memory/session storage and strip it.
|
|
162
173
|
if(!host)connectLiveWindow(access);
|
|
@@ -266,6 +277,11 @@ function message(value: string, error = false, footerOnly = false, diagnostic?:
|
|
|
266
277
|
if (footerOnly) return;
|
|
267
278
|
// The modal makes the footer inert; the review dialog repeats the latest message for its reader.
|
|
268
279
|
text('review-message', value); el('review-message').classList.toggle('error', error);
|
|
280
|
+
if(host&&error&&rigInspector.act.hidden&&!rigInspector.answersRendered){
|
|
281
|
+
for(const node of rigInspector.act.querySelectorAll<HTMLElement>('#save,#review-status,label[for="review-status"]'))node.hidden=true;
|
|
282
|
+
rigInspector.act.hidden=false;
|
|
283
|
+
rigInspector.syncActRow?.();
|
|
284
|
+
}
|
|
269
285
|
// A background refusal names its code and origin on hover; only Submit's own catch changes the act bar.
|
|
270
286
|
if (diagnostic) el('message').title = diagnostic;
|
|
271
287
|
}
|
|
@@ -296,14 +312,18 @@ function updateSavedState(): void {
|
|
|
296
312
|
button('save').disabled = saving || draftConflict || !!readOnly || session.feedbackWarnings.length > 0;
|
|
297
313
|
button('save').title = actReadOnly ? actReadOnly : session.feedbackWarnings.length ? 'Delete feedback with validation warnings, then add it again with a valid target.' : '';
|
|
298
314
|
renderDraftState();
|
|
315
|
+
renderAnswerControls();
|
|
299
316
|
}
|
|
300
317
|
|
|
301
318
|
/** C10: the act bar renders the latest local draft status; rig only classifies it. Nothing renders before the first status. */
|
|
302
319
|
let liveIssueCount=()=>session?.feedback.length??0;
|
|
303
320
|
function renderDraftState(): void {
|
|
304
321
|
const live=host?.reviewState?.(liveIssueCount(),saving);
|
|
305
|
-
|
|
306
|
-
|
|
322
|
+
renderAnswerControls();
|
|
323
|
+
if (draftStatus === null && !live && !answerSaved) return;
|
|
324
|
+
rigInspector.actBar.setSaveState({ kind: actReadOnly ? 'read-only' : saving ? 'saving' : draftConflict ? 'failed' : dirty ? 'unsaved' : 'saved', text: draftConflict ? 'Saved draft could not be restored. Your draft has not been deleted. Download or discard it before submitting.' : answerSaved ? 'Answer saved' : draftStatus&&/^(Saved local draft was not restored|Local draft could not be saved|Local draft storage unavailable|Local draft needs explicit recovery)/.test(draftStatus)?draftStatus:actReadOnly??live??draftStatus! });
|
|
325
|
+
if(answerSaved&&!saving&&!draftConflict&&!dirty&&!actReadOnly&&(host?.record||!host)&&
|
|
326
|
+
(host?.pendingSubjects?.()??pendingAnswers).every(subject=>subject.kind==='interview-picks')&&!el('message').classList.contains('error'))message(sourceTextContent(el('dirty')),false,true);
|
|
307
327
|
}
|
|
308
328
|
|
|
309
329
|
function renderProvenance(): void {
|
|
@@ -356,6 +376,7 @@ async function chooseCheckpoint(point: Checkpoint,initial?:{referenceId?:string;
|
|
|
356
376
|
}
|
|
357
377
|
|
|
358
378
|
function renderCheckpoint(): void {
|
|
379
|
+
el('checkpoint-detail').hidden=!checkpoint;
|
|
359
380
|
text('checkpoint-title', checkpoint?.title ?? 'Review entire package');
|
|
360
381
|
text('detail-title', checkpoint?.title ?? 'No checkpoint supplied');
|
|
361
382
|
text('detail-note', checkpoint?.note ?? 'Record checkpoint notes and outcomes.');
|
|
@@ -366,6 +387,7 @@ function renderCheckpoint(): void {
|
|
|
366
387
|
|
|
367
388
|
function setView(value: typeof view): void {view=value;renderLayout();}
|
|
368
389
|
function chooseInspectionView(id:string):void {
|
|
390
|
+
if(activeInterviewImages){const image=activeInterviewImages[Number(id.replace('interview-image-',''))];if(id.startsWith('interview-image-')&&image){activeInterviewImage=image;void showReference('',image);}return;}
|
|
369
391
|
if(!partsSubject){
|
|
370
392
|
if(id==='difference'){
|
|
371
393
|
const reason=rigDifferenceReason();if(reason){message(reason,true);renderLayout();return;}
|
|
@@ -408,10 +430,12 @@ function leaveRigDifference():void {
|
|
|
408
430
|
function layoutEligibility(){return singleEligibility({rig:rigInput,reference:referenceInput,requested:view});}
|
|
409
431
|
/** Unavailable layouts stay visible but disabled with their named reason; no placeholder pane stands in for a missing input. */
|
|
410
432
|
function renderLayout():void {
|
|
433
|
+
el('play').hidden=selectedInspector()!=='playback';
|
|
411
434
|
if(rigDifference&&(rigDifferenceReason()||rigDifference.assets!==assets||rigDifference.painting!==el('reference-content').querySelector('img')))leaveRigDifference();
|
|
412
435
|
const state=layoutEligibility();effectiveView=state.effective;
|
|
413
436
|
for(const id of controls.viewModeIds)if(id!=='difference')controls.setDisabled(id,state.reasons[id as SingleLayout]??null);
|
|
414
|
-
controls.setMode(
|
|
437
|
+
if(activeInterviewImages)controls.setMode('interview-image-'+activeInterviewImages.indexOf(activeInterviewImage!));
|
|
438
|
+
else controls.setMode(rigDifference||partsSubject?.comparison().mode==='difference'?'difference':state.effective,state.effective??state.requested);
|
|
415
439
|
if(partsSubject){controls.setDisabled('difference',partsSubject.differenceAvailable()&&rigInput.state==='loaded'&&referenceInput.state==='loaded'?null:tr('PARTS_DIFFERENCE_UNAVAILABLE: missing painting_in_rig declaration or painting_in_rig.json sidecar and its bound operand.'));if(partsSubject.comparison().mode==='difference')controls.setMode('difference');}
|
|
416
440
|
if(!partsSubject){controls.setDisabled('difference',tr(rigDifferenceReason()??'')||null);if(rigDifference)controls.setMode('difference');}
|
|
417
441
|
el('reference-pane').hidden=state.effective!=='compare'&&state.effective!=='reference';el('rig-pane').hidden=state.effective!=='compare'&&state.effective!=='rig';
|
|
@@ -486,17 +510,17 @@ function renderSequenceFrame(): void {
|
|
|
486
510
|
for (const [name, joint] of Object.entries(person.joints)) { if (!joint.at || joint.state === 'missing') continue; const dot = svgNode('circle', { cx: joint.at[0], cy: joint.at[1], r: 4, fill: joint.state === 'observed' ? '#c6e6d7' : '#294535', stroke: '#c6e6d7', 'stroke-width': 1.5 }, sequenceSvg); const title = document.createElementNS(sequenceSvg.namespaceURI, 'title'); title.textContent = `${name}: ${joint.state}${joint.score === undefined ? '' : ` · score ${joint.score}`}`; dot.append(title); }
|
|
487
511
|
}
|
|
488
512
|
|
|
489
|
-
async function showReference(id: string): Promise<void> {
|
|
513
|
+
async function showReference(id: string, bound?:{name:string;src:string}): Promise<void> {
|
|
490
514
|
rigDifferenceFailure=null;leaveRigDifference();
|
|
491
515
|
const generation = ++referenceGeneration;
|
|
492
516
|
video?.pause(); video = null;controlledVideoSample=null;delete viewport.state.cameraFrames.reference; viewport.state.referenceCenter=null; referenceSize = null; sequence = null; sequenceSvg = null; selectedPerson=''; lastPoseFrame = -1; el('person-control').hidden = true;
|
|
493
517
|
const content = el('reference-content'); content.replaceChildren();
|
|
494
|
-
const reference = data.manifest.references.find(item => item.id === id);
|
|
518
|
+
const reference = bound?{id:'',label:bound.name,type:'image' as const,path:''}:data.manifest.references.find(item => item.id === id);
|
|
495
519
|
el('reference-empty').hidden = false;setReferenceInput(reference?{state:'pending'}:{state:'absent'});
|
|
496
520
|
if (!reference) { text('reference-empty', 'No reference supplied.'); text('reference-info', 'Add image, video or input-pose references to the package.'); return; }
|
|
497
521
|
text('reference-label', reference.label + (reference.type === 'pose' ? ' · Static input pose' : ' · Reference'));
|
|
498
522
|
text('reference-empty', 'Loading reference…');
|
|
499
|
-
text('reference-info', `${reference.type} · ${data.sourcePainting?.id === reference.id ? data.sourcePainting.path : reference.path}`);
|
|
523
|
+
text('reference-info', `${reference.type} · ${bound?bound.name:data.sourcePainting?.id === reference.id ? data.sourcePainting.path : reference.path}`);
|
|
500
524
|
const fail = (reason='reference could not render') => { if (generation !== referenceGeneration) return; setReferenceInput({state:'failed',reason}); el('reference-empty').hidden = false; text('reference-empty', 'Could not open the reference. Check the package files.'); };
|
|
501
525
|
try {
|
|
502
526
|
if (reference.type === 'pose') {
|
|
@@ -523,8 +547,9 @@ async function showReference(id: string): Promise<void> {
|
|
|
523
547
|
}
|
|
524
548
|
content.append(svg); el('reference-empty').hidden = true; setReferenceInput({state:'loaded'});
|
|
525
549
|
} else if (reference.type === 'image') {
|
|
526
|
-
const image = new Image(); image.draggable=false; image.alt = reference.label; image.onload = () => { if (generation !== referenceGeneration) return; referenceSize = { width: image.naturalWidth, height: image.naturalHeight }; image.width = image.naturalWidth; image.height = image.naturalHeight; el('reference-empty').hidden = true; fitCamera(); }; await new Promise<void>((resolve,reject)=>{const loaded=image.onload;const timer=setTimeout(()=>reject(new Error('Reference image load timed out')),10000);image.onload=event=>{clearTimeout(timer);if(typeof loaded==='function')loaded.call(image,event);resolve();};image.onerror=()=>{clearTimeout(timer);fail();reject(new Error('Reference image load failed'));};image.src=referenceUrl(reference);content.append(image);});
|
|
527
|
-
await image.decode(); if (generation !== referenceGeneration) return;
|
|
550
|
+
const image = new Image(); image.draggable=false; image.alt = reference.label; image.onload = () => { if (generation !== referenceGeneration) return; referenceSize = { width: image.naturalWidth, height: image.naturalHeight }; image.width = image.naturalWidth; image.height = image.naturalHeight; el('reference-empty').hidden = true; fitCamera(); }; await new Promise<void>((resolve,reject)=>{const loaded=image.onload;const timer=setTimeout(()=>reject(new Error('Reference image load timed out')),10000);image.onload=event=>{clearTimeout(timer);if(typeof loaded==='function')loaded.call(image,event);resolve();};image.onerror=()=>{clearTimeout(timer);fail();reject(new Error('Reference image load failed'));};image.src=bound?.src??referenceUrl(reference);content.append(image);});
|
|
551
|
+
await image.decode(); if (generation !== referenceGeneration) return;
|
|
552
|
+
if (!image.naturalWidth || !image.naturalHeight) throw new Error('Reference image has no renderable pixels'); setReferenceInput({state:'loaded'});
|
|
528
553
|
} else {
|
|
529
554
|
const media = document.createElement('video'); media.controls = true; media.muted = true; media.preload = 'metadata'; media.playsInline = true;
|
|
530
555
|
media.onloadedmetadata = () => { if (generation !== referenceGeneration) return; referenceSize = { width: media.videoWidth, height: media.videoHeight }; media.width = media.videoWidth; media.height = media.videoHeight; if (Number.isFinite(media.duration) && !player) duration = media.duration; el('reference-empty').hidden = true; holdVideoReference(media, generation); fitCamera(); renderTransport(); };
|
|
@@ -577,7 +602,7 @@ function renderFeedbackTargets(preserve = false): void {
|
|
|
577
602
|
function renderFrameTransport(): void {
|
|
578
603
|
const active = activeTransportClock(), clock = active?.clock ?? null;
|
|
579
604
|
const last = lastProducerFrame(clock), frame = frameAtTime(clock, time);
|
|
580
|
-
text('rig-label', rigPaneLabel({ hasPlayer: !!player, animation: player?.current ?? animation, time, frame }));
|
|
605
|
+
text('rig-label', host?.direction&&data.direction ? `Take · ${data.direction.take.duration} s` : rigPaneLabel({ hasPlayer: !!player, animation: player?.current ?? animation, time, frame }));
|
|
581
606
|
el('frame-controls').hidden = last === null;
|
|
582
607
|
if (!clock) { text('frame-label', data.report?.clock ? data.report.animation ? 'Frame unknown · report and current clip do not match' : 'Frame unknown · report animation not supplied' : 'rate unknown'); return; }
|
|
583
608
|
if (last === null) { text('frame-label', 'F? / ? · frame range unknown'); return; }
|
|
@@ -1002,6 +1027,7 @@ function downloadStrip(name: string, content: Blob): void {
|
|
|
1002
1027
|
function stripStatus(value: string, error = false): void { text('strip-status', value); el('strip-status').setAttribute('role', error ? 'alert' : 'status'); }
|
|
1003
1028
|
|
|
1004
1029
|
function updateStripControls(): void {
|
|
1030
|
+
el('strip-panel').hidden=!!readOnly||!data.manifest.references.some(reference=>reference.type==='video');
|
|
1005
1031
|
el('strip-panel').setAttribute('aria-busy', String(stripBusy));
|
|
1006
1032
|
for (const id of ['strip-scope', 'strip-reference', 'strip-format']) select(id).disabled = stripBusy;
|
|
1007
1033
|
button('strip-export').disabled = stripBusy || !!readOnly; button('strip-export').title = readOnly ?? ''; button('strip-export').textContent = stripBusy ? 'Generating strip…' : 'Download strip';
|
|
@@ -1182,6 +1208,7 @@ function bind(): void {
|
|
|
1182
1208
|
viewDisposers.push(()=>directionPanel?.dispose());
|
|
1183
1209
|
bindWorkspace(!!data.manifest.model);
|
|
1184
1210
|
overlays=new RigOverlays({canvas:el<HTMLCanvasElement>('rig-overlay'),rigRoot:el('rig-root')});
|
|
1211
|
+
verdictSubmit=button('save').onclick as ((event:MouseEvent)=>unknown)|null;
|
|
1185
1212
|
chestEditor=bindChestEditor({pane:el('rig-pane'),canvas:el('rig-overlay'),project:()=>player?rigProject():null,mapping:()=>activeChestMapping(),changed:renderChest,download:()=>{void exportChest();},apply:()=>{void applyRebuild();},reset:()=>{void resetRebuild();},message,inspector:()=>selectedInspector()});viewDisposers.push(()=>chestEditor?.dispose());
|
|
1186
1213
|
meshEditor=bindMeshEditor({pane:el('rig-pane'),canvas:el('rig-overlay'),project:()=>player?rigProject():null,mapping:()=>chestMapping,inspector:()=>selectedInspector(),source:meshSource,pause,changed:()=>redrawOverlay(false),download:doc=>{void exportMesh(doc);},apply:(doc,line)=>applyMeshDelta(doc,line),applied:()=>appliedOnStage?.schema==='rig-review-applied/3',resetBuild:()=>resetRebuild(stageWorld()),message,confirm:text=>window.confirm(tr(text)),token:name=>getComputedStyle(document.documentElement).getPropertyValue(name).trim()});viewDisposers.push(()=>meshEditor?.dispose());
|
|
1187
1214
|
weightsView=bindWeightsView({pane:el('rig-pane'),canvas:el('rig-overlay'),project:()=>player?rigProject():null,inspector:()=>selectedInspector(),slot:()=>parts?.value()?.slot??stageDraftSelection?.slot??null,
|
|
@@ -1243,7 +1270,8 @@ function bindWorkspace(hasModel=false):void {
|
|
|
1243
1270
|
viewport.state.cameraSync=workspace.defaults().defaultCameraSync;input('camera-sync').checked=viewport.state.cameraSync;input('idle-repeat').checked=workspace.defaults().defaultIdleRepeat;
|
|
1244
1271
|
appearance=bindAppearance(select('settings-theme'),workspace.defaults().theme);
|
|
1245
1272
|
bindReviewDialog();
|
|
1246
|
-
|
|
1273
|
+
screenRoot.querySelector<HTMLElement>('.inspector-body')!.append(questionPanel);
|
|
1274
|
+
inspectorBlocks=bindInspectorBlocks({sections:[el('inspector-rig'),el('inspector-playback')],available:host?.record&&(!host.record.hasPicture||!hasModel&&!partsOnly)?['feedback']:undefined,bottom:{strip:rigInspector.strip,comment:rigInspector.comments.button,panel:rigInspector.comments.panel},changed:()=>{syncQuestionImage();workspace?.refresh();persistence?.save();}});
|
|
1247
1275
|
}
|
|
1248
1276
|
async function start(): Promise<void> {
|
|
1249
1277
|
try {
|
|
@@ -1264,8 +1292,8 @@ async function start(): Promise<void> {
|
|
|
1264
1292
|
if (!data.manifest.references.length) { select('reference-select').append(option('', 'No references supplied')); select('reference-select').disabled = true; }
|
|
1265
1293
|
// Checkpoints and reference fold away when the package supplies neither.
|
|
1266
1294
|
(el('package-context') as HTMLDetailsElement).open = data.manifest.checkpoints.length > 0 || data.manifest.references.length > 0;
|
|
1267
|
-
const sourceFiles = el('source-files'); for (const file of data.manifest.authoring) { const a = document.createElement('a'); a.href = assetUrl(file.path); a.textContent = file.label; a.className = 'source-link'; a.target = '_blank'; a.rel = 'noopener'; sourceFiles.append(a); } if (!data.manifest.authoring.length) sourceFiles.textContent = 'No source files supplied';
|
|
1268
|
-
populateChestBones(); bind(); parts=new PartExplorer(el('workspace-left'),el('selected-part'),previous=>{if(rigDifference){leaveRigDifference();renderLayout();}const part=parts?.value();if(!stageCorrectionRebinding&&(previous?.side!==part?.side||previous?.slot!==part?.slot||previous?.mode!==part?.mode))stageDraftRequestToken++;if(player&&inspectionSourceState==='ready')animationPanel?.capture(player,parts?.frame('single'));else animationPanel?.capture(null,undefined);weightsView?.refresh();redrawOverlay(true);meshEditor?.selectionChanged();if(stageCorrectionPart&&!stageCorrectionRebinding&&(part?.slot??null)!==stageCorrectionPart){stageCorrectionPart=null;document.getElementById('stage-draft-label')?.remove();}animationPanel?.fromParts(part?.slot??null);meshPanel?.select(part?.slot??null);requirementsPanel?.selectionChanged();renderDropNotices();if(part){viewport.state.activeCamera='rig';if(view==='reference')setView('rig');if(selectedInspector(document)!=='playback')showInspector('rig');renderCameraControls();}if(!viewport.state.cameraRestoring&&(previous?.side!==part?.side||previous?.slot!==part?.slot))cameraAction(()=>fitActiveCamera(part?'rig':availableCamera()));persistence?.save();},part=>{select('feedback-target-kind').value='slot';renderFeedbackTargets(true);input('feedback-target-name').value=part.slot;showInspector('feedback');}); animationPanel=new AnimationInspectionPanel({host:el('animation-inspection'),stage:el('rig-viewport'),project:(x,y)=>rigProject()(x,y),enabled:()=>inspectionSourceState==='ready'&&selectedInspector(document)==='playback',pause,preview:fn=>{animAdjust=fn;if(!player)return;player.adjust=composeAdjust(composeAdjust(composeAdjust(idleAdjust,dialAdjust),turnAdjust),animAdjust);if(!inDrawRig&&player.current&&!playing){if(activeScene())seek(time);else{player.seek(time);drawRig(()=>player!.draw());}}},apply:ops=>applyAnimation(ops),reset:()=>resetAnimationBuild(),seek:exact=>{if(!Number.isFinite(exact)||exact<0||exact>duration){message('KEY_TIME_OUT_OF_DOMAIN: no substitute time was used.',true);return;}seekMarker(animation,exact,'Stored key');},select:value=>{const slot=value?.kind==='slot'?value.name:null;if((parts?.value()?.slot??null)!==slot)parts?.select(slot?{side:'single',slot,mode:parts?.value()?.mode??'context'}:null);parts?.highlightBone(value?.kind==='bone'?value.name:null);redrawOverlay(false);}});viewDisposers.push(()=>animationPanel?.dispose()); updateStripControls(); stripStatus('Choose the entered start–end frames or all feedback ranges to download. Unsubmitted feedback is included; exporting does not submit the review.'); renderFeedbackTargets(true); renderFeedbackRange(); renderCheckpoints(); renderProposals(); renderProvenance(); updateSavedState(); renderCues(); initReport();
|
|
1295
|
+
const sourceFiles = el('source-files'); for (const file of data.manifest.authoring) { const a = document.createElement('a'); a.href = assetUrl(file.path); a.textContent = file.label; a.className = 'source-link'; a.target = '_blank'; a.rel = 'noopener'; sourceFiles.append(a); } if (!data.manifest.authoring.length) sourceFiles.textContent = 'No source files supplied';sourceFiles.parentElement!.hidden=!data.manifest.authoring.length;
|
|
1296
|
+
populateChestBones(); bind(); parts=new PartExplorer(el('workspace-left'),el('selected-part'),previous=>{if(rigDifference){leaveRigDifference();renderLayout();}const part=parts?.value();if(!stageCorrectionRebinding&&(previous?.side!==part?.side||previous?.slot!==part?.slot||previous?.mode!==part?.mode))stageDraftRequestToken++;if(player&&inspectionSourceState==='ready')animationPanel?.capture(player,parts?.frame('single'));else animationPanel?.capture(null,undefined);weightsView?.refresh();redrawOverlay(true);meshEditor?.selectionChanged();if(stageCorrectionPart&&!stageCorrectionRebinding&&(part?.slot??null)!==stageCorrectionPart){stageCorrectionPart=null;document.getElementById('stage-draft-label')?.remove();}animationPanel?.fromParts(part?.slot??null);meshPanel?.select(part?.slot??null);if(part&&!stageCorrectionRebinding)void openStageCorrection({part:part.slot,instrument:'selection'});requirementsPanel?.selectionChanged();renderDropNotices();if(part){viewport.state.activeCamera='rig';if(view==='reference')setView('rig');if(selectedInspector(document)!=='playback')showInspector('rig');renderCameraControls();}if(!viewport.state.cameraRestoring&&(previous?.side!==part?.side||previous?.slot!==part?.slot))cameraAction(()=>fitActiveCamera(part?'rig':availableCamera()));persistence?.save();},part=>{select('feedback-target-kind').value='slot';renderFeedbackTargets(true);input('feedback-target-name').value=part.slot;showInspector('feedback');}); animationPanel=new AnimationInspectionPanel({hideGateBanner:!!host?.direction,host:el('animation-inspection'),stage:el('rig-viewport'),project:(x,y)=>rigProject()(x,y),enabled:()=>inspectionSourceState==='ready'&&selectedInspector(document)==='playback',pause,preview:fn=>{animAdjust=fn;if(!player)return;player.adjust=composeAdjust(composeAdjust(composeAdjust(idleAdjust,dialAdjust),turnAdjust),animAdjust);if(!inDrawRig&&player.current&&!playing){if(activeScene())seek(time);else{player.seek(time);drawRig(()=>player!.draw());}}},apply:ops=>applyAnimation(ops),reset:()=>resetAnimationBuild(),seek:exact=>{if(!Number.isFinite(exact)||exact<0||exact>duration){message('KEY_TIME_OUT_OF_DOMAIN: no substitute time was used.',true);return;}seekMarker(animation,exact,'Stored key');},select:value=>{const slot=value?.kind==='slot'?value.name:null;if((parts?.value()?.slot??null)!==slot)parts?.select(slot?{side:'single',slot,mode:parts?.value()?.mode??'context'}:null);parts?.highlightBone(value?.kind==='bone'?value.name:null);redrawOverlay(false);}});viewDisposers.push(()=>animationPanel?.dispose()); updateStripControls(); stripStatus('Choose the entered start–end frames or all feedback ranges to download. Unsubmitted feedback is included; exporting does not submit the review.'); renderFeedbackTargets(true); renderFeedbackRange(); renderCheckpoints(); renderProposals(); renderProvenance(); updateSavedState(); renderCues(); initReport();
|
|
1269
1297
|
const requestedId = new URLSearchParams(location.search).get('checkpoint'),initial=initialReviewSelection(data.manifest,requestedId,data.explicitReference?.id,data.initialAnimation??undefined),first=initial.checkpoint;
|
|
1270
1298
|
rigInput=data.manifest.model?{state:'pending'}:{state:'absent'};renderLayout();
|
|
1271
1299
|
// A job rig subject lands in Animate before the model finishes loading (#709).
|
|
@@ -1279,10 +1307,10 @@ async function start(): Promise<void> {
|
|
|
1279
1307
|
viewport.state.activeCamera=player?'rig':'reference';if(viewport.state.cameraSync)alignCameras();renderTransport();fitCamera();
|
|
1280
1308
|
if (requestedId && !first) message(`Checkpoint "${requestedId}" is not in this package. Select one from the list.`, true);
|
|
1281
1309
|
else if (actReadOnly) message(actReadOnly, true);
|
|
1282
|
-
else if (host?.ownerActAccess) message('Not submitted');
|
|
1310
|
+
else if (host?.ownerActAccess) message('Not submitted',false,true);
|
|
1283
1311
|
else message(data.manifest.model ? 'Record review status and structured feedback while preserving sources. Motion is read only.' : 'No rig supplied. Review the available references and checkpoints.');
|
|
1284
1312
|
frameHandle=requestAnimationFrame(tick);
|
|
1285
|
-
const restored=await setupPersistence();setupComments();if(host?.direction)showRecordComments(true);else if(host?.record&&!data.manifest.model)showRecordComments();await loadRebuildStatus();void loadRequirements();renderChest();restoreEnvironment();physicsPanel?.restore();bonesPanel?.restore();cutsPanel?.restore();clothPanel?.restore();idlePanel?.restore();rigFieldsPanel?.restore();meshPanel?.restore();void refreshDensityStrip();renderIdle();if(idlePreviewOnOpen(restored,!!host)&&canRepeatIdle()&&automaticIdlePreview(assets?.animations.map(item=>item.name)??[],animation,first,!!requestedId))void playPreview();
|
|
1313
|
+
const restored=await setupPersistence();setupComments();renderPendingSubjects(host?.pendingSubjects?.()??[{kind:'review-verdict',stage:'rig-review'}]);if(host?.direction)showRecordComments(true);else if(host?.record&&!data.manifest.model)showRecordComments();await loadRebuildStatus();void loadRequirements();renderChest();restoreEnvironment();physicsPanel?.restore();bonesPanel?.restore();cutsPanel?.restore();clothPanel?.restore();idlePanel?.restore();rigFieldsPanel?.restore();meshPanel?.restore();void refreshDensityStrip();renderIdle();if(idlePreviewOnOpen(restored,!!host)&&canRepeatIdle()&&automaticIdlePreview(assets?.animations.map(item=>item.name)??[],animation,first,!!requestedId))void playPreview();
|
|
1286
1314
|
// Only an instance that serves agent control is asked for its config: a plain open has no control endpoint (#164).
|
|
1287
1315
|
if(!readOnly&&writes.control!==false)controlDispose=connectControl({sourceHash:data.sourceHash,mode:'single',route:access.route,headers:()=>access.headers(),observe:controlState,apply:applyControl,onStatus:value=>text('control-state',value)});
|
|
1288
1316
|
bindWorkspaceVisibility({key:access.key,sourceHash:data.sourceHash,pause});
|
|
@@ -1301,7 +1329,7 @@ async function start(): Promise<void> {
|
|
|
1301
1329
|
}
|
|
1302
1330
|
/** Parts have a verdict and image-space pixels, never fabricated model/session fields. */
|
|
1303
1331
|
async function startParts(opened:PartsSubjectEntry,saved:PartsSubjectSession,writes:{capabilityRequired:boolean}):Promise<void>{
|
|
1304
|
-
const subject=opened.parts,issues=saved.issues
|
|
1332
|
+
const subject=opened.parts,issues=saved.issues;let partsBaseline=structuredClone(saved);const submittedIssues=new Set(host? saved.issues.map(issue=>issue.id):[]);
|
|
1305
1333
|
liveIssueCount=()=>issues.length;
|
|
1306
1334
|
if(!partsOnly)throw new Error('PARTS_SUBJECT_ENTRY_REQUIRED');
|
|
1307
1335
|
readOnly=host?.record?tr('JOB_REVIEW_READ_ONLY'):readOnlyReason(access,writes.capabilityRequired);
|
|
@@ -1313,17 +1341,19 @@ async function startParts(opened:PartsSubjectEntry,saved:PartsSubjectSession,wri
|
|
|
1313
1341
|
const response=await fetch(access.route(path),{...init,headers:access.headers(init?.headers)});
|
|
1314
1342
|
if(!response.ok){const body=await response.json();throw new Error(typeof body.error==='string'?body.error:body.error?.code??'PARTS_PAINT_FAILED');}return response;
|
|
1315
1343
|
};
|
|
1316
|
-
const changed=()=>{dirty=true;text('dirty','Unsubmitted changes');el('dirty').classList.add('dirty');parts?.refreshImages();rigInspector.actBar.setSaveState({kind:'unsaved',text:'Unsubmitted changes'});renderDraftState();setSourceText(rigInspector.comments.button,`Comments (${issues.length})`);};
|
|
1344
|
+
const changed=()=>{dirty=true;text('dirty','Unsubmitted changes');el('dirty').classList.add('dirty');parts?.refreshImages();rigInspector.actBar.setSaveState({kind:'unsaved',text:'Unsubmitted changes'});renderDraftState();setSourceText(rigInspector.comments.button,`Comments (${issues.length})`);return persistence?.save();};
|
|
1317
1345
|
// A parts verdict is saved only over a drawn subject: until the first paint, or after a failed one, Save stays off.
|
|
1318
|
-
const saveBlocked=()=>!!readOnly||!!subject.legacyVerdict?.readOnly||rigInput.state!=='loaded';
|
|
1346
|
+
const saveBlocked=()=>!!readOnly||!!subject.legacyVerdict?.readOnly||rigInput.state!=='loaded'||draftConflict||!!persistence?.restoring();
|
|
1347
|
+
partsAnswerBlocked=saveBlocked;
|
|
1319
1348
|
text('rig-empty','Loading package…');
|
|
1320
|
-
partsSubject=bindPartsSubject({data:subject,canvas:partsCanvas,referenceCanvas:partsReference,viewport,el,toolbar:primaryToolbar,commentsHost:el('comments-list-host'),issues,...host?.record?{recordComments}:{},request,base,paintingPath:host?'/review-painting':'/api/parts/painting',mesh:()=>layers.mesh,restoreMesh:on=>{layers.mesh=on;input('layer-mesh').checked=on;},images:()=>layers.images,changed:()=>{if(host?.record){recordCommentsChanged();return;}changed();},selectionChanged:()=>parts?.refreshImages(),locked:id=>submittedIssues.has(id),refusal:()=>readOnly,drawn:state=>{rigInput=state;button('save').disabled=saveBlocked();if(state.state==='failed')text('rig-empty',state.reason);text('renderer-state',state.state==='loaded'?'Parts raster drawn · Canvas2D':'Rendering failed');text('player-state',state.state==='loaded'?'Parts images · no compiled rig loaded':'Rig load failed');renderLayout();},message});
|
|
1349
|
+
partsSubject=bindPartsSubject({data:subject,canvas:partsCanvas,referenceCanvas:partsReference,viewport,el,toolbar:primaryToolbar,commentsHost:el('comments-list-host'),openComments:openReview,hasPicture:()=>!hasTransientQuestionImage(screenRoot),issues,...host?.record?{recordComments}:{},request,base,paintingPath:host?'/review-painting':'/api/parts/painting',mesh:()=>layers.mesh,restoreMesh:on=>{layers.mesh=on;input('layer-mesh').checked=on;},images:()=>layers.images,changed:()=>{if(host?.record){recordCommentsChanged();return;}return changed();},selectionChanged:()=>parts?.refreshImages(),locked:id=>submittedIssues.has(id),refusal:()=>readOnly,drawn:state=>{rigInput=state;button('save').disabled=saveBlocked();renderAnswerControls();if(state.state==='failed')text('rig-empty',state.reason);text('renderer-state',state.state==='loaded'?'Parts raster drawn · Canvas2D':'Rendering failed');text('player-state',state.state==='loaded'?'Parts images · no compiled rig loaded':'Rig load failed');renderLayout();},message});
|
|
1321
1350
|
parts=new PartExplorer(el('workspace-left'),el('selected-part'),()=>{},()=>openReview());
|
|
1322
1351
|
const thumbnails=new PartThumbnails();viewDisposers.push(()=>thumbnails.dispose());
|
|
1323
1352
|
parts.registerImages({thumbnail:(icon,item,glyph)=>thumbnails.showOriginal(icon,item,()=>partsSubject!.image(item.index),glyph),items:subject.items,selected:partsSubject.selected,solo:partsSubject.solo,visible:partsSubject.visible,select:partsSubject.select,isolate:partsSubject.isolate,show:partsSubject.show});
|
|
1324
1353
|
const unavailable='PARTS_RIG_UNAVAILABLE: this parts subject has no compiled rig.';
|
|
1325
1354
|
for(const node of el('proposal-panel').children)if(node.id!=='comments-list-host')(node as HTMLElement).hidden=true;
|
|
1326
1355
|
for(const control of document.querySelectorAll<HTMLInputElement|HTMLSelectElement|HTMLButtonElement>('#checkpoint-detail input,#proposal-panel input,#proposal-panel select,#proposal-panel button,#strip-panel input,#strip-panel select,#strip-panel button'))if(!control.closest('#comments-list-host')){control.disabled=true;setSourceAttribute(control,'title',unavailable);if(control instanceof HTMLInputElement&&control.name==='outcome')control.checked=false;}
|
|
1356
|
+
el('checkpoint-detail').hidden=true;
|
|
1327
1357
|
text('detail-note',unavailable);text('checkpoint-note','');el('strip-panel').hidden=true;
|
|
1328
1358
|
text('provenance-version','Parts package, before rigging');text('provenance-rig','Not supplied');text('provenance-motion','Not supplied');
|
|
1329
1359
|
text('provenance-full',JSON.stringify({subject:'parts',sourceHash:subject.sourceHash,painting:subject.painting,images:subject.items.map(({name,imageHash})=>({name,imageHash}))},null,2));
|
|
@@ -1351,14 +1381,28 @@ async function startParts(opened:PartsSubjectEntry,saved:PartsSubjectSession,wri
|
|
|
1351
1381
|
try{
|
|
1352
1382
|
if(host?.submitParts)message(await host.submitParts(frozen));
|
|
1353
1383
|
else await request(base+'/verdict',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({status:frozen.length?'changes-requested':'approved',issues:frozen})});
|
|
1384
|
+
if(disposed)return;
|
|
1354
1385
|
if(host)for(const issue of frozen)submittedIssues.add(issue.id);
|
|
1355
|
-
dirty=JSON.stringify(issues)!==JSON.stringify(frozen);state.setSaveState({kind:dirty?'unsaved':'saved',text:dirty?'Unsubmitted changes':'Submitted'});text('dirty',dirty?'Unsubmitted changes':'Submitted');el('dirty').classList.toggle('dirty',dirty);
|
|
1386
|
+
dirty=JSON.stringify(issues)!==JSON.stringify(frozen);partsBaseline={subject:'parts',issues:frozen};await persistence?.submitted(partsBaseline);if(disposed)return;state.setSaveState({kind:dirty?'unsaved':'saved',text:dirty?'Unsubmitted changes':'Submitted'});text('dirty',dirty?'Unsubmitted changes':'Submitted');el('dirty').classList.toggle('dirty',dirty);
|
|
1356
1387
|
}catch(error){message(errorText(error),true);state.setSaveState({kind:'failed',text:'Save failed.'});}
|
|
1357
1388
|
finally{saving=false;button('save').disabled=saveBlocked();renderDraftState();}
|
|
1358
1389
|
};
|
|
1359
1390
|
viewDisposers.push(viewport.bindControls(unitScaleMessage),viewport.bindNavigation(undefined,()=>!el('stage-layout').getAttribute('aria-busy')?.includes('true')),bindLayerShortcuts(document));
|
|
1360
1391
|
const resize=viewport.observeResize();viewDisposers.push(()=>resize.disconnect());
|
|
1361
|
-
viewport.requestFit();await partsSubject.ready();text('dirty','Not submitted');message(actReadOnly??(host?.ownerActAccess?'Not submitted':'Parts ready. Source files remain unchanged.'),!!actReadOnly);referenceInput=subject.painting?{state:'loaded'}:{state:'absent'};renderLayout();
|
|
1392
|
+
viewport.requestFit();await partsSubject.ready();text('dirty','Not submitted');message(actReadOnly??(host?.ownerActAccess?'Not submitted':'Parts ready. Source files remain unchanged.'),!!actReadOnly,!!host?.ownerActAccess&&!actReadOnly);referenceInput=subject.painting?{state:'loaded'}:{state:'absent'};renderLayout();
|
|
1393
|
+
setupPartsPersistence=async()=>{
|
|
1394
|
+
if(host?.record)return;
|
|
1395
|
+
const binding:InspectionBinding={mode:'single',sourceHash:subject.sourceHash,rigs:[null]};
|
|
1396
|
+
const connection=await connectInspectionPersistence({scope:'parts:'+access.key+':'+access.base+':'+subject.sourceHash,binding,baseline:partsBaseline,session:()=>({subject:'parts' as const,issues}),reviewDirty:()=>dirty,
|
|
1397
|
+
recover:value=>{try{if(!value||typeof value!=='object')return null;const row=value as PartsSubjectSession;if(row.subject!=='parts'||!Array.isArray(row.issues)||row.issues.length>1000||Object.keys(row).some(key=>!['subject','issues'].includes(key)))return null;const items=new Map(subject.items.map(item=>[item.name,{...item,imageHash:item.imageHash!}]));const restored=row.issues.map(issue=>{const parsed=parsePartsIssue(issue,false,true,false);assertPartsIssueBinding(parsed,items,subject.sourceHash);return parsed;});if(new Set(restored.map(issue=>issue.id)).size!==restored.length)return null;return {subject:'parts' as const,issues:restored};}catch{return null;}},
|
|
1398
|
+
restoreSession:(value,isDirty)=>{issues.splice(0,issues.length,...value.issues);dirty=isDirty;partsSubject?.refreshComments();setSourceText(rigInspector.comments.button,`Comments (${issues.length})`);text('dirty',isDirty?'Unsubmitted changes':'Submitted');el('dirty').classList.toggle('dirty',isDirty);state.setSaveState({kind:isDirty?'unsaved':'saved',text:isDirty?'Unsubmitted changes':'Submitted'});},
|
|
1399
|
+
bookmark:()=>({schema:'rig-review-inspection/1',binding,animation:null,time:null,theme:appearance?.get()??'system',layers:{images:layers.images,meshes:layers.mesh,bones:false},view:{schema:'rig-review-view/1',cameras:{rig:null,a:null,b:null,reference:null}},selection:{}}),
|
|
1400
|
+
// Parts comments carry their own explicit view restore. Opening never replays a selection or camera.
|
|
1401
|
+
restoreBookmark:async()=>{},
|
|
1402
|
+
ui:()=>({}),restoreUI:()=>{},afterInputs:()=>{if(!dirty||issues.length===0){const current=partsSubject!.comparison();overlay.checked=current.mode==='overlay';opacity.value=String(current.opacity);return;}partsSubject!.setComparison(overlay.checked?'overlay':'part');partsSubject!.opacity(Number(opacity.value));},onConflict:value=>{draftConflict=value;button('save').disabled=saveBlocked();renderAnswerControls();},onStatus:value=>{draftStatus=value;renderDraftState();}});
|
|
1403
|
+
if(disposed){connection.dispose();return;}persistence=connection;
|
|
1404
|
+
};
|
|
1405
|
+
await setupPartsPersistence();if(disposed)return;
|
|
1362
1406
|
renderPendingSubjects(host?.pendingSubjects?.()??[{kind:'parts-verdict'}]);
|
|
1363
1407
|
if(host){await restorePublicationNavigation();host.attach({recordForms:renderRecordForms,stage:()=>null,redraw:()=>partsSubject?.redraw(),message:(value,error,diagnostic)=>message(value,error,false,diagnostic),pendingSubjects:renderPendingSubjects,...host.record?{}:{incompatible:()=>navigationMissing,navigation:()=>({subject:'parts' as const,part:partsSubject!.selected(),solo:partsSubject!.solo(),view,camera:numericView()})},suspend:suspendScreen,resume:resumeScreen,dispose:disposeScreen});host.displayed();}
|
|
1364
1408
|
|
|
@@ -1384,6 +1428,7 @@ async function startRecord(interview?:InterviewSubjectEntry):Promise<void> {
|
|
|
1384
1428
|
el('rig-pane').hidden=false;el('rig-empty').hidden=false;text('rig-empty',unavailable);
|
|
1385
1429
|
for(const region of document.querySelectorAll('.inspector,.workspace-secondary-toolbar'))for(const control of region.querySelectorAll<HTMLInputElement|HTMLSelectElement|HTMLButtonElement>('input,select,textarea,button')){control.disabled=true;setSourceAttribute(control,'title',unavailable);}
|
|
1386
1430
|
if(interview){
|
|
1431
|
+
button('stage-comment').hidden=true;
|
|
1387
1432
|
button('save').disabled=true;setSourceAttribute(button('save'),'title',unavailable);
|
|
1388
1433
|
const label=()=>{setSourceText(rigAsk,t('interview.title'));recordDialog?.setAttribute('aria-label',t('interview.title'));};
|
|
1389
1434
|
label();viewDisposers.push(onLanguageChange(label));
|
|
@@ -1397,6 +1442,13 @@ async function startRecord(interview?:InterviewSubjectEntry):Promise<void> {
|
|
|
1397
1442
|
if(!interview){host!.attach({recordForms:renderRecordForms,pendingSubjects:renderPendingSubjects,stage:()=>null,redraw:()=>{},message:(value,error,diagnostic)=>message(value,error,false,diagnostic),suspend:suspendScreen,resume:resumeScreen,dispose:disposeScreen});host!.displayed();}
|
|
1398
1443
|
}
|
|
1399
1444
|
let recordDialog:HTMLDialogElement|null=null;
|
|
1445
|
+
let activeInterviewImages:readonly {name:string;src:string}[]|null=null;
|
|
1446
|
+
let activeInterviewImage:{name:string;src:string}|null=null;
|
|
1447
|
+
let releaseInterview:(()=>void)|null=null;
|
|
1448
|
+
const questionPanel=panelMake('section',{id:'workspace-interview-answer',className:'workspace-interview-panel',hidden:true});
|
|
1449
|
+
let questionForms:readonly HTMLElement[]=[];
|
|
1450
|
+
let questionFormBindings=new WeakSet<HTMLElement>();
|
|
1451
|
+
|
|
1400
1452
|
/** Reuse the form's publication binding for native record comments, without a package session. */
|
|
1401
1453
|
function restoreRecordComments(form?:HTMLFormElement):void {
|
|
1402
1454
|
if((!host?.record&&!host?.direction)||recordCommentKey)return;
|
|
@@ -1427,11 +1479,62 @@ function recordCommentsChanged():void {
|
|
|
1427
1479
|
if(!host?.record&&!host?.direction)return;
|
|
1428
1480
|
try{if(recordCommentKey)localStorage.setItem(recordCommentKey,JSON.stringify({status:select('review-status').value,publicationId:host?.direction?.publicationId??host?.record?.publicationId??recordDialog?.querySelector<HTMLFormElement>('form[data-job-ask]')?.dataset.jobPublication,sourceHash:host?.direction?.sourceHash??host!.record!.sourceHash,comments:recordComments}));}catch{/* In-memory comments remain bound to this host. */}
|
|
1429
1481
|
setSourceText(rigInspector.comments.button,`Comments (${recordComments.length})`);
|
|
1482
|
+
renderAnswerControls();
|
|
1430
1483
|
for(const form of recordDialog?.querySelectorAll('form[data-job-ask]')??[])form.dispatchEvent(new Event('input',{bubbles:true}));
|
|
1431
1484
|
}
|
|
1432
|
-
/**
|
|
1485
|
+
/** #834's transient reference viewport, owned only while the Question tab is selected. */
|
|
1486
|
+
function syncQuestionImage():void {
|
|
1487
|
+
if(disposed){releaseInterview?.();releaseInterview=null;return;}
|
|
1488
|
+
const selected=questionForms.length>0&&inspectorBlocks?.state()[selectedInspector()??'rig']==='question';
|
|
1489
|
+
if(!selected){releaseInterview?.();releaseInterview=null;return;}
|
|
1490
|
+
if(releaseInterview)return;
|
|
1491
|
+
const images=(questionForms[0] as HTMLElement&{interviewImages:readonly {name:string;src:string}[]}).interviewImages;
|
|
1492
|
+
if(!images.length)return;
|
|
1493
|
+
const previousView=view,previousCamera=structuredClone(viewport.state);viewport.cancelFit();
|
|
1494
|
+
const previousReferenceNodes=[...el('reference-content').childNodes],previousReferenceInput=referenceInput,previousReferenceSize=referenceSize;
|
|
1495
|
+
const previousMedia={video,controlledVideoSample,sequence,sequenceSvg,selectedPerson,lastPoseFrame};
|
|
1496
|
+
const previousLabels=['reference-empty','reference-label','reference-info','person-control'].map(id=>({node:el(id),html:id==='person-control'?undefined:el(id).innerHTML,hidden:el(id).hidden}));
|
|
1497
|
+
const disabled=new Map(controls.zoomButtons.concat(controls.nativeOne!).map(button=>[button,button.disabled]));
|
|
1498
|
+
for(const button of disabled.keys())button.disabled=false;
|
|
1499
|
+
const cameraBindings=button('zoom-in').onclick?[]:[viewport.bindControls(unitScaleMessage),viewport.bindNavigation()];
|
|
1500
|
+
activeInterviewImages=images;activeInterviewImage=images[0]!;
|
|
1501
|
+
const restore=controls.replaceViewSwitch({currentMode:'interview-image-0',groups:[{modes:images.map((image,index)=>({id:'interview-image-'+index,labelKey:image.name,pressed:index===0}))}],onChange:chooseInspectionView});
|
|
1502
|
+
viewport.state.cameraSync=false;viewport.state.activeCamera='reference';view='reference';questionPanel.dataset.questionImageActive='true';
|
|
1503
|
+
releaseInterview=()=>{
|
|
1504
|
+
++referenceGeneration;activeInterviewImages=null;activeInterviewImage=null;delete questionPanel.dataset.questionImageActive;restore();
|
|
1505
|
+
for(const dispose of cameraBindings)dispose();for(const [button,value]of disabled)button.disabled=value;
|
|
1506
|
+
view=previousView;referenceInput=previousReferenceInput;referenceSize=previousReferenceSize;
|
|
1507
|
+
({video,controlledVideoSample,sequence,sequenceSvg,selectedPerson,lastPoseFrame}=previousMedia);
|
|
1508
|
+
el('reference-content').replaceChildren(...previousReferenceNodes);
|
|
1509
|
+
for(const {node,html,hidden}of previousLabels){if(html!==undefined)node.innerHTML=html;node.hidden=hidden;}
|
|
1510
|
+
viewport.cancelFit();Object.assign(viewport.state,previousCamera,{cameraRestoring:true});
|
|
1511
|
+
if(!disposed){renderLayout();workspace?.refresh();}
|
|
1512
|
+
Object.assign(viewport.state,previousCamera);if(!disposed)fitCamera();
|
|
1513
|
+
};
|
|
1514
|
+
void showReference('',activeInterviewImage);
|
|
1515
|
+
}
|
|
1516
|
+
/** Pictured backdrop forms use the existing bottom controller; other record forms retain their dialog. */
|
|
1433
1517
|
function renderRecordForms(forms:readonly HTMLElement[],label='job.pending',standalone=false):void {
|
|
1434
|
-
if(
|
|
1518
|
+
if(standalone){pendingAnswers=[{kind:'interview-picks'}];}
|
|
1519
|
+
for(const form of forms){
|
|
1520
|
+
if(questionFormBindings.has(form))continue;questionFormBindings.add(form);
|
|
1521
|
+
form.addEventListener('submit',event=>{if(draftConflict||pendingAnswers.some(subject=>subject.kind.endsWith('verdict'))){event.preventDefault();event.stopImmediatePropagation();}},true);
|
|
1522
|
+
form.addEventListener('job-answer-saved',()=>{answerSaved=true;recordDialog?.close();renderDraftState();},{once:true});
|
|
1523
|
+
}
|
|
1524
|
+
const imageForms=forms.filter(form=>form.dataset.interviewMain!==undefined);
|
|
1525
|
+
if(imageForms.length){
|
|
1526
|
+
const added=!questionForms.length;
|
|
1527
|
+
if(questionForms[0]!==imageForms[0]){releaseInterview?.();releaseInterview=null;}
|
|
1528
|
+
for(const form of questionForms)if(!imageForms.includes(form)){form.dispatchEvent(new Event('job-form-dispose'));form.remove();}
|
|
1529
|
+
questionForms=imageForms;
|
|
1530
|
+
for(const form of imageForms)if(form.parentElement!==questionPanel)questionPanel.append(form);
|
|
1531
|
+
if(added){viewDisposers.push(inspectorBlocks!.register({id:'question',panel:questionPanel,label:'Question',position:'first'}));inspectorBlocks!.restore({rig:'question',playback:'question'});inspectorBlocks!.select(selectedInspector()??'rig','question');workspace?.revealInspector();}
|
|
1532
|
+
syncQuestionImage();
|
|
1533
|
+
if(imageForms.every(form=>form.dataset.interviewAnswered==='true'))answerSaved=true;
|
|
1534
|
+
rigAsk.onclick=()=>{if(draftConflict)return;inspectorBlocks?.select(selectedInspector()??'rig','question');workspace?.revealInspector();};
|
|
1535
|
+
}
|
|
1536
|
+
forms=forms.filter(form=>!imageForms.includes(form));
|
|
1537
|
+
if(!forms.length&&!recordDialog){renderDraftState();return;}
|
|
1435
1538
|
if(!recordDialog){
|
|
1436
1539
|
recordDialog=panelMake('dialog',{id:'job-record-asks',className:'workspace-drawer'});recordDialog.setAttribute('aria-label',tr(label));
|
|
1437
1540
|
const close=panelMake('button',{className:'workspace-drawer-close',type:'button'},tr('Close'));recordDialog.append(close);app.append(recordDialog);
|
|
@@ -1449,19 +1552,53 @@ function renderRecordForms(forms:readonly HTMLElement[],label='job.pending',stan
|
|
|
1449
1552
|
if(host?.record){
|
|
1450
1553
|
for(const child of el('proposal-panel').children)if(child.id!=='comments-list-host')(child as HTMLElement).hidden=true;
|
|
1451
1554
|
setSourceText(rigInspector.comments.button,`Comments (${recordComments.length})`);comments?.refresh();partsSubject?.refreshComments();
|
|
1452
|
-
button('save').
|
|
1555
|
+
button('save').onclick=()=>rigAsk.click();
|
|
1453
1556
|
}
|
|
1454
|
-
|
|
1455
|
-
rigAsk.disabled=!forms.length;
|
|
1557
|
+
renderAnswerControls();
|
|
1456
1558
|
if((standalone?added.length>0:added.some(form=>form.classList.contains('interview-answer')))&&!recordDialog.open)rigAsk.click();
|
|
1457
1559
|
}
|
|
1458
1560
|
/** The ask heading reads only already-pending subjects. It never synthesizes an agent request. */
|
|
1459
1561
|
function renderPendingSubjects(subjects:readonly {kind:string;stage?:string}[]):void {
|
|
1460
1562
|
const requests:Record<string,string>={'parts-verdict':'Check the parts and meshes.','interview-picks':'Answer these questions.','review-verdict:rig-review':'Check the rig and motion.','review-verdict:direction-review':'Check the direction.','review-verdict:image-review':'Check these images.','checkpoint':'Review this checkpoint.','signoff':'Approve this stage.','reopen':'Review the reopened stage.'};
|
|
1461
1563
|
const labels=subjects.map(subject=>requests[subject.kind+':'+subject.stage]??requests[subject.kind]).filter((label):label is string=>!!label);
|
|
1564
|
+
pendingAnswers=subjects;
|
|
1565
|
+
askHeadline.hidden=false;setSourceText(askHeadline,labels.join(' · ')||'Nothing is waiting for your answer.');
|
|
1462
1566
|
renderDraftState();
|
|
1463
|
-
rigAsk.hidden=!labels.length;setSourceText(rigAsk,labels.join(' · '));setSourceAttribute(rigAsk,'title',labels.join(' · '));
|
|
1464
1567
|
}
|
|
1568
|
+
/** Answer controls compose the existing act bar and submit handlers; act payloads stay unchanged. */
|
|
1569
|
+
function renderAnswerControls():void {
|
|
1570
|
+
const subjects=host?.pendingSubjects?.()??pendingAnswers;
|
|
1571
|
+
const verdict=subjects.some(subject=>subject.kind==='review-verdict'||subject.kind==='parts-verdict');
|
|
1572
|
+
const dialog=subjects.some(subject=>!subject.kind.endsWith('verdict'))&&!verdict;
|
|
1573
|
+
const readable=questionForms.some(form=>form.dataset.interviewAnswered==='true')||!!recordDialog?.querySelector('form.interview-answer[data-interview-answered=true] fieldset:disabled');
|
|
1574
|
+
const enabled=questionForms.some(form=>!form.querySelector('fieldset')?.disabled)||!!recordDialog?.querySelector('fieldset:not(:disabled)');
|
|
1575
|
+
const blocked=saving||draftConflict||!!actReadOnly||!!host?.unavailable;
|
|
1576
|
+
const save=button('save');
|
|
1577
|
+
if((host||subjects.some(subject=>subject.kind==='interview-picks'))&&subjects.length&&!rigInspector.actBar.saveState())rigInspector.actBar.setSaveState({kind:'unsaved',text:'Not submitted'});
|
|
1578
|
+
select('review-status').hidden=true;document.querySelector<HTMLLabelElement>('label[for="review-status"]')!.hidden=true;
|
|
1579
|
+
save.hidden=!verdict;save.classList.toggle('primary',verdict&&!(subjects.some(subject=>subject.kind==='parts-verdict')&&liveIssueCount()>0));
|
|
1580
|
+
requestChanges.classList.toggle('primary',verdict&&subjects.some(subject=>subject.kind==='parts-verdict')&&liveIssueCount()>0);
|
|
1581
|
+
requestChanges.hidden=!verdict;
|
|
1582
|
+
rigAsk.hidden=!dialog;rigAsk.classList.toggle('primary',dialog);
|
|
1583
|
+
const kind=subjects.find(subject=>!subject.kind.endsWith('verdict'))?.kind;
|
|
1584
|
+
setSourceText(rigAsk,kind==='signoff'?'Approve…':kind==='interview-picks'||readable?'Answer…':'Review…');
|
|
1585
|
+
rigAsk.disabled=(!enabled&&!readable)||(enabled&&blocked);
|
|
1586
|
+
if(verdict){
|
|
1587
|
+
const parts=subjects.some(subject=>subject.kind==='parts-verdict'),count=host?.direction?recordComments.length:liveIssueCount();
|
|
1588
|
+
setSourceText(save,'Approve');setSourceText(requestChanges,'Request changes');
|
|
1589
|
+
save.disabled=blocked||!!readOnly||!!session?.feedbackWarnings?.length||(parts&&(partsAnswerBlocked()||count>0));
|
|
1590
|
+
requestChanges.disabled=blocked||!!readOnly||!!session?.feedbackWarnings?.length||count===0||(parts&&partsAnswerBlocked());
|
|
1591
|
+
setSourceAttribute(save,'title',parts&&count>0?'Remove the flagged parts comments before approving.':'');
|
|
1592
|
+
setSourceAttribute(requestChanges,'title',count===0?'Add a comment where changes are needed.':'');
|
|
1593
|
+
if(!parts){
|
|
1594
|
+
save.onclick=event=>{session.status='approved';select('review-status').value=session.status;return verdictSubmit?.(event);};
|
|
1595
|
+
}
|
|
1596
|
+
requestChanges.onclick=()=>{if(requestChanges.disabled)return;if(parts){void save.onclick?.call(save,new PointerEvent('click'));}else{session.status='changes-requested';select('review-status').value=session.status;void verdictSubmit?.(new MouseEvent('click'));}};
|
|
1597
|
+
}
|
|
1598
|
+
for(const root of [recordDialog,...questionForms])for(const control of root?.querySelectorAll<HTMLButtonElement>('button[type="submit"]')??[])control.disabled=blocked||verdict;
|
|
1599
|
+
if(host){rigInspector.answersRendered=true;rigInspector.act.hidden=subjects.length===0;rigInspector.syncActRow?.();}
|
|
1600
|
+
}
|
|
1601
|
+
let verdictSubmit:((event:MouseEvent)=>unknown)|null=null;
|
|
1465
1602
|
/** The rig pane for a live job's still (#709): the job binds and copies it, this screen keeps its view. */
|
|
1466
1603
|
function hostStage():RigHostStage|null {
|
|
1467
1604
|
if(!player)return null;const frame=parts?.frame('single');
|
|
@@ -1516,11 +1653,12 @@ async function resumeScreen():Promise<void> {
|
|
|
1516
1653
|
try{
|
|
1517
1654
|
await workspace?.settle();
|
|
1518
1655
|
if(disposed)return;
|
|
1519
|
-
if(
|
|
1656
|
+
if(partsOnly){await setupPartsPersistence?.();if(disposed)return;}
|
|
1657
|
+
else if(!host?.record||host.record.hasPicture)await setupPersistence(true);
|
|
1520
1658
|
suspended=false;if(!partsOnly&&(!host?.record||host.record.hasPicture))frameHandle=requestAnimationFrame(tick);ready=true;
|
|
1521
1659
|
}finally{screenRoot.inert=ready?wasInert:true;if(ready&&!disposed)document.body.dataset.ready='true';}
|
|
1522
1660
|
}
|
|
1523
|
-
function disposeScreen():void {
|
|
1661
|
+
function disposeScreen():void {releaseInterview?.();releaseInterview=null;
|
|
1524
1662
|
if(disposed)return;suspendScreen();disposed=true;lifecycle.abort();
|
|
1525
1663
|
comments?.dispose();partsSubject?.dispose();turnPad?.dispose();inspectorBlocks?.dispose();inspectorTabs?.dispose();
|
|
1526
1664
|
workspace?.dispose();controlDispose?.();appearance?.dispose();rigInspector.actBar.dispose();shell.dispose();
|
|
@@ -1532,7 +1670,7 @@ function showInspector(name:string,reveal=true):void {if(name==='feedback'){if(r
|
|
|
1532
1670
|
function bindInspector(partsSubject=false):void {
|
|
1533
1671
|
inspectorTabs?.dispose();
|
|
1534
1672
|
rigInspector.row.reveal=()=>workspace?.revealInspector();
|
|
1535
|
-
inspectorTabs=bindInspectorTabs(()=>{const mode=inspectorTabs?.state();if(mode)inspectorBlocks?.activate(mode);workspace?.afterTab();renderLayout();},()=>workspace?.beforeTab(),rigInspector.row);
|
|
1673
|
+
inspectorTabs=bindInspectorTabs(()=>{const mode=inspectorTabs?.state();if(mode)inspectorBlocks?.activate(mode);syncQuestionImage();workspace?.afterTab();renderLayout();},()=>workspace?.beforeTab(),rigInspector.row);
|
|
1536
1674
|
viewDisposers.push(bindHeaderModeAvailability(partsSubject?{model:false,parts:true}:{model:!!data.manifest.model,preRig:data.capabilities.preRig,parts:!!host?.record&&!data.manifest.model}));
|
|
1537
1675
|
for(const mode of document.querySelectorAll<HTMLButtonElement>('[data-mode]'))if(mode.dataset.mode==='rig'||mode.dataset.mode==='playback')mode.onclick=()=>showInspector(mode.dataset.mode!);
|
|
1538
1676
|
}
|
|
@@ -1564,7 +1702,7 @@ function syncPlayerLoop():void {
|
|
|
1564
1702
|
catch(error){message(errorText(error),true);}
|
|
1565
1703
|
}
|
|
1566
1704
|
function canRepeatIdle():boolean{const direction=activeScene();if(direction)return direction.take.loop;return !!player&&idleAvailable(assets?.animations.map(a=>a.name)??[],animation)&&!axisInspection&&input('idle-repeat').checked&&duration>0;}
|
|
1567
|
-
function renderIdle():void {text('idle-state',canRepeatIdle()?'Actual idle · repeat enabled':animation==='idle'?'Idle repeat paused':'Non-idle inspection · no automatic playback');}
|
|
1705
|
+
function renderIdle():void {text('idle-state',canRepeatIdle()?activeScene()&&animation&&animation!=='idle'?`${data.manifest?.animations?.find(a=>a.id===animation)?.label??animation} · repeating`:'Actual idle · repeat enabled':animation==='idle'?'Idle repeat paused':'Non-idle inspection · no automatic playback');}
|
|
1568
1706
|
async function playPreview():Promise<void> {
|
|
1569
1707
|
if((!player&&!video&&!sequence)||duration<=0)return;
|
|
1570
1708
|
const intent=++playbackIntent;desiredPlay=true;idleHeld=false;syncPlayerLoop();if(time>=duration)seek(0,{kind:'replay'});
|
|
@@ -1716,9 +1854,10 @@ async function applyInspection(bookmark:InspectionBookmark,signal:AbortSignal,pr
|
|
|
1716
1854
|
async function waitReferenceMetadata(media:HTMLVideoElement,signal:AbortSignal):Promise<void> {if(media.readyState>=1)return;await new Promise<void>((resolve,reject)=>{const clean=()=>{clearTimeout(timer);media.removeEventListener('loadedmetadata',ready);media.removeEventListener('error',fail);signal.removeEventListener('abort',fail);};const ready=()=>{clean();resolve();},fail=()=>{clean();reject(new Error('Saved reference metadata unavailable'));};const timer=setTimeout(fail,10000);media.addEventListener('loadedmetadata',ready,{once:true});media.addEventListener('error',fail,{once:true});signal.addEventListener('abort',fail,{once:true});});}
|
|
1717
1855
|
let inspectionOpening=false;
|
|
1718
1856
|
async function setupPersistence(keepCameraOnResume=false):Promise<boolean> {
|
|
1857
|
+
let restoredChestFormPart:string|null=null;
|
|
1719
1858
|
inspectionOpening=true;try{
|
|
1720
1859
|
persistence=await connectInspectionPersistence({scope:'single:'+data.manifest.id+':'+data.sourceHash,binding:inspectionBinding(),baseline:submittedBaseline!,session:()=>session,reviewDirty:()=>dirty,restoreSession:(value,isDirty)=>{session=value;dirty=isDirty;select('review-status').value=session.status;renderProposals();renderCheckpoint();renderCheckpoints();renderProvenance();updateSavedState();},bookmark:inspectionBookmark,restoreBookmark:(b,s)=>restoreInspection(b,s,session.feedback.some(f=>isTimeOnlyFeedback(f)&&JSON.stringify((f.context as any).comment.bookmark)===JSON.stringify(b)),keepCameraOnResume||bookmarkCameraKept(inspectionOpening,!!host)),
|
|
1721
|
-
ui:()=>({inspectorScroll:workspace?.scroll()??'{}',...(inspectorBlocks?activeBlocksUI(inspectorBlocks.state()):{}),reportCategory:select('report-category').value,reportPage,reportEvent:selectedReportEvent?.id??null,reportTime:selectedReportTime??null,reportTarget:selectedReportTarget??null}),restoreUI:value=>{if(typeof value.reportCategory==='string'&&[...select('report-category').options].some(o=>o.value===value.reportCategory))select('report-category').value=value.reportCategory;if(typeof value.reportPage==='number'&&Number.isSafeInteger(value.reportPage)&&value.reportPage>=0)reportPage=value.reportPage;selectedReportEvent=typeof value.reportEvent==='string'?data.report?.categories.flatMap(c=>c.events).find(e=>e.id===value.reportEvent)??null:null;selectedReportTime=typeof value.reportTime==='number'?value.reportTime:undefined;selectedReportTarget=typeof value.reportTarget==='number'?value.reportTarget:undefined;renderReportEvents();renderReportSelection();inspectorBlocks?.restore(restoreActiveBlocksUI(value));workspace?.restoreScroll(value.inspectorScroll);},afterInputs:()=>{const target=input('feedback-target-name').value;renderFeedbackTargets(true);if(select('feedback-target-kind').value!=='rig')input('feedback-target-name').value=target;renderFeedbackRange();text('audio-volume-label',`${Math.round(Number(input('audio-volume').value)*100)}%`);},onConflict:value=>{draftConflict=value;updateSavedState();},onStatus:value=>{draftStatus=value;renderDraftState();}});
|
|
1860
|
+
ui:()=>({chestFormPart,inspectorScroll:workspace?.scroll()??'{}',...(inspectorBlocks?activeBlocksUI(inspectorBlocks.state()):{}),reportCategory:select('report-category').value,reportPage,reportEvent:selectedReportEvent?.id??null,reportTime:selectedReportTime??null,reportTarget:selectedReportTarget??null}),restoreUI:value=>{restoredChestFormPart=typeof value.chestFormPart==='string'?value.chestFormPart:null;if(typeof value.reportCategory==='string'&&[...select('report-category').options].some(o=>o.value===value.reportCategory))select('report-category').value=value.reportCategory;if(typeof value.reportPage==='number'&&Number.isSafeInteger(value.reportPage)&&value.reportPage>=0)reportPage=value.reportPage;selectedReportEvent=typeof value.reportEvent==='string'?data.report?.categories.flatMap(c=>c.events).find(e=>e.id===value.reportEvent)??null:null;selectedReportTime=typeof value.reportTime==='number'?value.reportTime:undefined;selectedReportTarget=typeof value.reportTarget==='number'?value.reportTarget:undefined;renderReportEvents();renderReportSelection();inspectorBlocks?.restore(restoreActiveBlocksUI(value));workspace?.restoreScroll(value.inspectorScroll);},afterInputs:()=>{chestFormPart=restoredChestFormPart??parts?.value()?.slot??null;const selected=parts?.value()?.slot;if(rebuildStatus&&selected)void openStageCorrection({part:selected,instrument:'selection'});const target=input('feedback-target-name').value;renderFeedbackTargets(true);if(select('feedback-target-kind').value!=='rig')input('feedback-target-name').value=target;renderFeedbackRange();text('audio-volume-label',`${Math.round(Number(input('audio-volume').value)*100)}%`);},onConflict:value=>{draftConflict=value;updateSavedState();},onStatus:value=>{draftStatus=value;renderDraftState();}});
|
|
1722
1861
|
}finally{inspectionOpening=false;}
|
|
1723
1862
|
return persistence.restored;
|
|
1724
1863
|
}
|
|
@@ -2017,28 +2156,34 @@ async function applyMeshDelta(doc:MeshEditDocument,line:(text:string)=>void):Pro
|
|
|
2017
2156
|
finally{rebuildBusy=false;rebuildState();}
|
|
2018
2157
|
}
|
|
2019
2158
|
let chestFormPart:string|null=null;
|
|
2159
|
+
const chestPartDrafts=new Map<string,Record<string,{value:string;checked?:boolean}>>();
|
|
2020
2160
|
/** Rebinding is explicit: defaults and both modes belong to the new part, while reopening the same part keeps edits. */
|
|
2021
2161
|
function rebindChestPart(status:RebuildStatusView,part:string):void {
|
|
2022
2162
|
if(chestFormPart===part)return;
|
|
2023
2163
|
const next=chestPartFields(status,part);
|
|
2024
2164
|
const ids=[...chestInputIds,...LANDMARKS.flatMap(({key})=>['x','y'].map(axis=>`lm-${key}-${axis}`)),'lm-alpha','lm-clearance','lm-bone_r','lm-bone_l','bust-mode'];
|
|
2165
|
+
if(chestFormPart)chestPartDrafts.set(chestFormPart,Object.fromEntries(ids.flatMap(id=>{const node=document.getElementById(id) as HTMLInputElement|HTMLSelectElement|HTMLTextAreaElement|null;return node?[[id,{value:node.value,...(node instanceof HTMLInputElement?{checked:node.checked}:{})}]]:[];})));
|
|
2025
2166
|
for(const id of ids){const node=document.getElementById(id) as HTMLInputElement|HTMLSelectElement|HTMLTextAreaElement|null;if(!node)continue;
|
|
2026
2167
|
if(node instanceof HTMLInputElement){node.value=node.defaultValue;node.checked=node.defaultChecked;}
|
|
2027
2168
|
else if(node instanceof HTMLTextAreaElement)node.value=node.defaultValue;
|
|
2028
2169
|
else node.value=[...node.options].find(option=>option.defaultSelected)?.value??node.options[0]?.value??'';
|
|
2029
2170
|
}
|
|
2030
2171
|
for(const [id,value] of Object.entries(next.fields)){const node=document.getElementById(id) as HTMLInputElement|HTMLSelectElement|null;if(!node)continue;if(node instanceof HTMLInputElement&&node.type==='checkbox')node.checked=value==='true';else node.value=value;}
|
|
2031
|
-
input('bust-mode').value=next.mode;
|
|
2172
|
+
input('bust-mode').value=next.mode;
|
|
2173
|
+
const saved=chestPartDrafts.get(part);if(saved)for(const [id,field] of Object.entries(saved)){const node=document.getElementById(id) as HTMLInputElement|HTMLSelectElement|HTMLTextAreaElement|null;if(node){node.value=field.value;if(node instanceof HTMLInputElement&&field.checked!==undefined)node.checked=field.checked;}}
|
|
2174
|
+
chestFormPart=part;chestEditor?.rebind();
|
|
2032
2175
|
const refusal=next.seed.refusals.join(' · ');chestEditor?.notify(refusal||null,!!refusal,next.seed.refusals);
|
|
2033
2176
|
el('chest-regions').dispatchEvent(new Event('input',{bubbles:true}));
|
|
2034
2177
|
}
|
|
2035
2178
|
/** `GET /api/rebuild`: whether Apply can run, and the producer config's regions to start an untouched editor from. */
|
|
2036
2179
|
async function loadRebuildStatus():Promise<RebuildStatusView|null> {
|
|
2037
2180
|
try{rebuildStatus=await api<RebuildStatusView>('/api/rebuild');}catch(error){rebuildStatus=null;const reason=`REBUILD_STATUS_UNAVAILABLE: ${errorText(error)}`;chestEditor?.notify(reason,true);animationPanel?.loadSource(null,reason);return null;}
|
|
2038
|
-
|
|
2181
|
+
// Restore the form owner before seeding either mode or caching a selection switch.
|
|
2182
|
+
chestFormPart??=chestSeed(rebuildStatus).part;
|
|
2183
|
+
const scoped=chestStatusForPart(rebuildStatus,chestFormPart);
|
|
2184
|
+
const seed={...(seedFields(scoped,chestField)??{}),...(seedLandmarks(scoped,chestField)??{})};
|
|
2039
2185
|
if(Object.keys(seed).length){for(const [id,value] of Object.entries(seed)){const node=document.getElementById(id) as HTMLInputElement|HTMLSelectElement|HTMLTextAreaElement|null;if(!node)continue;if(node instanceof HTMLInputElement&&node.type==='checkbox')node.checked=value==='true';else node.value=value;}el('chest-regions').dispatchEvent(new Event('input',{bubbles:true}));}
|
|
2040
2186
|
// #315: a config polygon the editor cannot read as an ellipse is named, never shown as an empty row.
|
|
2041
|
-
chestFormPart??=chestSeed(rebuildStatus).part;
|
|
2042
2187
|
const refused=chestSeed(chestStatusForPart(rebuildStatus,chestFormPart)).refusals;if(refused.length)chestEditor?.notify(refused.join(' · '),true,refused);
|
|
2043
2188
|
// #342: a rig with no contour mesh disables the chest tools before use and says why in words about the rig.
|
|
2044
2189
|
const noContour=noContourReason(rebuildStatus);chestEditor?.unavailable(noContour?.text??null);
|
|
@@ -2053,6 +2198,7 @@ async function loadRebuildStatus():Promise<RebuildStatusView|null> {
|
|
|
2053
2198
|
animationPanel?.loadSource(rebuildStatus.animations??null,rebuildStatus.reason);
|
|
2054
2199
|
if(!inspectedModel&&canManageApplied())void refreshApplied();
|
|
2055
2200
|
renderDropNotices();
|
|
2201
|
+
const selected=parts?.value()?.slot;if(selected)void openStageCorrection({part:selected,instrument:'selection'});
|
|
2056
2202
|
return rebuildStatus;
|
|
2057
2203
|
}
|
|
2058
2204
|
/** The handoff line (#101): path, hash and how it was found, then the baseline; re-read while the baseline runs. */
|
|
@@ -2220,7 +2366,7 @@ async function applyRebuild():Promise<void> {
|
|
|
2220
2366
|
if(rebuildBusy)return;
|
|
2221
2367
|
if(readOnly){chestEditor?.notify(readOnly,true);return;}
|
|
2222
2368
|
const loadedStatus=rebuildStatus??await loadRebuildStatus();
|
|
2223
|
-
const status=loadedStatus?chestStatusForPart(loadedStatus,stageCorrectionPart):loadedStatus;
|
|
2369
|
+
const status=loadedStatus?chestStatusForPart(loadedStatus,stageCorrectionPart??chestFormPart):loadedStatus;
|
|
2224
2370
|
const selectedSlot=parts?.value()?.slot??stageDraftSelection?.slot??null;
|
|
2225
2371
|
if(stageCorrectionPart&&selectedSlot!==stageCorrectionPart){chestEditor?.notify('STAGE_DRAFT_MISMATCH',true);return;}
|
|
2226
2372
|
if(!status||!status.available||!status.inputs){const noContour=status?noContourReason(status):null,reason=noContour?.text??status?.reason??'REBUILD_STATUS_UNAVAILABLE';chestEditor?.notify(reason,!noContour,noContour?.lines??[reason]);message(reason,!noContour);return;}
|
|
@@ -2729,11 +2875,18 @@ async function resetRebuild(world:StageWorld|null=null):Promise<void> {
|
|
|
2729
2875
|
*/
|
|
2730
2876
|
let stageSource:{url:string;prefix:string;hash:string}|null=null;
|
|
2731
2877
|
async function swapRig(modelUrl:string,prefix:string,sha256:string,world:StageWorld|null=null):Promise<void> {
|
|
2878
|
+
const cameraRestoring=viewport.state.cameraRestoring;
|
|
2732
2879
|
stageCorrectionRebinding++;try{
|
|
2733
|
-
const keepPart=
|
|
2880
|
+
const keepPart=parts?.value()??null,keepStage=assets?.stage;
|
|
2881
|
+
const keepFramingBox=rigRaster.active()?undefined:viewportProvider.geometry('rig')?.box;
|
|
2882
|
+
const keepRigCamera=structuredClone(viewport.paneCamera('rig')),keepReferenceCamera=structuredClone(viewport.paneCamera('reference'));
|
|
2734
2883
|
const keepAnimation=animation,keepTime=time,wasPlaying=playing,keepSet=select('part-set').disabled?'':select('part-set').value;
|
|
2735
2884
|
inspectionSourceState='pending';partModel=null;pause();refreshAnimationInspection();
|
|
2736
2885
|
const next=await loadModel({modelUrl,...stageLoadInputs(modelUrl,sha256),resolvePage:(name,url)=>{const target=new URL(name,url);if(target.origin!==location.origin||!target.pathname.startsWith(prefix))throw new Error(`Model page escapes its build: ${name}`);return target.href;}}).catch(error=>{inspectionSourceState='failed';refreshAnimationInspection();throw error;});
|
|
2886
|
+
const keepFraming=!!keepStage&&!!next.stage&&(['x','y','width','height'] as const).every(key=>keepStage[key]===next.stage![key]);
|
|
2887
|
+
viewport.state.cameraRestoring=true;viewport.cancelFit();
|
|
2888
|
+
// The fit-relative zoom also depends on the first-draw framing basis, not just the declared stage.
|
|
2889
|
+
if(keepFraming&&keepFramingBox)rebuildFramingBoxes.set(next,{...keepFramingBox});
|
|
2737
2890
|
physicsPanel?.clearPreview();
|
|
2738
2891
|
pause();player?.dispose();assets?.dispose();assets=next;player=createInspectionPlayer(el('rig-root'),assets);setupChestWorld=readSetupChest(player);stageModelHash=sha256;stageSource={url:modelUrl,prefix,hash:sha256};
|
|
2739
2892
|
// A scratch build may hold another set of animations (a retarget adds one, #114): the picker lists what this build has.
|
|
@@ -2751,12 +2904,14 @@ async function swapRig(modelUrl:string,prefix:string,sha256:string,world:StageWo
|
|
|
2751
2904
|
// when none was staged — and nothing claims a clip the stage is not drawing.
|
|
2752
2905
|
else{drawRig(()=>player!.draw());animation='';duration=0;time=0;select('animation-select').value='';renderTransport();renderCues();renderIdle();}
|
|
2753
2906
|
if(environmentApplied())applyEnvironment();
|
|
2754
|
-
if(
|
|
2755
|
-
updateChestMapping();
|
|
2907
|
+
if(parts&&inspectionSourceState==='ready')parts.restoreSelection(keepPart);
|
|
2908
|
+
updateChestMapping();
|
|
2909
|
+
if(keepFraming){viewport.writeCamera('rig',keepRigCamera);viewport.writeCamera('reference',keepReferenceCamera);fitCamera();}
|
|
2910
|
+
else{viewport.state.cameraRestoring=cameraRestoring;viewport.requestFit();fitCamera();}
|
|
2756
2911
|
// The preview (#104) drives the new player once its bone setups are read (an idle Apply cleared it first).
|
|
2757
2912
|
stageDocumentSet=true;void loadModelDocument(modelUrl,sha256).then(loaded=>{if(loaded.ok&&stageModelHash===sha256)idlePanel?.model(boneSetup(loaded.document));});
|
|
2758
2913
|
if(wasPlaying)void playPreview();
|
|
2759
|
-
}finally{stageCorrectionRebinding--;directionPanel?.refresh();}
|
|
2914
|
+
}finally{viewport.state.cameraRestoring=cameraRestoring;stageCorrectionRebinding--;directionPanel?.refresh();}
|
|
2760
2915
|
}
|
|
2761
2916
|
/**
|
|
2762
2917
|
* Mesh Apply (#106): the pending `meshes.<part>` entry becomes one config patch — `replace /meshes/<part>` and nothing
|
|
@@ -2916,14 +3071,15 @@ function commentCaptureRefusal():string|null {
|
|
|
2916
3071
|
}
|
|
2917
3072
|
function setupComments():void {
|
|
2918
3073
|
if(host?.direction||host?.record){restoreRecordComments();liveIssueCount=()=>recordComments.length;if(host?.direction)dirty=dirty||recordComments.length>0;}
|
|
2919
|
-
comments=bindStageComments<CommentRow,CommentPose>({general:host?.record||host?.direction?{create:summary=>({id:crypto.randomUUID(),summary}),matches:row=>!('target' in row)}:undefined,listHost:el('comments-list-host'),toolbar:el('stage-comment').parentElement!,viewports:host?.record&&!host.record.hasPicture?{}:{rig:el('rig-viewport'),reference:el('reference-viewport')},
|
|
3074
|
+
comments=bindStageComments<CommentRow,CommentPose>({general:host?.record||host?.direction?{create:summary=>({id:crypto.randomUUID(),summary}),matches:row=>!('target' in row)}:undefined,listHost:el('comments-list-host'),openList:openReview,hasPicture:()=>!hasTransientQuestionImage(screenRoot),toolbar:el('stage-comment').parentElement!,viewports:host?.record&&!host.record.hasPicture?{}:{rig:el('rig-viewport'),reference:el('reference-viewport')},
|
|
2920
3075
|
pose:view=>{
|
|
3076
|
+
if(hasTransientQuestionImage(screenRoot))return null;
|
|
2921
3077
|
if(view!=='rig'&&view!=='reference')return null;const workspaceMode=document.querySelector<HTMLElement>('[data-mode][aria-pressed="true"]')?.dataset.mode;if(workspaceMode!=='rig'&&workspaceMode!=='playback')return null;const camera=numericView().cameras[view],pane=el(view+'-viewport');if(!camera||pane.clientWidth<=0||pane.clientHeight<=0)return null;
|
|
2922
3078
|
const renderer=player?.renderer;const current=time,index=frameAtTime(activeFrameClock(),current),referenceId=view==='reference'?select('reference-select').value||null:null,referenceHash=referenceId?data.referenceHashes?.[referenceId]??(data.explicitReference?.id===referenceId?data.explicitReference.sha256:null):null;
|
|
2923
3079
|
return {mode:workspaceMode==='playback'?'animate':'setup',capture:{pane,root:view==='rig'?el('rig-root'):undefined,images:view==='reference'||layers.images,canvas:view==='rig'&&renderer instanceof CanvasRenderer?renderer.canvas:undefined,backend:renderer instanceof CanvasRenderer?renderer.backendActive:renderer?.meshBackendActive??'canvas2d'},camera,frame:index===null?null:{index,basis:'producer'},...(index===null?{timeBasis:timeOnlyBasis}:{}),time:current,animation:animation||null,turn:turnPad?.snapshot()??null,sourceHash:data.sourceHash,modelHash:view==='reference'?null:stageModelHash,referenceHash,referenceId,rig:data.manifest.id,...(view==='reference'?{media:video??el('reference-content').querySelector('img')??undefined}:{posed:parts?.frame('single'),assets:assets??undefined})} as CommentPose;
|
|
2924
3080
|
},
|
|
2925
3081
|
pause:async()=>{const running=playing||!!video&&!video.paused;pause();if(running&&video&&video.readyState>=1){seekingControl=true;try{await inspectControlTime(time,new AbortController().signal);}finally{seekingControl=false;}}if(turnPad)turnPad.restore({...turnPad.snapshot(),held:true},false);},bookmark:inspectionBookmark,restore:(b,timed)=>restoreInspection(parseBookmark(b,inspectionBinding()),new AbortController().signal,!!timed),feedback:()=>host?.record||host?.direction?recordComments:session.feedback,
|
|
2926
|
-
locked:host?.record?()=>false:host?.direction?id=>submittedDirectionComments.has(id):isSubmittedFeedback,add:f=>{if(host?.record||host?.direction)recordComments.push(f);else session.feedback.push(f as Feedback);},changed:()=>{if(host?.record||host?.direction){recordCommentsChanged();if(host?.direction){markDirty();comments?.refresh();}return;}markDirty();renderProposals();persistence?.save();},error:value=>message(value,true),
|
|
3082
|
+
locked:host?.record?()=>false:host?.direction?id=>submittedDirectionComments.has(id):isSubmittedFeedback,add:f=>{if(host?.record||host?.direction)recordComments.push(f);else session.feedback.push(f as Feedback);},changed:()=>{if(host?.record||host?.direction){recordCommentsChanged();if(host?.direction){markDirty();comments?.refresh();}return;}markDirty();renderProposals();return persistence?.save();},error:value=>message(value,true),
|
|
2927
3083
|
refusal:()=>host?.record&&!host.record.hasPicture?null:commentCaptureRefusal(),blocked:()=>saving||!!persistence?.restoring()||seekingControl||!!video?.seeking||!!rebuildBusy||!!appliedOnStage,shortcutBlocked:()=>!!meshEditor?.active()
|
|
2928
3084
|
});
|
|
2929
3085
|
}
|
|
@@ -3178,7 +3334,15 @@ async function prepareStageDraftBuild(
|
|
|
3178
3334
|
try{prevAssets?.dispose();}catch{/* ignore */}
|
|
3179
3335
|
return {status,mapping};
|
|
3180
3336
|
}
|
|
3181
|
-
async function openStageCorrection(request:{part:string;sourceHash:string;buildId:string;instrument:string}):Promise<void>{
|
|
3337
|
+
async function openStageCorrection(request:{part:string;sourceHash:string;buildId:string;instrument:string}|{part:string;instrument:'selection'}):Promise<void>{
|
|
3338
|
+
if(!('sourceHash' in request)){
|
|
3339
|
+
if(!rebuildStatus||rebuildBusy)return;
|
|
3340
|
+
const seed=chestSeed(chestStatusForPart(rebuildStatus,request.part));
|
|
3341
|
+
const unavailable='The selected part has no chest regions. The chest editor keeps its current part.';
|
|
3342
|
+
if(!seed.part){chestEditor?.notify(unavailable);return;}
|
|
3343
|
+
if(chestFormPart===request.part){if(chestEditor?.noticeText?.()===unavailable)chestEditor.notify(null);return;}
|
|
3344
|
+
rebindChestPart(rebuildStatus,request.part);redrawOverlay(true);return;
|
|
3345
|
+
}
|
|
3182
3346
|
if(readOnly)throw new Error(readOnly);
|
|
3183
3347
|
if(rebuildBusy)throw new Error('STAGE_DRAFT_STALE');
|
|
3184
3348
|
const buildId=appliedOnStage?.buildId??'inspected';
|