@rig-c/review 4.1.0 → 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 +41 -2
- package/package.json +2 -2
- package/src/handoff.ts +1 -1
- package/src/job-source.ts +4 -1
- package/web/catalog-en.ts +3 -0
- package/web/catalog-ko.ts +3 -0
- package/web/compare.css +156 -144
- package/web/compare.ts +2 -2
- package/web/inspection-persistence.ts +29 -19
- package/web/interview-panel.ts +14 -5
- package/web/main.ts +46 -14
- package/web/parts-viewport-provider.ts +1 -1
- package/web/stage-comments.ts +5 -2
- package/web/styles.css +287 -276
- package/web/view-controls.ts +4 -4
- package/web/workspace-ui.ts +11 -5
package/web/compare.ts
CHANGED
|
@@ -484,7 +484,7 @@ function createCompareViewport(){
|
|
|
484
484
|
cameraRestoring:{get:()=>cameraRestoring,set:(value:boolean)=>{cameraRestoring=value;}},
|
|
485
485
|
cameraLayout:{get:()=>cameraLayout,set:(value:string)=>{cameraLayout=value;}}
|
|
486
486
|
});
|
|
487
|
-
const provider=createRigViewportProvider({el,player:()=>null,assets:()=>null,
|
|
487
|
+
const provider=createRigViewportProvider({fitLabel:'Fit',el,player:()=>null,assets:()=>null,
|
|
488
488
|
panes:(['a','b'] as const).map(target=>({target,viewport:el(target+'-viewport'),pane:el(target+'-pane'),
|
|
489
489
|
root:el(target+'-root'),fallback:target==='a'?'b' as const:'a' as const,box:sharedBox,
|
|
490
490
|
player:()=>players[target]??null,scale:(value:number)=>{rigScales[target]=value;}})),
|
|
@@ -499,7 +499,7 @@ function createCompareViewport(){
|
|
|
499
499
|
return selected?`Selected slot fitted${suffix}.`:`View fitted${suffix}.`;
|
|
500
500
|
},
|
|
501
501
|
cameraControls:{zoomId:'zoom-label',targetLabel:target=>target==='reference'?'Reference':target?.toUpperCase()??'A',
|
|
502
|
-
|
|
502
|
+
coordinatesId:null}
|
|
503
503
|
},state);
|
|
504
504
|
return createViewportController(provider,state);
|
|
505
505
|
}
|
|
@@ -155,14 +155,20 @@ export function recoverSession<T extends {id:string;revision:string;sourceHash:s
|
|
|
155
155
|
export const maximumDrafts=32,protectedDraftMs=24*60*60*1000;
|
|
156
156
|
const draftPrefix='rig-review-draft/1:',draftIndex='rig-review-draft-index/1';
|
|
157
157
|
const cropDatabase='rig-review-inspection-drafts',cropStore='crops',cropReference='draft-crop:';
|
|
158
|
-
/**
|
|
159
|
-
function draftCrops(session:unknown):{row:{id:string};crop:Record<string,unknown
|
|
160
|
-
if(!session||typeof session!=='object'
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
const row=record(item,'draft')
|
|
165
|
-
|
|
158
|
+
/** Existing rig feedback and native parts issues share the private crop transport. */
|
|
159
|
+
function draftCrops(session:unknown):{row:{id:string};crop:Record<string,unknown>;parts:boolean}[] {
|
|
160
|
+
if(!session||typeof session!=='object')return [];
|
|
161
|
+
const value=session as {feedback?:unknown[];subject?:unknown;issues?:unknown[]};
|
|
162
|
+
const rows=[...(Array.isArray(value.feedback)?value.feedback:[]),...(value.subject==='parts'&&Array.isArray(value.issues)?value.issues:[])];
|
|
163
|
+
return rows.flatMap(item=>{
|
|
164
|
+
const row=record(item,'draft'),parts=value.subject==='parts'&&(row.schema==='rig-review-parts-comment/1'||row.schema==='rig-review-parts-comment/2');
|
|
165
|
+
const comment=parts?row:(item as {context?:{comment?:unknown}}|null)?.context?.comment;
|
|
166
|
+
if(!parts&&!hasStageComment(comment))return [];
|
|
167
|
+
const crop=record((comment as {crop:unknown}).crop,'crop');
|
|
168
|
+
// Finalized parts rows may retain only their server-backed path/hash, without inline pixels.
|
|
169
|
+
if(parts&&!Object.hasOwn(crop,'png'))return [];
|
|
170
|
+
if(typeof row.id!=='string')throw new Error('Draft review state invalid');
|
|
171
|
+
return [{row:row as {id:string},crop,parts}];
|
|
166
172
|
});
|
|
167
173
|
}
|
|
168
174
|
/** Browser counterpart of comment-crops.ts's signature/dimension/digest boundary (no Node imports). */
|
|
@@ -239,7 +245,8 @@ export class InspectionDraftStore {
|
|
|
239
245
|
if(packed.schema!=='rig-review-local-draft/2')return this.parseDraft(raw,expected);
|
|
240
246
|
// Check the bounded envelope/binding before touching IDB; validate the full session only after hydration.
|
|
241
247
|
const draft=this.parseDraft(JSON.stringify({...packed,schema:'rig-review-local-draft/1'}),expected);
|
|
242
|
-
|
|
248
|
+
// Earlier /2 parts drafts stored inline PNGs; migrate them only on their next save.
|
|
249
|
+
const crops=draftCrops(draft.session).filter(({parts,crop})=>!(parts&&typeof crop.png==='string'&&/^data:image\/png;base64,[A-Za-z0-9+/]+={0,2}$/.test(crop.png))),blobs=new Map<{id:string},Blob>();
|
|
243
250
|
if(crops.length)await this.crops('readonly',store=>{
|
|
244
251
|
for(const {row,crop}of crops){
|
|
245
252
|
if(crop.png!==cropReference+crop.sha256)throw new Error('COMMENT_CROP_STATE_UNAVAILABLE: stored crop cannot be read');
|
|
@@ -249,7 +256,7 @@ export class InspectionDraftStore {
|
|
|
249
256
|
// A completed read with missing/corrupt bytes loses only that image comment; transport failures still throw.
|
|
250
257
|
const unavailable=new Set<unknown>();
|
|
251
258
|
for(const {row,crop}of crops){const png=await draftPng(blobs.get(row)!,crop);if(png===null)unavailable.add(row);else crop.png=png;}
|
|
252
|
-
if(unavailable.size){const session=record(draft.session,'draft');session
|
|
259
|
+
if(unavailable.size){const session=record(draft.session,'draft');for(const key of ['feedback','issues'])if(Array.isArray(session[key]))session[key]=(session[key] as unknown[]).filter(row=>!unavailable.has(row));}
|
|
253
260
|
return draft;
|
|
254
261
|
}
|
|
255
262
|
read(canRecover?:(session:unknown)=>boolean):Promise<LocalInspectionDraft|null> {
|
|
@@ -277,7 +284,7 @@ export class InspectionDraftStore {
|
|
|
277
284
|
try{
|
|
278
285
|
const packed=JSON.parse(snapshot) as LocalInspectionDraft;
|
|
279
286
|
// Clean sessions are already durable on the server and are never restored as unsent feedback.
|
|
280
|
-
if(!packed.reviewDirty&&packed.session&&typeof packed.session==='object'){
|
|
287
|
+
if(!packed.reviewDirty&&packed.session&&typeof packed.session==='object'&&'feedback'in packed.session){
|
|
281
288
|
packed.session={...packed.session,feedback:[]};
|
|
282
289
|
}
|
|
283
290
|
const crops=draftCrops(packed.session),blobs:{key:IDBValidKey;blob:Blob}[]=[];
|
|
@@ -311,24 +318,26 @@ export class InspectionDraftStore {
|
|
|
311
318
|
}
|
|
312
319
|
|
|
313
320
|
interface PersistenceSession {id:string;revision:string;sourceHash:string;status:string;feedback:unknown[]}
|
|
314
|
-
interface PersistenceAdapter<T
|
|
321
|
+
interface PersistenceAdapter<T> {
|
|
322
|
+
recover?:(value:unknown,baseline:T)=>T|null;
|
|
315
323
|
scope:string;binding:InspectionBinding;baseline:T;session:()=>T;reviewDirty:()=>boolean;
|
|
316
324
|
restoreSession:(value:T,dirty:boolean)=>void;bookmark:()=>InspectionBookmark;
|
|
317
325
|
restoreBookmark:(bookmark:InspectionBookmark,signal:AbortSignal)=>Promise<void>;
|
|
318
326
|
ui:()=>Record<string,string|number|null>;restoreUI:(ui:Record<string,string|number|null>)=>void;
|
|
319
327
|
afterInputs:()=>void;onConflict:(conflict:boolean)=>void;onStatus:(message:string)=>void;
|
|
320
328
|
}
|
|
321
|
-
export interface PersistenceConnection {restored:boolean;restoring:()=>boolean;save:()=>void
|
|
329
|
+
export interface PersistenceConnection {restored:boolean;restoring:()=>boolean;save:()=>Promise<void>;submitted:(session:unknown)=>Promise<void>;dispose:()=>void}
|
|
322
330
|
const viewInputIds=new Set(['part-search','part-solo','camera-sync','appearance','layer-images','layer-mesh','layer-bones','animation-select','reference-select','person-select','axis-select','axis-value','scrub','frame-number','frame-scrub','time-input','frame-input','part-set']);
|
|
323
331
|
/** Restore once after normal startup; snapshots never perform a server mutation. */
|
|
324
|
-
export async function connectInspectionPersistence<T
|
|
332
|
+
export async function connectInspectionPersistence<T>(adapter:PersistenceAdapter<T>):Promise<PersistenceConnection> {
|
|
325
333
|
let restoring=true,closed=false,conflict=false,timer:ReturnType<typeof setTimeout>|undefined;
|
|
326
334
|
let navigationGeneration=0,navigationAbort:AbortController|null=null,navigationQueue=Promise.resolve(),lastNavigationHash=location.hash;
|
|
327
335
|
let previousInert:boolean|null=null;
|
|
328
336
|
const holdRestore=(value:boolean)=>{restoring=value;const body=document.body;if(value){if(body&&previousInert===null){previousInert=body.inert;body.inert=true;}}else if(body&&previousInert!==null){body.inert=previousInert;previousInert=null;}};
|
|
329
337
|
let baseline=await sessionFingerprint(adapter.baseline);const status=adapter.onStatus,initialInputs=captureInputs();
|
|
330
338
|
const store=new InspectionDraftStore(adapter.scope,adapter.binding,status);
|
|
331
|
-
|
|
339
|
+
const recover=adapter.recover??((value:unknown,baseline:T)=>recoverSession(value,baseline as T & PersistenceSession) as T|null);
|
|
340
|
+
let draft=await store.read(session=>recover(session,adapter.baseline)!==null);
|
|
332
341
|
const notices=[document.getElementById('draft-recovery'),document.getElementById('review-draft-recovery')].filter((node):node is HTMLElement=>node!==null);
|
|
333
342
|
const clearNotices=()=>{for(const node of notices)node.replaceChildren();};
|
|
334
343
|
const appendAction=(label:string,onclick:()=>void)=>{for(const node of notices){const button=actionButton(label,onclick);node.append(button);}};
|
|
@@ -338,8 +347,8 @@ export async function connectInspectionPersistence<T extends PersistenceSession>
|
|
|
338
347
|
try{explicit=decodeBookmark(location.hash,adapter.binding);}catch(error){status(error instanceof Error?error.message:String(error));}
|
|
339
348
|
let recovered:T|null=null,sameBaseline=false;
|
|
340
349
|
if(draft){
|
|
341
|
-
recovered=
|
|
342
|
-
const prior=recovered?
|
|
350
|
+
recovered=recover(draft.session,adapter.baseline);
|
|
351
|
+
const prior=recovered?recover(adapter.baseline,draft.session as T):null;
|
|
343
352
|
sameBaseline=draft.baseline===baseline||(prior!==null&&draft.baseline===await sessionFingerprint(prior));
|
|
344
353
|
if(!draft.reviewDirty&&(!sameBaseline||!recovered||draft.baseline!==baseline)){await store.clear();draft=null;recovered=null;}
|
|
345
354
|
}
|
|
@@ -376,10 +385,11 @@ export async function connectInspectionPersistence<T extends PersistenceSession>
|
|
|
376
385
|
value.baseline=baseline;
|
|
377
386
|
if(await store.write(value)&&!closed&&!restoring&&navigation===navigationGeneration){const url=new URL(location.href);url.hash=encodeBookmark(value.bookmark);history.replaceState(null,'',url);lastNavigationHash=url.hash;}
|
|
378
387
|
}
|
|
379
|
-
function save():void {
|
|
380
|
-
if(closed||restoring||conflict)return;
|
|
388
|
+
function save():Promise<void> {
|
|
389
|
+
if(closed||restoring||conflict)return Promise.resolve();
|
|
381
390
|
try{const value=snapshot(),navigation=navigationGeneration;writes=writes.then(()=>persist(value,navigation)).catch(error=>{status(`Local view was not saved: ${error instanceof Error?error.message:String(error)}`);});
|
|
382
391
|
}catch(error){status(`Local view was not saved: ${error instanceof Error?error.message:String(error)}`);}
|
|
392
|
+
return writes;
|
|
383
393
|
}
|
|
384
394
|
function navigateView():void {
|
|
385
395
|
if(closed||location.hash===lastNavigationHash)return;
|
package/web/interview-panel.ts
CHANGED
|
@@ -33,6 +33,14 @@ function element<K extends keyof HTMLElementTagNameMap>(tag: K, content?: string
|
|
|
33
33
|
return el;
|
|
34
34
|
}
|
|
35
35
|
const translated: InterviewText = (tag, key) => element(tag, key === undefined ? undefined : t(key));
|
|
36
|
+
function preserveScrollAndFocus(anchor: HTMLElement, mutate: () => void): void {
|
|
37
|
+
const active = typeof HTMLElement !== 'undefined' && document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
38
|
+
const scrolls: [HTMLElement, number, number][] = [];
|
|
39
|
+
for (let node: HTMLElement | null = anchor; node; node = node.parentElement) scrolls.push([node, node.scrollTop, node.scrollLeft]);
|
|
40
|
+
mutate();
|
|
41
|
+
for (const [node, top, left] of scrolls) {if (node.scrollTop !== top) node.scrollTop = top; if (node.scrollLeft !== left) node.scrollLeft = left;}
|
|
42
|
+
if (active?.isConnected && document.activeElement !== active) active.focus({preventScroll:true});
|
|
43
|
+
}
|
|
36
44
|
/** The `rig-review/interview-picks@1` record exactly as the stage interview has always posted it (key order is the file's bytes). */
|
|
37
45
|
export function interviewPicksRecord(ref: Picks['set'], picks: readonly Pick[], note: string | undefined, at: string): Picks {
|
|
38
46
|
return {schema:'rig-review/interview-picks@1', set:ref, picks:picks as Pick[], ...(note !== undefined ? {note} : {}), by:'user', at};
|
|
@@ -71,7 +79,7 @@ export function interviewAskGroup(ask: Ask, options: {text?: InterviewText; name
|
|
|
71
79
|
const label = make('label'); label.className = 'interview-option';
|
|
72
80
|
const radio = make('input'); radio.type = 'radio'; radio.name = options.name ?? ask.id; radio.value = option.id;
|
|
73
81
|
radio.required = true; radio.checked = option.id === pick?.option_id;
|
|
74
|
-
radio.onchange = () => {
|
|
82
|
+
radio.onchange = () => preserveScrollAndFocus(group, () => {
|
|
75
83
|
if (!radio.checked) return;
|
|
76
84
|
other.hidden = option.kind !== 'other';
|
|
77
85
|
other.required = option.kind === 'other';
|
|
@@ -81,7 +89,7 @@ export function interviewAskGroup(ask: Ask, options: {text?: InterviewText; name
|
|
|
81
89
|
pending.textContent = t(key);
|
|
82
90
|
const next = {ask:ask.id, option_id:option.id};
|
|
83
91
|
options.onPick?.(option.kind === 'other' ? {...next, other_text:other.value} : next);
|
|
84
|
-
};
|
|
92
|
+
});
|
|
85
93
|
label.append(radio, make('strong', option.label), make('span', option.effect));
|
|
86
94
|
if(option.kind==='auto'){const badge=text('b','interview.delegate');badge.className='interview-delegate';label.append(badge);}
|
|
87
95
|
if (option.recommended) {
|
|
@@ -240,14 +248,15 @@ export function createInterviewForm(options:{question:InterviewDisplayQuestion;i
|
|
|
240
248
|
const art=make('aside');art.className='interview-art';form.prepend(art);
|
|
241
249
|
let view:ReturnType<typeof interviewImageView>|undefined,list:HTMLElement|undefined,records:HTMLElement|undefined;
|
|
242
250
|
const showImage=(index:number)=>{view?.dispose();view?.element.remove();view=interviewImageView(options.images,index,showImage,context);art.append(view.element);};
|
|
243
|
-
const refresh=()=>{
|
|
251
|
+
const refresh=()=>preserveScrollAndFocus(fields,()=>{
|
|
244
252
|
submit.hidden=!question.editable||form.dataset.interviewAnswered==='true';
|
|
245
253
|
provenance.textContent=t('interview.provenance',[question.set.drafted_by,question.set.drafted_at]);
|
|
246
254
|
const questions=typeof options.questions==='function'?options.questions():options.questions;
|
|
247
255
|
const items=questions?.map((item,index)=>({...item,answered:index===(options.selected??0)?form.dataset.interviewAnswered==='true':item.answered}))??[{label:question.set.question+' · '+question.set.id,answered:form.dataset.interviewAnswered==='true'}];
|
|
248
|
-
const
|
|
256
|
+
const listTop=list?.scrollTop??0,listLeft=list?.scrollLeft??0;
|
|
257
|
+
const next=interviewQuestionList(items,options.selected??0,options.onSelect??(()=>{}),false,options.node);list?.remove();form.prepend(next);next.scrollTop=listTop;next.scrollLeft=listLeft;list=next;
|
|
249
258
|
records?.remove();records=interviewRecords(options.diagnostics,options.historical,options.node);context.append(records);
|
|
250
|
-
};
|
|
259
|
+
});
|
|
251
260
|
const submit=node('button','interview.save');submit.type='submit';submit.hidden=!question.editable;
|
|
252
261
|
const status=node('p',!question.editable?'interview.history':question.saved?'interview.saved':'interview.choose');status.setAttribute('role','status');form.append(status);
|
|
253
262
|
const localize=()=>{for(const [item,key]of copy)item.textContent=t(item.dataset.jobText??key);refresh();};
|
package/web/main.ts
CHANGED
|
@@ -157,6 +157,7 @@ mountViewportPair(el('stage-layout'));
|
|
|
157
157
|
const viewportState=createViewportState();
|
|
158
158
|
const partsCanvas=document.createElement('canvas'),partsReference=document.createElement('canvas');partsCanvas.width=partsCanvas.height=partsReference.width=partsReference.height=0;
|
|
159
159
|
let partsSubject:ReturnType<typeof bindPartsSubject>|null=null;
|
|
160
|
+
let setupPartsPersistence:(()=>Promise<void>)|null=null;
|
|
160
161
|
let rigDifference:{assets:ModelAssets;painting:HTMLImageElement;camera:ReturnType<typeof createViewportState>;hidden:Map<HTMLElement,boolean>;label:string;bookmark:InspectionBookmark}|null=null;
|
|
161
162
|
let rigDifferenceFailure:string|null=null;
|
|
162
163
|
const rigRaster={el,canvas:partsCanvas,message,reference:()=>null,frameSize:()=>({w:partsCanvas.width,h:partsCanvas.height}),active:()=>!!rigDifference};
|
|
@@ -1292,7 +1293,7 @@ async function start(): Promise<void> {
|
|
|
1292
1293
|
// Checkpoints and reference fold away when the package supplies neither.
|
|
1293
1294
|
(el('package-context') as HTMLDetailsElement).open = data.manifest.checkpoints.length > 0 || data.manifest.references.length > 0;
|
|
1294
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;
|
|
1295
|
-
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({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();
|
|
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();
|
|
1296
1297
|
const requestedId = new URLSearchParams(location.search).get('checkpoint'),initial=initialReviewSelection(data.manifest,requestedId,data.explicitReference?.id,data.initialAnimation??undefined),first=initial.checkpoint;
|
|
1297
1298
|
rigInput=data.manifest.model?{state:'pending'}:{state:'absent'};renderLayout();
|
|
1298
1299
|
// A job rig subject lands in Animate before the model finishes loading (#709).
|
|
@@ -1328,7 +1329,7 @@ async function start(): Promise<void> {
|
|
|
1328
1329
|
}
|
|
1329
1330
|
/** Parts have a verdict and image-space pixels, never fabricated model/session fields. */
|
|
1330
1331
|
async function startParts(opened:PartsSubjectEntry,saved:PartsSubjectSession,writes:{capabilityRequired:boolean}):Promise<void>{
|
|
1331
|
-
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):[]);
|
|
1332
1333
|
liveIssueCount=()=>issues.length;
|
|
1333
1334
|
if(!partsOnly)throw new Error('PARTS_SUBJECT_ENTRY_REQUIRED');
|
|
1334
1335
|
readOnly=host?.record?tr('JOB_REVIEW_READ_ONLY'):readOnlyReason(access,writes.capabilityRequired);
|
|
@@ -1340,12 +1341,12 @@ async function startParts(opened:PartsSubjectEntry,saved:PartsSubjectSession,wri
|
|
|
1340
1341
|
const response=await fetch(access.route(path),{...init,headers:access.headers(init?.headers)});
|
|
1341
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;
|
|
1342
1343
|
};
|
|
1343
|
-
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();};
|
|
1344
1345
|
// A parts verdict is saved only over a drawn subject: until the first paint, or after a failed one, Save stays off.
|
|
1345
|
-
const saveBlocked=()=>!!readOnly||!!subject.legacyVerdict?.readOnly||rigInput.state!=='loaded'||draftConflict;
|
|
1346
|
+
const saveBlocked=()=>!!readOnly||!!subject.legacyVerdict?.readOnly||rigInput.state!=='loaded'||draftConflict||!!persistence?.restoring();
|
|
1346
1347
|
partsAnswerBlocked=saveBlocked;
|
|
1347
1348
|
text('rig-empty','Loading package…');
|
|
1348
|
-
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;}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});
|
|
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});
|
|
1349
1350
|
parts=new PartExplorer(el('workspace-left'),el('selected-part'),()=>{},()=>openReview());
|
|
1350
1351
|
const thumbnails=new PartThumbnails();viewDisposers.push(()=>thumbnails.dispose());
|
|
1351
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});
|
|
@@ -1380,14 +1381,28 @@ async function startParts(opened:PartsSubjectEntry,saved:PartsSubjectSession,wri
|
|
|
1380
1381
|
try{
|
|
1381
1382
|
if(host?.submitParts)message(await host.submitParts(frozen));
|
|
1382
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;
|
|
1383
1385
|
if(host)for(const issue of frozen)submittedIssues.add(issue.id);
|
|
1384
|
-
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);
|
|
1385
1387
|
}catch(error){message(errorText(error),true);state.setSaveState({kind:'failed',text:'Save failed.'});}
|
|
1386
1388
|
finally{saving=false;button('save').disabled=saveBlocked();renderDraftState();}
|
|
1387
1389
|
};
|
|
1388
1390
|
viewDisposers.push(viewport.bindControls(unitScaleMessage),viewport.bindNavigation(undefined,()=>!el('stage-layout').getAttribute('aria-busy')?.includes('true')),bindLayerShortcuts(document));
|
|
1389
1391
|
const resize=viewport.observeResize();viewDisposers.push(()=>resize.disconnect());
|
|
1390
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;
|
|
1391
1406
|
renderPendingSubjects(host?.pendingSubjects?.()??[{kind:'parts-verdict'}]);
|
|
1392
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();}
|
|
1393
1408
|
|
|
@@ -1638,7 +1653,8 @@ async function resumeScreen():Promise<void> {
|
|
|
1638
1653
|
try{
|
|
1639
1654
|
await workspace?.settle();
|
|
1640
1655
|
if(disposed)return;
|
|
1641
|
-
if(
|
|
1656
|
+
if(partsOnly){await setupPartsPersistence?.();if(disposed)return;}
|
|
1657
|
+
else if(!host?.record||host.record.hasPicture)await setupPersistence(true);
|
|
1642
1658
|
suspended=false;if(!partsOnly&&(!host?.record||host.record.hasPicture))frameHandle=requestAnimationFrame(tick);ready=true;
|
|
1643
1659
|
}finally{screenRoot.inert=ready?wasInert:true;if(ready&&!disposed)document.body.dataset.ready='true';}
|
|
1644
1660
|
}
|
|
@@ -1838,9 +1854,10 @@ async function applyInspection(bookmark:InspectionBookmark,signal:AbortSignal,pr
|
|
|
1838
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});});}
|
|
1839
1855
|
let inspectionOpening=false;
|
|
1840
1856
|
async function setupPersistence(keepCameraOnResume=false):Promise<boolean> {
|
|
1857
|
+
let restoredChestFormPart:string|null=null;
|
|
1841
1858
|
inspectionOpening=true;try{
|
|
1842
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)),
|
|
1843
|
-
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();}});
|
|
1844
1861
|
}finally{inspectionOpening=false;}
|
|
1845
1862
|
return persistence.restored;
|
|
1846
1863
|
}
|
|
@@ -2139,28 +2156,34 @@ async function applyMeshDelta(doc:MeshEditDocument,line:(text:string)=>void):Pro
|
|
|
2139
2156
|
finally{rebuildBusy=false;rebuildState();}
|
|
2140
2157
|
}
|
|
2141
2158
|
let chestFormPart:string|null=null;
|
|
2159
|
+
const chestPartDrafts=new Map<string,Record<string,{value:string;checked?:boolean}>>();
|
|
2142
2160
|
/** Rebinding is explicit: defaults and both modes belong to the new part, while reopening the same part keeps edits. */
|
|
2143
2161
|
function rebindChestPart(status:RebuildStatusView,part:string):void {
|
|
2144
2162
|
if(chestFormPart===part)return;
|
|
2145
2163
|
const next=chestPartFields(status,part);
|
|
2146
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}:{})}]]:[];})));
|
|
2147
2166
|
for(const id of ids){const node=document.getElementById(id) as HTMLInputElement|HTMLSelectElement|HTMLTextAreaElement|null;if(!node)continue;
|
|
2148
2167
|
if(node instanceof HTMLInputElement){node.value=node.defaultValue;node.checked=node.defaultChecked;}
|
|
2149
2168
|
else if(node instanceof HTMLTextAreaElement)node.value=node.defaultValue;
|
|
2150
2169
|
else node.value=[...node.options].find(option=>option.defaultSelected)?.value??node.options[0]?.value??'';
|
|
2151
2170
|
}
|
|
2152
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;}
|
|
2153
|
-
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();
|
|
2154
2175
|
const refusal=next.seed.refusals.join(' · ');chestEditor?.notify(refusal||null,!!refusal,next.seed.refusals);
|
|
2155
2176
|
el('chest-regions').dispatchEvent(new Event('input',{bubbles:true}));
|
|
2156
2177
|
}
|
|
2157
2178
|
/** `GET /api/rebuild`: whether Apply can run, and the producer config's regions to start an untouched editor from. */
|
|
2158
2179
|
async function loadRebuildStatus():Promise<RebuildStatusView|null> {
|
|
2159
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;}
|
|
2160
|
-
|
|
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)??{})};
|
|
2161
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}));}
|
|
2162
2186
|
// #315: a config polygon the editor cannot read as an ellipse is named, never shown as an empty row.
|
|
2163
|
-
chestFormPart??=chestSeed(rebuildStatus).part;
|
|
2164
2187
|
const refused=chestSeed(chestStatusForPart(rebuildStatus,chestFormPart)).refusals;if(refused.length)chestEditor?.notify(refused.join(' · '),true,refused);
|
|
2165
2188
|
// #342: a rig with no contour mesh disables the chest tools before use and says why in words about the rig.
|
|
2166
2189
|
const noContour=noContourReason(rebuildStatus);chestEditor?.unavailable(noContour?.text??null);
|
|
@@ -2175,6 +2198,7 @@ async function loadRebuildStatus():Promise<RebuildStatusView|null> {
|
|
|
2175
2198
|
animationPanel?.loadSource(rebuildStatus.animations??null,rebuildStatus.reason);
|
|
2176
2199
|
if(!inspectedModel&&canManageApplied())void refreshApplied();
|
|
2177
2200
|
renderDropNotices();
|
|
2201
|
+
const selected=parts?.value()?.slot;if(selected)void openStageCorrection({part:selected,instrument:'selection'});
|
|
2178
2202
|
return rebuildStatus;
|
|
2179
2203
|
}
|
|
2180
2204
|
/** The handoff line (#101): path, hash and how it was found, then the baseline; re-read while the baseline runs. */
|
|
@@ -2342,7 +2366,7 @@ async function applyRebuild():Promise<void> {
|
|
|
2342
2366
|
if(rebuildBusy)return;
|
|
2343
2367
|
if(readOnly){chestEditor?.notify(readOnly,true);return;}
|
|
2344
2368
|
const loadedStatus=rebuildStatus??await loadRebuildStatus();
|
|
2345
|
-
const status=loadedStatus?chestStatusForPart(loadedStatus,stageCorrectionPart):loadedStatus;
|
|
2369
|
+
const status=loadedStatus?chestStatusForPart(loadedStatus,stageCorrectionPart??chestFormPart):loadedStatus;
|
|
2346
2370
|
const selectedSlot=parts?.value()?.slot??stageDraftSelection?.slot??null;
|
|
2347
2371
|
if(stageCorrectionPart&&selectedSlot!==stageCorrectionPart){chestEditor?.notify('STAGE_DRAFT_MISMATCH',true);return;}
|
|
2348
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;}
|
|
@@ -3055,7 +3079,7 @@ function setupComments():void {
|
|
|
3055
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;
|
|
3056
3080
|
},
|
|
3057
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,
|
|
3058
|
-
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),
|
|
3059
3083
|
refusal:()=>host?.record&&!host.record.hasPicture?null:commentCaptureRefusal(),blocked:()=>saving||!!persistence?.restoring()||seekingControl||!!video?.seeking||!!rebuildBusy||!!appliedOnStage,shortcutBlocked:()=>!!meshEditor?.active()
|
|
3060
3084
|
});
|
|
3061
3085
|
}
|
|
@@ -3310,7 +3334,15 @@ async function prepareStageDraftBuild(
|
|
|
3310
3334
|
try{prevAssets?.dispose();}catch{/* ignore */}
|
|
3311
3335
|
return {status,mapping};
|
|
3312
3336
|
}
|
|
3313
|
-
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
|
+
}
|
|
3314
3346
|
if(readOnly)throw new Error(readOnly);
|
|
3315
3347
|
if(rebuildBusy)throw new Error('STAGE_DRAFT_STALE');
|
|
3316
3348
|
const buildId=appliedOnStage?.buildId??'inspected';
|
|
@@ -83,7 +83,7 @@ export function bindPartsSubject(host:{
|
|
|
83
83
|
data:PartsSubjectData;canvas:HTMLCanvasElement;referenceCanvas:HTMLCanvasElement;viewport:ViewportController;
|
|
84
84
|
el:ViewportProvider['el'];toolbar:HTMLElement;commentsHost:HTMLElement;openComments?:()=>void;hasPicture?:()=>boolean;issues:PartsIssue[];recordComments?:CommentRow[];
|
|
85
85
|
request:(path:string,init?:RequestInit)=>Promise<Response>;base:string;paintingPath:string;
|
|
86
|
-
mesh:()=>boolean;restoreMesh:(on:boolean)=>void;images:()=>boolean;changed:()=>void
|
|
86
|
+
mesh:()=>boolean;restoreMesh:(on:boolean)=>void;images:()=>boolean;changed:()=>void|Promise<void>;selectionChanged:()=>void;locked:(id:string)=>boolean;refusal:()=>string|null;drawn:(input:{state:'loaded'}|{state:'failed';reason:string})=>void;message:ViewportProvider['message'];
|
|
87
87
|
}) {
|
|
88
88
|
const data=host.data,hidden=new Set<string>(),images=new Map<number,Promise<HTMLImageElement>>(),loaded=new Map<string,HTMLImageElement>(),assemblyAlpha=new Map<string,{box:Box;alpha:Uint8ClampedArray}>();
|
|
89
89
|
let selected:string|null=null,solo=false,comparison:PartsComparison=defaultPartsComparison(),token=0,disposed=false,busy=false,failed=false;
|
package/web/stage-comments.ts
CHANGED
|
@@ -27,7 +27,7 @@ interface Host<Row extends CommentRow=Feedback,Pose extends CommentUiPose=Commen
|
|
|
27
27
|
pose:(view:StageComment['viewport'])=>Pose|null;pause:()=>Promise<void>;
|
|
28
28
|
bookmark:()=>unknown;restore:(bookmark:unknown,timeOnly?:boolean)=>Promise<void>;
|
|
29
29
|
feedback:()=>Row[];locked:(id:string)=>boolean;
|
|
30
|
-
add:(feedback:Row,side?:'a'|'b')=>void;changed:()=>void
|
|
30
|
+
add:(feedback:Row,side?:'a'|'b')=>void;changed:()=>void|Promise<void>;error:(message:string)=>void;
|
|
31
31
|
general?:{create:(summary:string)=>Row;matches:(row:Row)=>boolean};
|
|
32
32
|
refusal?:()=>string|null;blocked:()=>boolean;busy?:()=>boolean;busyError?:(message:string)=>void;shortcutBlocked?:()=>boolean;shortcutActive?:()=>boolean;codec?:CommentCodec<Row,Pose>;
|
|
33
33
|
}
|
|
@@ -209,7 +209,10 @@ export function bindStageComments<Row extends CommentRow=Feedback,Pose extends C
|
|
|
209
209
|
const n=rigPose.frame?.index??null;host.add({id:crypto.randomUUID(),frameStart:n,frameEnd:n,target:slots[0]?{kind:'slot',name:slots[0].slot}:{kind:'rig',name:rigPose.rig},category:'defect',summary,context:{animation:rigPose.animation,time:rigPose.time,frame:rigPose.frame?.basis==='producer'?n:null,...(turn?{turn:turn as any}:{}),interval:n===null?null:{frameStart:n,frameEnd:n,inclusive:true},comment:comment as any} } as unknown as Row,rigPose.side);
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
|
-
|
|
212
|
+
busy=true;field.disabled=true;syncChips();
|
|
213
|
+
await host.changed();
|
|
214
|
+
if(disposed||generation!==interaction)return;
|
|
215
|
+
cancel();refresh();revealLatest();
|
|
213
216
|
}catch(e){if(disposed||generation!==interaction)return;const msg=e instanceof Error?e.message:String(e);errorSource=toEn(msg);error.textContent=t(errorSource);place();if(locked)host.error(t(errorSource));field.disabled=false;field.focus();}finally{busy=false;if(composer===form)syncChips();}};
|
|
214
217
|
field.focus();last='';
|
|
215
218
|
};
|