rig-review 4.10.0 → 4.12.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 +16 -12
- package/docs/PANELS.md +3 -1
- package/docs/REVIEW_PACKAGE.md +91 -16
- package/docs/STABILITY.md +38 -0
- package/package.json +2 -2
- package/src/cloth-recipe.ts +27 -7
- package/src/job-act.ts +4 -2
- package/src/job-api.ts +21 -9
- package/src/job-checkpoint-evidence.ts +17 -0
- package/src/job-contract.ts +18 -2
- package/src/job-front.ts +34 -5
- package/src/job-source.ts +34 -9
- package/src/open-workspace-state.ts +6 -1
- package/src/open.ts +3 -3
- package/src/rebuild.ts +42 -10
- package/src/stage-comment.ts +32 -4
- package/web/catalog-en.ts +13 -2
- package/web/catalog-ko.ts +38 -27
- package/web/cloth-panel.ts +1 -1
- package/web/compare.css +1 -1
- package/web/environment-world.ts +9 -0
- package/web/inspector-blocks.ts +9 -7
- package/web/interview-panel.ts +2 -2
- package/web/job-rig-screen.ts +15 -8
- package/web/job-session.ts +39 -27
- package/web/label-placement.ts +2 -1
- package/web/main.ts +150 -90
- package/web/parts-viewport-provider.ts +2 -2
- package/web/rebuild-client.ts +1 -1
- package/web/rig-host.ts +1 -1
- package/web/rig-viewport-provider.ts +4 -5
- package/web/stage-comments.ts +7 -1
- package/web/styles.css +24 -3
- package/web/viewport-controller.ts +4 -0
- package/web/workspace-layout.ts +8 -6
- package/web/workspace-preferences.ts +10 -8
- package/web/workspace-ui.ts +53 -27
package/web/main.ts
CHANGED
|
@@ -14,7 +14,7 @@ import {rigWorkspaceMarkup,rigFeedbackMarkup,sharedViewToolsMarkup,sharedComment
|
|
|
14
14
|
import {bindDirectionPanel} from './direction-panel.ts';
|
|
15
15
|
import {bindWorkspaceVisibility} from './workspace-visibility.ts';
|
|
16
16
|
import type {DirectionInspection} from '../src/direction-inspection.ts';
|
|
17
|
-
import {parseStageComment,feedbackItemComments,projectComments,timeOnlyBasis,unprojectMark,feedbackTimingLabel,requireFeedbackFrames,isTimeOnlyFeedback} from '../src/stage-comment.ts';
|
|
17
|
+
import {parseStageComment,parsePictureCommentLabel,feedbackItemComments,projectComments,timeOnlyBasis,unprojectMark,feedbackTimingLabel,requireFeedbackFrames,isTimeOnlyFeedback,type StageComment} from '../src/stage-comment.ts';
|
|
18
18
|
import {bindStageComments,type CommentRow,type CommentPose} from './stage-comments.ts';
|
|
19
19
|
import {discoverTurnDials,TurnState} from '../src/turn-pad.ts';
|
|
20
20
|
import {bindTurnPad,type TurnPad} from './turn-pad.ts';
|
|
@@ -72,7 +72,7 @@ import {createWindModel,environmentFor,windReadout,RUNTIME_START_READOUT,joltPac
|
|
|
72
72
|
import {tuningRows,readoutRows,type InspectedCheckView} from '../src/physics-tuning.ts';
|
|
73
73
|
import {bindReadingsPanel,type ReadingsJobView,type ReadingsPanel,type ReadingsRefusal} from './readings-panel.ts';
|
|
74
74
|
import {READINGS_SCHEMA,readingSeekTime,type ReadingsContext} from '../src/readings.ts';
|
|
75
|
-
import {
|
|
75
|
+
import {windClockOnMove,type ClipMove,environmentCheckRows,scheduleContext,worldExport,type EnvironmentCheckView,type WorldExport} from './environment-world.ts';
|
|
76
76
|
import {barLine,beforeLine} from '../src/physics-tuning.ts';
|
|
77
77
|
import {bindRequirementsPanel,type RequirementsCatalogView,type RequirementsJobView,type RequirementsPanel,type RequirementsRefusal} from './requirements-panel.ts';
|
|
78
78
|
import {patchRoute} from '../src/retune-route.ts';
|
|
@@ -106,7 +106,7 @@ const el = <T extends HTMLElement = HTMLElement>(id: string): T => {
|
|
|
106
106
|
const input = (id: string) => el<HTMLInputElement>(id);
|
|
107
107
|
const select = (id: string) => el<HTMLSelectElement>(id);
|
|
108
108
|
const button = (id: string) => el<HTMLButtonElement>(id);
|
|
109
|
-
const titledIds = new Set(['message', 'player-state', 'layout-state', 'renderer-state', 'layer-state', 'idle-state', 'control-state', 'draft-state', 'rig-label', 'reference-label', 'coordinates']);
|
|
109
|
+
const titledIds = new Set(['message', 'review-message', 'player-state', 'layout-state', 'renderer-state', 'layer-state', 'idle-state', 'control-state', 'draft-state', 'rig-label', 'reference-label', 'coordinates']);
|
|
110
110
|
// #347: write only a changed source, so a played frame does not rewrite (and re-translate) unchanged text.
|
|
111
111
|
const text = (id: string, value: string) => { const node = el(id); setSourceText(node, value); if (titledIds.has(id)) setSourceAttribute(node, 'title', value); };
|
|
112
112
|
const option = (value: string, label: string) => { const item = document.createElement('option'); item.value = value; item.textContent = label; return item; };
|
|
@@ -117,6 +117,10 @@ let host:JobRigMeshHost|null=rigHost(),access=host?.access??pageInstanceAccess()
|
|
|
117
117
|
let partsOnly=host?.subject==='parts'||screenRoot.dataset.reviewScreen==='parts';
|
|
118
118
|
let firstPublicationPrompt=!!host?.waiting;
|
|
119
119
|
const app=el('app');app.innerHTML=rigWorkspaceMarkup+rigFeedbackMarkup;
|
|
120
|
+
/** #1041: the right panel is communication with the AI: the pending question, Comments and (later) record forms.
|
|
121
|
+
* The bottom panel keeps the controllers tied to the view. */
|
|
122
|
+
const communicationPanel=panelMake('aside',{id:'workspace-communication',className:'workspace-communication',hidden:true});
|
|
123
|
+
setSourceAttribute(communicationPanel,'aria-label','Communication');
|
|
120
124
|
const rigStatusBar=mountStatusBar({
|
|
121
125
|
message:'Loading local review package…',
|
|
122
126
|
readouts:[
|
|
@@ -139,7 +143,7 @@ const rigStatusBar=mountStatusBar({
|
|
|
139
143
|
app.querySelector<HTMLElement>('[data-workspace-status]')!.replaceWith(rigStatusBar.footer);
|
|
140
144
|
for(const id of ['layout-state','idle-state','control-state','draft-state'])el(id).setAttribute('role','status');
|
|
141
145
|
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');
|
|
142
|
-
const shell=mountWorkspaceShell({compatibility:'rigStep1',
|
|
146
|
+
const shell=mountWorkspaceShell({compatibility:'rigStep1',embedded:new URLSearchParams(location.search).has('stageEmbed')&&!location.pathname.endsWith('/stage-interview.html')});app.prepend(shell.header,...shell.actRow?[shell.actRow]:[]);
|
|
143
147
|
el('app').querySelector<HTMLElement>('[data-workspace-comment]')!.innerHTML=sharedCommentMarkup;
|
|
144
148
|
el('app').querySelector<HTMLElement>('[data-workspace-layers]')!.append(createRigLayerControls());
|
|
145
149
|
el('app').querySelector<HTMLElement>('[data-workspace-view-tools]')!.innerHTML=sharedViewToolsMarkup;
|
|
@@ -149,7 +153,7 @@ const primaryToolbar=app.querySelector<HTMLElement>('.viewbar')!;primaryToolbar.
|
|
|
149
153
|
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);
|
|
150
154
|
for(const event of ['click','change'])secondaryToolbar.addEventListener(event,()=>{if(rigDifference){leaveRigDifference();renderLayout();}},true);
|
|
151
155
|
const rigInspector=mountRigInspector(document,shell.actRow??undefined);
|
|
152
|
-
|
|
156
|
+
rigInspector.act.hidden=true;
|
|
153
157
|
const rigAsk=panelMake('button',{className:'workspace-act-ask',id:'workspace-pending-ask',hidden:true});rigAsk.type='button';
|
|
154
158
|
const recordAsk=panelMake('button',{className:'workspace-act-ask',id:'workspace-pending-record-ask',hidden:true,type:'button'});
|
|
155
159
|
const askHeadline=panelMake('span',{id:'workspace-ask-headline',className:'workspace-act-ask',hidden:true});
|
|
@@ -296,7 +300,7 @@ function message(value: string, error = false, footerOnly = false, diagnostic?:
|
|
|
296
300
|
delete reviewMessage.dataset.partsPinRefusal;
|
|
297
301
|
}
|
|
298
302
|
text('review-message', value); reviewMessage.classList.toggle('error', error);
|
|
299
|
-
if(
|
|
303
|
+
if(error&&rigInspector.act.hidden&&!rigInspector.answersRendered){
|
|
300
304
|
for(const node of rigInspector.act.querySelectorAll<HTMLElement>('#save,#review-status,label[for="review-status"]'))node.hidden=true;
|
|
301
305
|
rigInspector.act.hidden=false;
|
|
302
306
|
rigInspector.syncActRow?.();
|
|
@@ -339,8 +343,8 @@ let liveIssueCount=()=>(session?.feedback.length??0)+(host?.verdictComments?.row
|
|
|
339
343
|
function renderDraftState(): void {
|
|
340
344
|
const live=host?.reviewState?.(liveIssueCount(),saving);
|
|
341
345
|
renderAnswerControls();
|
|
342
|
-
if (draftStatus === null && !live && !answerSaved) return;
|
|
343
|
-
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&&/^(The source changed, so |Local draft could not be saved|Local draft storage unavailable|Local draft needs explicit recovery)/.test(draftStatus)?draftStatus:actReadOnly??live??draftStatus
|
|
346
|
+
if (draftStatus === null && !live && !answerSaved && !dirty && !saving && !draftConflict && !actReadOnly && !session?.updatedAt) return;
|
|
347
|
+
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.' : saving ? 'Saving…' : answerSaved ? 'Answer saved' : draftStatus&&/^(The source changed, so |Local draft could not be saved|Local draft storage unavailable|Local draft needs explicit recovery)/.test(draftStatus)?draftStatus:actReadOnly??live??draftStatus??(dirty ? 'Unsubmitted changes' : session?.updatedAt ? 'Submitted' : 'Not submitted') });
|
|
344
348
|
if(answerSaved&&!saving&&!draftConflict&&!dirty&&!actReadOnly&&(host?.record||!host)&&
|
|
345
349
|
(host?.pendingSubjects?.()??pendingAnswers).every(subject=>subject.kind==='interview-picks')&&!el('message').classList.contains('error'))message(sourceTextContent(el('dirty')),false,true);
|
|
346
350
|
}
|
|
@@ -867,19 +871,26 @@ function configureTurnPad(model:unknown):void {
|
|
|
867
871
|
if(previous&&turnPad){try{turnPad.restore(previous);}catch{message('TURN_STATE_MODEL_MISMATCH: turn values reset for this build.',true);}}
|
|
868
872
|
workspace?.refresh();
|
|
869
873
|
}
|
|
870
|
-
/** Verify the same response consumed by Play, rather than a second read of its source.
|
|
874
|
+
/** Verify the same response consumed by Play, rather than a second read of its source. One request per input per
|
|
875
|
+
* load (#1050): the verified response is kept for this load, and the part catalog and model document read it again
|
|
876
|
+
* through the same fetch. A new load (a rebuild, another build) calls this again and gets a fresh request. */
|
|
871
877
|
function stageLoadInputs(modelUrl:string, modelHash:string) {
|
|
872
878
|
const setsUrl=modelUrl===inspectedModel?.url&&data.manifest.sets&&data.setsHash
|
|
873
879
|
?new URL(assetUrl(data.manifest.sets),location.href).href:null;
|
|
880
|
+
const verified=new Map<string,Promise<Response>>();
|
|
874
881
|
const checkedFetch=new Proxy(fetch,{apply:async(_target,_this,args:Parameters<typeof fetch>)=>{
|
|
875
|
-
const
|
|
882
|
+
const url=String(args[0]),expected=url===modelUrl?modelHash:url===setsUrl?data.setsHash:null;
|
|
876
883
|
if(!expected)throw new Error('DIRECTION_SOURCE_CHANGED: undeclared playback input');
|
|
877
|
-
|
|
878
|
-
if(!
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
884
|
+
let pending=verified.get(url);
|
|
885
|
+
if(!pending){pending=(async()=>{
|
|
886
|
+
const response=await fetch(...args);
|
|
887
|
+
if(!response.ok)return response;
|
|
888
|
+
const bytes=await response.arrayBuffer();
|
|
889
|
+
const sha256=Array.from(new Uint8Array(await crypto.subtle.digest('SHA-256',bytes)),v=>v.toString(16).padStart(2,'0')).join('');
|
|
890
|
+
if(sha256!==expected)throw new Error('DIRECTION_SOURCE_CHANGED: playback bytes differ from the bound SHA-256');
|
|
891
|
+
return new Response(bytes,{status:response.status,statusText:response.statusText,headers:response.headers});
|
|
892
|
+
})();verified.set(url,pending);}
|
|
893
|
+
return (await pending).clone();
|
|
883
894
|
}});
|
|
884
895
|
return {setsUrl,fetch:checkedFetch};
|
|
885
896
|
}
|
|
@@ -914,14 +925,15 @@ async function initPlayer(initialCheckpoint?:Checkpoint): Promise<void> {
|
|
|
914
925
|
try {
|
|
915
926
|
const modelUrl = new URL(assetUrl(data.manifest.model), location.href).href;
|
|
916
927
|
inspectedModel={url:modelUrl,prefix:access.route('/assets/'),sha256:data.reviewedSource.rig?.sha256??''};stageModelHash=inspectedModel.sha256||null;
|
|
917
|
-
|
|
928
|
+
const inputs=stageLoadInputs(modelUrl,inspectedModel.sha256);
|
|
929
|
+
assets = await loadModel({ modelUrl, ...inputs, resolvePage: (name, url) => {
|
|
918
930
|
const target = new URL(name, url); if (target.origin !== location.origin || !target.pathname.startsWith(access.route('/assets/'))) throw new Error(`Model page escapes local package: ${name}`); return target.href;
|
|
919
931
|
} });
|
|
920
932
|
if(data.scene){sceneComposite=bindScenePlates(data.scene,await loadScenePlates(data.scene,assetUrl));input('idle-repeat').checked=data.direction!.take.loop;input('idle-repeat').disabled=true;}
|
|
921
933
|
player = createInspectionPlayer(el('rig-root'), assets,sceneComposite?'canvas':undefined);
|
|
922
934
|
setupChestWorld = readSetupChest(player);
|
|
923
935
|
// Parts inspection is an add-on: a catalog refusal is shown in the explorer and never aborts the rig.
|
|
924
|
-
try{const catalog=await loadPartModel(modelUrl,data.reviewedSource.rig!.sha256,data.feedbackCatalog.slots??[]);inspectionSourceState='ready';partModel=catalog.model;configureTurnPad(catalog.model);refreshAnimationInspection();weightsView?.refresh();parts?.register('single',catalog.entries,player,new PartThumbnails(pageRegionTable(catalog.model),assets.pageImages));}catch(error){inspectionSourceState='failed';partModel=null;refreshAnimationInspection();parts?.refuseCatalog('single',error);}
|
|
936
|
+
try{const catalog=await loadPartModel(modelUrl,data.reviewedSource.rig!.sha256,data.feedbackCatalog.slots??[],inputs.fetch);inspectionSourceState='ready';partModel=catalog.model;configureTurnPad(catalog.model);refreshAnimationInspection();weightsView?.refresh();parts?.register('single',catalog.entries,player,new PartThumbnails(pageRegionTable(catalog.model),assets.pageImages));}catch(error){inspectionSourceState='failed';partModel=null;refreshAnimationInspection();parts?.refuseCatalog('single',error);}
|
|
925
937
|
const animations = select('animation-select'); animations.replaceChildren();
|
|
926
938
|
for (const item of assets.animations) animations.append(option(item.name, data.manifest.animations.find(a => a.id === item.name)?.label ?? item.name));
|
|
927
939
|
animations.disabled = assets.animations.length === 0 || !!data.scene;
|
|
@@ -935,7 +947,7 @@ async function initPlayer(initialCheckpoint?:Checkpoint): Promise<void> {
|
|
|
935
947
|
select('axis-select').replaceChildren(); for (const axis of validAxes) select('axis-select').append(option(axis.id, axis.label));
|
|
936
948
|
input('axis-value').disabled = !validAxes.length;
|
|
937
949
|
for(const id of ['layer-images','layer-mesh','layer-bones'])input(id).disabled=false;
|
|
938
|
-
enableEnvironment(modelUrl);
|
|
950
|
+
enableEnvironment(modelUrl,inputs.fetch);
|
|
939
951
|
describeLayerToggles(document,el('layer-state').textContent??'');
|
|
940
952
|
fitCamera();
|
|
941
953
|
} catch (error) { turnPad?.dispose();turnPad=null;document.getElementById('turn-pad-host')?.remove();text('renderer-state',rendererStatus(null,'failed').label);player?.dispose(); player = null; assets?.dispose(); assets = null; text('player-state', 'Rig load failed'); text('rig-empty', `Could not open rig: ${errorText(error)}`); message(errorText(error), true); }
|
|
@@ -1320,15 +1332,19 @@ function bind(): void {
|
|
|
1320
1332
|
/** The one shell and block binding, for either subject. */
|
|
1321
1333
|
function bindWorkspace(hasModel=false,empty=false):void {
|
|
1322
1334
|
if(!workspace){
|
|
1323
|
-
|
|
1335
|
+
const layout=screenRoot.querySelector<HTMLElement>('.layout')!;layout.append(communicationPanel);
|
|
1336
|
+
workspace=bindWorkspaceUI({root:screenRoot,regions:{layout,left:screenRoot.querySelector<HTMLElement>('.left-panel')!,main:el('stage-layout').parentElement!,stage:el('stage-layout'),bottom:screenRoot.querySelector<HTMLElement>('.inspector')!,right:communicationPanel,columns:{left:'rightWidth',right:'communicationWidth'},rightPending:communicationPending,bottomBound:()=>inspectorBlocks!==null},language:shell.language!,bottomPanel:rigInspector,changed:fitCamera,defaultTheme:theme=>appearance?.set(theme),currentTheme:()=>appearance?.get()});
|
|
1324
1337
|
viewport.state.cameraSync=workspace.defaults().defaultCameraSync;input('camera-sync').checked=viewport.state.cameraSync;input('idle-repeat').checked=workspace.defaults().defaultIdleRepeat;
|
|
1325
1338
|
appearance=bindAppearance(select('settings-theme'),workspace.defaults().theme);
|
|
1326
1339
|
}
|
|
1327
1340
|
if(empty)return;
|
|
1328
1341
|
bindReviewDialog();
|
|
1329
|
-
// The
|
|
1330
|
-
rigInspector.
|
|
1331
|
-
|
|
1342
|
+
// The question on top, Comments below; Comment rows sit above the provenance block and the review form.
|
|
1343
|
+
const comments=rigInspector.comments.panel;comments.hidden=false;
|
|
1344
|
+
comments.querySelector('.review-dialog-header')?.after(el('comments-list-host'));
|
|
1345
|
+
communicationPanel.append(questionPanel,recordPanel,comments);
|
|
1346
|
+
inspectorBlocks=bindInspectorBlocks({sections:[el('inspector-rig'),el('inspector-playback')],available:host?.record&&(!host.record.hasPicture||!hasModel&&!partsOnly)?['feedback']:undefined,bottom:{strip:rigInspector.strip},changed:()=>{syncQuestionImage();workspace?.refresh();persistence?.save();}});
|
|
1347
|
+
workspace?.refresh();
|
|
1332
1348
|
}
|
|
1333
1349
|
async function start(): Promise<void> {
|
|
1334
1350
|
try {
|
|
@@ -1382,6 +1398,7 @@ async function start(): Promise<void> {
|
|
|
1382
1398
|
(el('package-context') as HTMLDetailsElement).open = data.manifest.checkpoints.length > 0 || data.manifest.references.length > 0;
|
|
1383
1399
|
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;
|
|
1384
1400
|
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(host)chestEditor?.sync();else 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,readOnlyReason:sealedRecordRigReadOnly,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();
|
|
1401
|
+
if(!host&&!data.capabilities.preRig)renderPendingSubjects([{kind:'review-verdict',stage:'rig-review'}]);
|
|
1385
1402
|
const requestedId = new URLSearchParams(location.search).get('checkpoint'),initial=initialReviewSelection(data.manifest,requestedId,data.explicitReference?.id,data.initialAnimation??undefined),first=initial.checkpoint;
|
|
1386
1403
|
rigInput=data.manifest.model?{state:'pending'}:{state:'absent'};renderLayout();
|
|
1387
1404
|
// A job rig subject lands in Animate before the model finishes loading (#709).
|
|
@@ -1398,7 +1415,7 @@ async function start(): Promise<void> {
|
|
|
1398
1415
|
else if (host?.ownerActAccess) message('Not submitted',false,true);
|
|
1399
1416
|
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.');
|
|
1400
1417
|
frameHandle=requestAnimationFrame(tick);
|
|
1401
|
-
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();
|
|
1418
|
+
const restored=await setupPersistence();setupComments();renderPendingSubjects(host?.pendingSubjects?.()??(data.capabilities.preRig?[]:[{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();
|
|
1402
1419
|
// Only an instance that serves agent control is asked for its config: a plain open has no control endpoint (#164).
|
|
1403
1420
|
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)});
|
|
1404
1421
|
bindWorkspaceVisibility({key:access.key,sourceHash:data.sourceHash,pause});
|
|
@@ -1513,6 +1530,7 @@ async function startParts(opened:PartsSubjectEntry,saved:PartsSubjectSession,wri
|
|
|
1513
1530
|
};
|
|
1514
1531
|
viewDisposers.push(viewport.bindControls(unitScaleMessage),viewport.bindNavigation(undefined,()=>!el('stage-layout').getAttribute('aria-busy')?.includes('true')),bindLayerShortcuts(document));
|
|
1515
1532
|
const resize=viewport.observeResize();viewDisposers.push(()=>resize.disconnect());
|
|
1533
|
+
if(!host)renderPendingSubjects([{kind:'parts-verdict'}]);
|
|
1516
1534
|
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();
|
|
1517
1535
|
setupPartsPersistence=async()=>{
|
|
1518
1536
|
if(host?.record)return;
|
|
@@ -1540,7 +1558,7 @@ async function startParts(opened:PartsSubjectEntry,saved:PartsSubjectSession,wri
|
|
|
1540
1558
|
function showRecordComments(preserveInspector=false):void {
|
|
1541
1559
|
for(const child of el('proposal-panel').children)if(child.id!=='comments-list-host')(child as HTMLElement).hidden=true;
|
|
1542
1560
|
if(preserveInspector)return;
|
|
1543
|
-
for(const child of rigInspector.comments.panel.children)(child as HTMLElement).hidden=child!==el('proposal-panel')&&!child.classList.contains('review-dialog-header');
|
|
1561
|
+
for(const child of rigInspector.comments.panel.children)(child as HTMLElement).hidden=child!==el('proposal-panel')&&child!==el('comments-list-host')&&!child.classList.contains('review-dialog-header');
|
|
1544
1562
|
rigInspector.comments.panel.style.display='block';
|
|
1545
1563
|
rigInspector.collapse.disabled=false;setSourceAttribute(rigInspector.collapse,'title','');
|
|
1546
1564
|
}
|
|
@@ -1555,7 +1573,7 @@ async function startRecord(interview?:InterviewSubjectEntry):Promise<void> {
|
|
|
1555
1573
|
readOnly=tr(interview?'MODEL_UNAVAILABLE':'JOB_REVIEW_READ_ONLY');
|
|
1556
1574
|
if(!interview)actReadOnly=readOnlyReason(access,true,host?.ownerActAccess);
|
|
1557
1575
|
bindWorkspace();bindInspector(true);rigInput={state:'absent'};referenceInput={state:'absent'};renderLayout();
|
|
1558
|
-
parts=new PartExplorer(el('workspace-left'),el('selected-part'),()=>{},()=>{});text('checkpoints','No checkpoints supplied.');text('dirty','Not submitted');if(interview)message(unavailable);else message(actReadOnly??(host?.record?.questionPicture?'':unavailable),!!actReadOnly);
|
|
1576
|
+
parts=new PartExplorer(el('workspace-left'),el('selected-part'),()=>{},()=>{});text('checkpoints','No checkpoints supplied.');text('dirty','Not submitted');if(interview)message(unavailable);else message(actReadOnly??(host?.record?.questionPicture||host?.record?.planPicture?'':unavailable),!!actReadOnly);
|
|
1559
1577
|
text('package-title',interview?.label??host!.record!.label);text('revision','');text('source-hash',`source ${(interview?.sourceHash??host!.record!.sourceHash).slice(0,12)}`);
|
|
1560
1578
|
el('rig-pane').hidden=false;el('rig-empty').hidden=false;text('rig-empty',unavailable);
|
|
1561
1579
|
for(const region of document.querySelectorAll('.inspector,.workspace-secondary-toolbar'))for(const control of region.querySelectorAll<HTMLInputElement|HTMLSelectElement|HTMLTextAreaElement|HTMLButtonElement>('input,select,textarea,button')){
|
|
@@ -1573,7 +1591,7 @@ async function startRecord(interview?:InterviewSubjectEntry):Promise<void> {
|
|
|
1573
1591
|
if(interview){
|
|
1574
1592
|
button('stage-comment').hidden=true;
|
|
1575
1593
|
button('save').disabled=true;setSourceAttribute(button('save'),'aria-description',unavailable);
|
|
1576
|
-
viewDisposers.push(await joinedInterviewForms(access,forms=>renderRecordForms(forms,
|
|
1594
|
+
viewDisposers.push(await joinedInterviewForms(access,forms=>renderRecordForms(forms,true)));
|
|
1577
1595
|
text('provenance-rig',unavailable);text('provenance-motion',unavailable);text('source-files','project.json');
|
|
1578
1596
|
}else{restoreRecordComments();setupComments();showRecordComments();rigInspector.comments.button.disabled=false;button('stage-comment').disabled=false;}
|
|
1579
1597
|
const resize=viewport.observeResize();viewDisposers.push(()=>resize.disconnect());
|
|
@@ -1582,15 +1600,17 @@ async function startRecord(interview?:InterviewSubjectEntry):Promise<void> {
|
|
|
1582
1600
|
document.body.dataset.ready='true';
|
|
1583
1601
|
if(!interview){host!.attach({recordForms:renderRecordForms,pendingSubjects:renderPendingSubjects,progress:setJobProgress,stage:()=>null,redraw:()=>{},message:(value,error,diagnostic)=>message(value,error,false,diagnostic),suspend:suspendScreen,resume:resumeScreen,dispose:disposeScreen});host!.displayed();}
|
|
1584
1602
|
}
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1603
|
+
/** #1041 B: checkpoint, signoff and plan-approval forms are a right-panel section, below the question and above Comments. */
|
|
1604
|
+
const recordPanel=panelMake('section',{id:'job-record-asks',className:'workspace-interview-panel',hidden:true});
|
|
1605
|
+
recordPanel.tabIndex=-1;const recordTitle=panelMake('h2',{});recordPanel.append(panelMake('div',{className:'review-dialog-header'},recordTitle));
|
|
1606
|
+
const recordForms=()=>[...recordPanel.querySelectorAll<HTMLFormElement>('form[data-job-ask]')];
|
|
1607
|
+
viewDisposers.push(()=>{for(const form of recordForms())form.remove();recordPanel.hidden=true;});
|
|
1589
1608
|
let unregisterQuestion:(()=>void)|null=null;
|
|
1590
|
-
let activeInterviewImages:readonly {name:string;src:string}[]|null=null;
|
|
1591
|
-
let activeInterviewImage:{name:string;src:string}|null=null;
|
|
1609
|
+
let activeInterviewImages:readonly {name:string;src:string;path?:string;sha256?:string}[]|null=null;
|
|
1610
|
+
let activeInterviewImage:{name:string;src:string;path?:string;sha256?:string}|null=null;
|
|
1592
1611
|
let releaseInterview:(()=>void)|null=null;
|
|
1593
1612
|
const questionPanel=panelMake('section',{id:'workspace-interview-answer',className:'workspace-interview-panel',hidden:true});
|
|
1613
|
+
{const title=panelMake('h2',{});setSourceText(title,'Question');questionPanel.append(panelMake('div',{className:'review-dialog-header'},title));}
|
|
1594
1614
|
let questionForms:readonly HTMLElement[]=[];
|
|
1595
1615
|
/** #1004: several question forms share the Question tab; the list shows one at a time. */
|
|
1596
1616
|
let selectedQuestionAsk:string|undefined;
|
|
@@ -1627,10 +1647,16 @@ function restoreRecordComments(form?:HTMLFormElement):void {
|
|
|
1627
1647
|
ids.add(row.id);
|
|
1628
1648
|
if(host?.verdictComments&&('schema' in row||'target' in row))throw new Error('JOB_ACT_INVALID');
|
|
1629
1649
|
if('schema' in row){const issue=parsePartsIssue(row,false,true,false),items=new Map((partsSubject?.items()??[]).map(item=>[item.name,{...item,imageHash:item.imageHash!}]));assertPartsIssueBinding(issue,items,partsSubject!.sourceHash());}
|
|
1630
|
-
else if('target' in row){const mark=parseStageComment((row.context as {comment?:unknown})?.comment)
|
|
1650
|
+
else if('target' in row){const mark=parseStageComment((row.context as {comment?:unknown})?.comment),pictures=!host?.direction&&!host!.record!.hasPicture?recordPictures():undefined;
|
|
1651
|
+
if(pictures){
|
|
1652
|
+
// #1048: a plan- or question-picture pin restores only through its A1 label, parsed back against a sealed entry.
|
|
1653
|
+
if(mark.viewport!=='reference'||mark.sourceHash!==sourceHash)throw new Error('JOB_DISPLAY_MISMATCH');
|
|
1654
|
+
const label=projectComments(feedbackItemComments([row as Feedback]),pictures).split('\n')[0]!.slice(1,-1),parsed=parsePictureCommentLabel(label);
|
|
1655
|
+
if(!pictures.some(picture=>parsed.referenceId===picture.path&&parsed.referenceHash===picture.sha256))throw new Error('COMMENT_PICTURE_LABEL_INVALID: the pin does not name a sealed picture of this record');
|
|
1656
|
+
}else if((!host?.direction&&!host!.record!.hasPicture)||mark.sourceHash!==data.sourceHash)throw new Error('JOB_DISPLAY_MISMATCH');}
|
|
1631
1657
|
else if(Object.keys(row).some(key=>key!=='id'&&key!=='summary'))throw new Error('JOB_ACT_INVALID');
|
|
1632
1658
|
}
|
|
1633
|
-
if(!host?.verdictComments)projectComments(rows.map(row=>'schema' in row?partsIssueComments([row as import('../src/parts-comment.ts').PartsIssue])[0]!:'target' in row?feedbackItemComments([row as Feedback])[0]!:{text:row.summary}));
|
|
1659
|
+
if(!host?.verdictComments)projectComments(rows.map(row=>'schema' in row?partsIssueComments([row as import('../src/parts-comment.ts').PartsIssue])[0]!:'target' in row?feedbackItemComments([row as Feedback])[0]!:{text:row.summary}),recordPictures());
|
|
1634
1660
|
return rows;
|
|
1635
1661
|
};
|
|
1636
1662
|
if(!target.storageBound&&typeof window!=='undefined'&&typeof window.addEventListener==='function'){
|
|
@@ -1697,11 +1723,25 @@ function restoreRecordComments(form?:HTMLFormElement):void {
|
|
|
1697
1723
|
if(typeof renderDraftState==='function')renderDraftState();
|
|
1698
1724
|
}
|
|
1699
1725
|
}
|
|
1700
|
-
}catch{
|
|
1726
|
+
}catch(error){
|
|
1727
|
+
/* A mismatched or invalid local draft has no authority. A plan-picture pin that cannot be parsed back says so by name (#1048). */
|
|
1728
|
+
const reason=error instanceof Error?error.message:'';
|
|
1729
|
+
if(reason.startsWith('COMMENT_PICTURE_LABEL_INVALID')&&typeof message==='function')message(reason,true);
|
|
1730
|
+
}
|
|
1731
|
+
}
|
|
1732
|
+
/** #1048: the record's sealed plan picture and question images, the only `files` entries a record-host pin can name. */
|
|
1733
|
+
function recordPictures():{path:string;sha256:string}[]|undefined {
|
|
1734
|
+
const picture=host?.record?.planPicture,rows=[...picture?[{path:picture.path,sha256:picture.sha256}]:[],...host?.record?.questionPictures??[]];
|
|
1735
|
+
return rows.length?rows:undefined;
|
|
1701
1736
|
}
|
|
1702
1737
|
/** Comments remain native rows locally; the old act field carries their scalar projection only. */
|
|
1703
1738
|
function recordCommentWords():string {
|
|
1704
|
-
return projectComments(recordComments.map(row=>'schema' in row?partsIssueComments([row as import('../src/parts-comment.ts').PartsIssue])[0]!:'target' in row?feedbackItemComments([row as Feedback])[0]!:{text:row.summary}));
|
|
1739
|
+
return projectComments(recordComments.map(row=>'schema' in row?partsIssueComments([row as import('../src/parts-comment.ts').PartsIssue])[0]!:'target' in row?feedbackItemComments([row as Feedback])[0]!:{text:row.summary}),recordPictures());
|
|
1740
|
+
}
|
|
1741
|
+
/** The sealed plan picture or question image while it is the reference view's shown image; null otherwise (#1048). */
|
|
1742
|
+
function shownPlanPicture():{name:string;path:string;sha256:string}|null {
|
|
1743
|
+
const image=host?.record&&!host.record.hasPicture?activeInterviewImage:null,path=image?.path,sha256=image?.sha256;
|
|
1744
|
+
return image&&path&&sha256&&recordPictures()?.some(picture=>picture.path===path&&picture.sha256===sha256)?{name:image.name,path,sha256}:null;
|
|
1705
1745
|
}
|
|
1706
1746
|
function persistRecordComments():void {
|
|
1707
1747
|
const binding=host?.direction??host?.verdictComments??host?.record;
|
|
@@ -1723,7 +1763,7 @@ function persistRecordComments():void {
|
|
|
1723
1763
|
comments.splice(0,comments.length,...kept,...addedFromOther,...localNew);
|
|
1724
1764
|
}
|
|
1725
1765
|
knownIds.clear();for(const row of comments)knownIds.add(row.id);
|
|
1726
|
-
const dialogPublication=
|
|
1766
|
+
const dialogPublication=recordPanel.querySelector<HTMLFormElement>('form[data-job-ask]')?.dataset.jobPublication;
|
|
1727
1767
|
const activePub=binding.publicationId??dialogPublication;
|
|
1728
1768
|
const prefix=host?.verdictComments?'rig-review-verdict-comments/1:':'rig-review-record-comments/1:';
|
|
1729
1769
|
if(typeof localStorage.removeItem==='function'){
|
|
@@ -1740,13 +1780,13 @@ function recordCommentsChanged():void {
|
|
|
1740
1780
|
persistRecordComments();
|
|
1741
1781
|
setSourceText(rigInspector.comments.button,`Comments (${recordComments.length})`);
|
|
1742
1782
|
renderDraftState();
|
|
1743
|
-
for(const form of
|
|
1783
|
+
for(const form of recordForms())form.dispatchEvent(new Event('input',{bubbles:true}));
|
|
1744
1784
|
}
|
|
1745
1785
|
/** Keep the shared reference viewport bound while the interview form is mounted. */
|
|
1746
1786
|
function syncQuestionImage():void {
|
|
1747
1787
|
if(disposed){releaseInterview?.();releaseInterview=null;return;}
|
|
1748
|
-
const form=(questionForms.find(item=>!item.hidden)??questionForms[0]) as (HTMLElement&{interviewImages?:readonly {name:string;src:string}[]})|undefined;
|
|
1749
|
-
const images=form?.interviewImages;
|
|
1788
|
+
const form=(questionForms.find(item=>!item.hidden)??questionForms[0]) as (HTMLElement&{interviewImages?:readonly {name:string;src:string;path?:string;sha256?:string}[]})|undefined;
|
|
1789
|
+
const images=form?.interviewImages??(host?.record?.planPicture?[host.record.planPicture]:undefined);
|
|
1750
1790
|
if(activeInterviewImages&&images?.length===activeInterviewImages.length&&images.every((image,index)=>{
|
|
1751
1791
|
const previous=activeInterviewImages![index]!;
|
|
1752
1792
|
return previous.name===image.name&&previous.src===image.src;
|
|
@@ -1761,7 +1801,7 @@ function syncQuestionImage():void {
|
|
|
1761
1801
|
for(const button of disabled.keys())button.disabled=false;
|
|
1762
1802
|
const cameraBindings=button('zoom-in').onclick?[]:[viewport.bindControls(unitScaleMessage),viewport.bindNavigation()];
|
|
1763
1803
|
activeInterviewImages=images;activeInterviewImage=images[0]!;
|
|
1764
|
-
const restore=controls.replaceViewSwitch({currentMode:'interview-image-0',groups:[{modes:images.map((
|
|
1804
|
+
const restore=controls.replaceViewSwitch({currentMode:'interview-image-0',groups:[{modes:images.map((_image,index)=>({id:'interview-image-'+index,labelKey:images.length>1?`Reference ${index+1}`:'Reference',pressed:index===0}))}],onChange:chooseInspectionView});
|
|
1765
1805
|
viewport.state.cameraSync=false;viewport.state.activeCamera='reference';view='reference';questionPanel.dataset.questionImageActive='true';
|
|
1766
1806
|
releaseInterview=()=>{
|
|
1767
1807
|
++referenceGeneration;activeInterviewImages=null;activeInterviewImage=null;delete questionPanel.dataset.questionImageActive;restore();
|
|
@@ -1777,51 +1817,51 @@ function syncQuestionImage():void {
|
|
|
1777
1817
|
if(sourceTextContent(el('message'))==='This request has no picture.')message(sourceTextContent(el('dirty')),false,true);
|
|
1778
1818
|
void showReference('',activeInterviewImage);
|
|
1779
1819
|
}
|
|
1780
|
-
/** Survey forms
|
|
1781
|
-
function renderRecordForms(forms:readonly HTMLElement[],
|
|
1782
|
-
if(standalone){
|
|
1820
|
+
/** Survey forms take the Question section and record forms the record section, both in the right panel (#1041). */
|
|
1821
|
+
function renderRecordForms(forms:readonly HTMLElement[],standalone=false):void {
|
|
1822
|
+
if(standalone){renderPendingSubjects([{kind:'interview-picks'}]);}
|
|
1783
1823
|
for(const form of forms){
|
|
1784
1824
|
if(questionFormBindings.has(form))continue;questionFormBindings.add(form);
|
|
1785
1825
|
form.addEventListener('submit',event=>{if(draftConflict||pendingAnswers.some(subject=>subject.kind.endsWith('verdict'))){event.preventDefault();event.stopImmediatePropagation();}},true);
|
|
1786
|
-
form.addEventListener('job-answer-saved',()=>{answerSaved=true;
|
|
1826
|
+
form.addEventListener('job-answer-saved',()=>{answerSaved=true;renderDraftState();},{once:true});
|
|
1787
1827
|
}
|
|
1788
1828
|
const questionTabForms=forms.filter(form=>form.dataset.interviewMain!==undefined);
|
|
1789
1829
|
for(const form of questionForms)if(!questionTabForms.includes(form)){form.dispatchEvent(new Event('job-form-dispose'));form.remove();}
|
|
1790
1830
|
questionForms=questionTabForms;
|
|
1791
1831
|
if(questionForms.length){
|
|
1792
1832
|
for(const form of questionForms)if(form.parentElement!==questionPanel)questionPanel.append(form);
|
|
1793
|
-
const reveal=()=>{
|
|
1833
|
+
const reveal=()=>{questionPanel.hidden=false;workspace?.revealCommunication();};
|
|
1794
1834
|
rigAsk.onclick=()=>{if(!draftConflict)reveal();};
|
|
1795
1835
|
if(!unregisterQuestion){
|
|
1796
|
-
unregisterQuestion=
|
|
1797
|
-
inspectorBlocks!.restore({rig:'question',playback:'question'});reveal();
|
|
1836
|
+
unregisterQuestion=()=>{questionPanel.hidden=true;workspace?.refresh();};reveal();
|
|
1798
1837
|
}
|
|
1799
1838
|
if(questionForms.every(form=>form.dataset.interviewAnswered==='true')){answerSaved=true;firstPublicationPrompt=false;}
|
|
1800
1839
|
}else{
|
|
1801
1840
|
unregisterQuestion?.();unregisterQuestion=null;rigAsk.onclick=null;
|
|
1802
1841
|
}
|
|
1803
1842
|
showQuestionForm();
|
|
1843
|
+
// #1048: a record question form carries the comments too, in its interview-picks act's optional `words`.
|
|
1844
|
+
if(!standalone&&host?.record)for(const form of questionTabForms)(form as JobForm['form']).commentWords=recordCommentWords;
|
|
1804
1845
|
forms=forms.filter(form=>!questionTabForms.includes(form));
|
|
1805
1846
|
if(!forms.length){
|
|
1806
|
-
|
|
1807
|
-
|
|
1847
|
+
for(const form of recordForms()){form.dispatchEvent(new Event('job-form-dispose'));form.remove();}
|
|
1848
|
+
if(!recordPanel.hidden){recordPanel.hidden=true;workspace?.refresh();}
|
|
1808
1849
|
renderDraftState();return;
|
|
1809
1850
|
}
|
|
1810
|
-
if(!recordDialog){
|
|
1811
|
-
recordDialog=panelMake('dialog',{id:'job-record-asks',className:'workspace-drawer'});recordDialog.setAttribute('aria-label',tr(label));
|
|
1812
|
-
recordDialog.append(panelMake('button',{className:'workspace-drawer-close',type:'button'},tr('Close')));app.append(recordDialog);
|
|
1813
|
-
}
|
|
1814
1851
|
const trigger=questionForms.length?recordAsk:rigAsk;
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
}
|
|
1819
|
-
for(const form of recordDialog.querySelectorAll<HTMLFormElement>('form[data-job-ask]'))if(!forms.includes(form)){form.dispatchEvent(new Event('job-form-dispose'));form.remove();}
|
|
1852
|
+
// The ask line's Review…/Approve… brings the section into view; it opens with the panel like a pending question.
|
|
1853
|
+
const revealRecord=()=>{recordPanel.hidden=false;workspace?.revealCommunication();recordPanel.scrollIntoView?.({block:'nearest'});};
|
|
1854
|
+
trigger.onclick=()=>{if(draftConflict)return;revealRecord();recordPanel.focus({preventScroll:true});};
|
|
1855
|
+
for(const form of recordForms())if(!forms.includes(form)){form.dispatchEvent(new Event('job-form-dispose'));form.remove();}
|
|
1820
1856
|
if(!standalone&&forms[0])restoreRecordComments(forms[0] as HTMLFormElement);
|
|
1821
1857
|
for(const form of forms){
|
|
1822
1858
|
if(!standalone)(form as JobForm['form']).commentWords=()=>host?.record||host?.direction?recordCommentWords():partsOnly?projectComments(partsIssueComments(partsSubject?.issues()??[])):projectComments(feedbackItemComments(session.feedback));
|
|
1823
|
-
if(!
|
|
1859
|
+
if(!recordPanel.contains(form))recordPanel.append(form);
|
|
1824
1860
|
}
|
|
1861
|
+
// One line, like Question and Comments: a checkpoint form carries the outcome select, a signoff (stage or plan approval) does not.
|
|
1862
|
+
const checkpoints=forms.filter(form=>form.querySelector('select[name=outcome]')).length;
|
|
1863
|
+
setSourceText(recordTitle,checkpoints===forms.length?'Checkpoint':checkpoints?'Checkpoint · Sign-off':'Sign-off');
|
|
1864
|
+
if(recordPanel.hidden)revealRecord();
|
|
1825
1865
|
if(host?.record){
|
|
1826
1866
|
for(const child of el('proposal-panel').children)if(child.id!=='comments-list-host')(child as HTMLElement).hidden=true;
|
|
1827
1867
|
setSourceText(rigInspector.comments.button,`Comments (${recordComments.length})`);comments?.refresh();partsSubject?.refreshComments();
|
|
@@ -1868,6 +1908,8 @@ function renderAskHeadline(sentence=askSentence):void {
|
|
|
1868
1908
|
askHeadline.removeAttribute('translate');
|
|
1869
1909
|
askHeadline.style?.removeProperty('white-space');
|
|
1870
1910
|
setSourceText(askHeadline,sentence);
|
|
1911
|
+
// In a refusal the headline ellipsizes to one line (#1041); its title keeps the whole sentence.
|
|
1912
|
+
setSourceAttribute(askHeadline,'title',sentence);
|
|
1871
1913
|
return;
|
|
1872
1914
|
}
|
|
1873
1915
|
const at=Date.parse(progress.at),age=()=>Math.max(0,Math.floor((Date.now()-at)/1000));
|
|
@@ -1879,18 +1921,15 @@ function renderAskHeadline(sentence=askSentence):void {
|
|
|
1879
1921
|
// Catalog fragments are already localized. Keep the agent's text as a literal across locale changes.
|
|
1880
1922
|
askHeadline.setAttribute('translate','no');
|
|
1881
1923
|
askHeadline.style?.setProperty('white-space','pre-wrap');
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
const prefix=progress.text?phaseAndStep+' · '+progress.text:phaseAndStep;
|
|
1887
|
-
askHeadline.replaceChildren(prefix+' · ',ageText);
|
|
1888
|
-
}
|
|
1924
|
+
const [before,after]=quiet?t('job.progress.quiet',['{0}',phaseAndStep]).split('{0}'):[(progress.text?phaseAndStep+' · '+progress.text:phaseAndStep)+' · ',''];
|
|
1925
|
+
askHeadline.replaceChildren(...[before!,ageText,after!].filter(part=>part!==''));
|
|
1926
|
+
// In a refusal the headline ellipsizes to one line (#1041); its title keeps the whole sentence.
|
|
1927
|
+
const titleNow=()=>setSourceAttribute(askHeadline,'title',before!+ageText.data+after!);titleNow();
|
|
1889
1928
|
const tickAge=()=>{
|
|
1890
1929
|
const seconds=age();
|
|
1891
1930
|
if((seconds>=60)!==quiet){renderAskHeadline();return;}
|
|
1892
1931
|
const value=ageValue(seconds);
|
|
1893
|
-
if(ageText.data!==value)ageText.data=value;
|
|
1932
|
+
if(ageText.data!==value){ageText.data=value;titleNow();}
|
|
1894
1933
|
};
|
|
1895
1934
|
if(!suspended&&!disposed)progressTimer=setInterval(tickAge,1000);
|
|
1896
1935
|
}
|
|
@@ -1902,7 +1941,7 @@ function renderAnswerControls():void {
|
|
|
1902
1941
|
const dialog=subjects.some(subject=>!subject.kind.endsWith('verdict'))&&!verdict;
|
|
1903
1942
|
const readable=questionForms.some(form=>form.dataset.interviewAnswered==='true');
|
|
1904
1943
|
const questionEnabled=questionForms.some(form=>form.querySelector('fieldset:not(:disabled)'));
|
|
1905
|
-
const recordEnabled=!!
|
|
1944
|
+
const recordEnabled=!!recordPanel.querySelector('form[data-job-ask] fieldset:not(:disabled)');
|
|
1906
1945
|
const blocked=saving||draftConflict||!!actReadOnly||!!host?.unavailable;
|
|
1907
1946
|
const save=button('save');
|
|
1908
1947
|
const pendingPartComment=parts&&typeof partsSubject!=='undefined'&&!!partsSubject?.hasPendingComment?.();
|
|
@@ -1910,7 +1949,7 @@ function renderAnswerControls():void {
|
|
|
1910
1949
|
const hasPinnedPart=parts&&(liveIssueCount()>0||pendingPartComment);
|
|
1911
1950
|
const needsPinnedPart=parts&&!!host?.verdictComments?.rows.length&&!hasPinnedPart;
|
|
1912
1951
|
const pinRefusal='Request changes needs at least one comment pinned to a part.';
|
|
1913
|
-
if(
|
|
1952
|
+
if(subjects.length&&!rigInspector.actBar.saveState())rigInspector.actBar.setSaveState({kind:'unsaved',text:'Not submitted'});
|
|
1914
1953
|
select('review-status').hidden=true;document.querySelector<HTMLLabelElement>('label[for="review-status"]')!.hidden=true;
|
|
1915
1954
|
save.classList.toggle('primary',verdict&&!hasPinnedPart);
|
|
1916
1955
|
requestChanges.classList.toggle('primary',hasPinnedPart);
|
|
@@ -1940,7 +1979,7 @@ function renderAnswerControls():void {
|
|
|
1940
1979
|
}
|
|
1941
1980
|
requestChanges.onclick=async()=>{if(requestChanges.disabled)return;if(parts){if(typeof partsSubject!=='undefined'&&partsSubject?.hasPendingComment?.()&&!await partsSubject.commitDraft())return;if(liveIssueCount()===0)return;void save.onclick?.call(save,new PointerEvent('click'));}else{if(typeof comments!=='undefined'&&comments?.hasPendingComment?.()&&!await comments.commitDraft())return;session.status='changes-requested';select('review-status').value=session.status;void verdictSubmit?.(new MouseEvent('click'));}};
|
|
1942
1981
|
}
|
|
1943
|
-
for(const root of [
|
|
1982
|
+
for(const root of [recordPanel,...questionForms])for(const control of root.querySelectorAll<HTMLButtonElement>('button[type="submit"]'))control.disabled=blocked||verdict;
|
|
1944
1983
|
// The waiting row is already visible: finish labels, state and handlers before revealing any answer.
|
|
1945
1984
|
save.hidden=!verdict||firstPublicationPrompt;requestChanges.hidden=save.hidden;rigAsk.hidden=!dialog||firstPublicationPrompt||!questionPending&&recordTrigger!==rigAsk;
|
|
1946
1985
|
recordAsk.hidden=!dialog||firstPublicationPrompt||recordTrigger!==recordAsk||!recordKind;
|
|
@@ -1949,16 +1988,17 @@ function renderAnswerControls():void {
|
|
|
1949
1988
|
if(needsPinnedPart&&!save.hidden&&!save.disabled){
|
|
1950
1989
|
if(!notice.classList.contains('error')){
|
|
1951
1990
|
setSourceText(notice,pinRefusal);
|
|
1991
|
+
setSourceAttribute(notice,'title',pinRefusal);
|
|
1952
1992
|
notice.classList.add('error');
|
|
1953
1993
|
notice.dataset.partsPinRefusal='true';
|
|
1954
1994
|
}
|
|
1955
1995
|
}else if(notice.dataset.partsPinRefusal){
|
|
1956
1996
|
delete notice.dataset.partsPinRefusal;
|
|
1957
|
-
setSourceText(notice,'');
|
|
1997
|
+
setSourceText(notice,'');setSourceAttribute(notice,'title','');
|
|
1958
1998
|
notice.classList.remove('error');
|
|
1959
1999
|
}
|
|
1960
2000
|
}
|
|
1961
|
-
|
|
2001
|
+
rigInspector.answersRendered=true;syncJobActRow(subjects);
|
|
1962
2002
|
}
|
|
1963
2003
|
let verdictSubmit:((event:MouseEvent)=>unknown)|null=null;
|
|
1964
2004
|
/** The rig pane for a live job's still (#709): the job binds and copies it, this screen keeps its view. */
|
|
@@ -2039,7 +2079,9 @@ function bindInspector(partsSubject=false):void {
|
|
|
2039
2079
|
for(const mode of document.querySelectorAll<HTMLButtonElement>('[data-mode]'))if(mode.dataset.mode==='rig'||mode.dataset.mode==='playback')mode.onclick=()=>showInspector(mode.dataset.mode!);
|
|
2040
2080
|
}
|
|
2041
2081
|
/** Pause at the held time and reveal the existing act without changing Setup/Animate mode. */
|
|
2042
|
-
function openReview():void {pause();if(!partsOnly)syncCorrectionStage();
|
|
2082
|
+
function openReview():void {pause();if(!partsOnly)syncCorrectionStage();workspace?.revealCommunication();}
|
|
2083
|
+
/** Something to communicate: a pending question or record form, or at least one comment. */
|
|
2084
|
+
function communicationPending():boolean {return !!communicationPanel.querySelector('form[data-job-ask]')||!!communicationPanel.querySelector('.stage-comment-item');}
|
|
2043
2085
|
function unitScaleMessage(target:CameraTarget):void {message(partsOnly?'1:1':target==='rig'?'1:1 · one CSS pixel per model coordinate unit.':'1:1 · one CSS pixel per reference grid unit.');}
|
|
2044
2086
|
function bindReviewDialog():void {select('correction-stage').onchange=syncCorrectionStage;button('native-one').title=tr('One CSS pixel per current pane coordinate unit; synchronized panes retain relative zoom.');}
|
|
2045
2087
|
|
|
@@ -2137,7 +2179,7 @@ async function decodedControlTime(media:HTMLVideoElement,target:number,signal:Ab
|
|
|
2137
2179
|
});
|
|
2138
2180
|
}
|
|
2139
2181
|
function numericView():ControlView {return viewport.numericView();}
|
|
2140
|
-
function inspectionBinding():InspectionBinding{return {mode:'single',sourceHash:data
|
|
2182
|
+
function inspectionBinding():InspectionBinding{return {mode:'single',sourceHash:data?.sourceHash??host!.record!.sourceHash,rigs:[data?.reviewedSource.rig?.sha256??null]};}
|
|
2141
2183
|
// Persist the displayed inspection clock; the runtime clock accumulates across idle loops for physics.
|
|
2142
2184
|
function inspectionBookmark():InspectionBookmark {if(rigDifference)return structuredClone(rigDifference.bookmark);return {schema:'rig-review-inspection/1',binding:inspectionBinding(),animation:animation||null,time,theme:appearance?.get()??'system',layers:{images:layers.images,meshes:layers.mesh,bones:layers.bones},view:numericView(),selection:{...(turnPad?{turn:turnPad.snapshot()}:{}),part:parts?.value()??null,view,checkpoint:checkpoint?.id??null,reference:select('reference-select').value||null,person:selectedPerson||null,inspector:document.querySelector<HTMLElement>('[data-mode][aria-pressed="true"]')?.dataset.mode??selectedInspector()??'rig',partSet:select('part-set').disabled?null:select('part-set').value,axis:axisInspection?{id:select('axis-select').value,value:Number(input('axis-value').value)}:null}};}
|
|
2143
2185
|
async function restoreInspection(bookmark:InspectionBookmark,signal:AbortSignal,preserveSeconds=false,keepCamera=true):Promise<void> {
|
|
@@ -2312,7 +2354,8 @@ function stepEnvironment(dt:number):void {
|
|
|
2312
2354
|
if(environmentApplied())player.environment(environmentFor(wind.read(),gravityValue()));
|
|
2313
2355
|
renderEnvironment();
|
|
2314
2356
|
}
|
|
2315
|
-
|
|
2357
|
+
/** A standing world already in force is not set again: `environment` clears the player's seek replay cache (#935: a paused seek applies it). */
|
|
2358
|
+
function applyEnvironment():void {if(player&&environmentApplied()){const next=environmentFor(wind.read(),gravityValue()),now=player.environment();if(String(next.wind)!==String(now.wind)||String(next.gravity)!==String(now.gravity))player.environment(next);}renderEnvironment();}
|
|
2316
2359
|
function renderEnvironment():void {
|
|
2317
2360
|
if(!player)return;
|
|
2318
2361
|
const reading=wind.read();
|
|
@@ -2336,10 +2379,10 @@ function worldFor(name:string):WorldExport|{error:string} {
|
|
|
2336
2379
|
if(worldCache?.key!==key)worldCache={key,value:worldExport(wind.snapshot(),gravityValue(),environmentApplied(),name,clipDuration(name))};
|
|
2337
2380
|
return worldCache.value;
|
|
2338
2381
|
}
|
|
2339
|
-
/** A fresh wind clock at the same settings (a repeating gust restarts at 0)
|
|
2340
|
-
function restartWindClock():void {const now=wind.read().time;wind.restore(wind.snapshot());joltQueue=joltQueue.map(step=>({...step,at:Math.max(0,step.at-now)}));}
|
|
2341
|
-
/** #183: every clip restart
|
|
2342
|
-
function clipMoved(move:ClipMove):void {
|
|
2382
|
+
/** A fresh wind clock at the same settings (a repeating gust restarts at 0), advanced to `at`; pending jolts keep their distance in time. */
|
|
2383
|
+
function restartWindClock(at=0):void {const now=wind.read().time;wind.restore(wind.snapshot());if(at>0)wind.advance(at);joltQueue=joltQueue.map(step=>({...step,at:Math.max(0,step.at-now)+at}));}
|
|
2384
|
+
/** #183: every clip restart restarts the wind clock while the schedule is watched. #935: a paused seek sets it to the seek's time. */
|
|
2385
|
+
function clipMoved(move:ClipMove):void {const at=player?windClockOnMove(move,useWorld(),playing):null;if(at!==null){restartWindClock(at);applyEnvironment();}}
|
|
2343
2386
|
let scheduleShown='';
|
|
2344
2387
|
function renderSchedule():void {
|
|
2345
2388
|
const world=worldFor(animation),check=checkAnimation(),checked=check!==animation?worldFor(check):null;
|
|
@@ -2417,13 +2460,13 @@ function restoreEnvironment():void {
|
|
|
2417
2460
|
if(player){if(environmentApplied())applyEnvironment();else player.environment(null);}
|
|
2418
2461
|
}
|
|
2419
2462
|
function feedbackEnvironment(){return player?environmentJson(environmentContext(wind.read(),gravityValue(),environmentApplied(),player.environment())):null;}
|
|
2420
|
-
function enableEnvironment(modelUrl:string):void {
|
|
2463
|
+
function enableEnvironment(modelUrl:string,fetcher:typeof fetch):void {
|
|
2421
2464
|
for(const id of environmentInputs)el<HTMLInputElement|HTMLButtonElement>(id).disabled=false;
|
|
2422
2465
|
syncEnvironmentInputs();text('physics-panel-state','Reading the compiled model…');text('idle-tracks-state','Reading the compiled model…');
|
|
2423
2466
|
readingsPanel?.catalog(data.feedbackCatalog.slots??[],data.feedbackCatalog.bones??[]);readingsPanel?.status('Pick readings, then Run: each runs on the inspected build and on the latest scratch build.',false);
|
|
2424
2467
|
const rig=data.reviewedSource.rig;
|
|
2425
2468
|
if(!rig){inspectedDocumentReason='PHYSICS_TUNING_UNAVAILABLE: no reviewed rig identity';refreshPhysics();return;}
|
|
2426
|
-
void loadModelDocument(modelUrl,rig.sha256).then(loaded=>{if(loaded.ok)inspectedDocument=loaded.document;else inspectedDocumentReason=`PHYSICS_TUNING_UNAVAILABLE: ${loaded.reason}`;refreshPhysics();},error=>{inspectedDocumentReason=`PHYSICS_TUNING_UNAVAILABLE: ${errorText(error)}`;refreshPhysics();});
|
|
2469
|
+
void loadModelDocument(modelUrl,rig.sha256,fetcher).then(loaded=>{if(loaded.ok)inspectedDocument=loaded.document;else inspectedDocumentReason=`PHYSICS_TUNING_UNAVAILABLE: ${loaded.reason}`;refreshPhysics();},error=>{inspectedDocumentReason=`PHYSICS_TUNING_UNAVAILABLE: ${errorText(error)}`;refreshPhysics();});
|
|
2427
2470
|
}
|
|
2428
2471
|
/** The panel's rows: the inspected model's constraints against the handoff config's (both must be read). */
|
|
2429
2472
|
function refreshPhysics():void {
|
|
@@ -3252,7 +3295,8 @@ async function swapRig(modelUrl:string,prefix:string,sha256:string,world:StageWo
|
|
|
3252
3295
|
const keepRigCamera=structuredClone(viewport.paneCamera('rig')),keepReferenceCamera=structuredClone(viewport.paneCamera('reference'));
|
|
3253
3296
|
const keepAnimation=animation,keepTime=time,wasPlaying=playing,keepSet=select('part-set').disabled?'':select('part-set').value;
|
|
3254
3297
|
inspectionSourceState='pending';partModel=null;pause();refreshAnimationInspection();
|
|
3255
|
-
const
|
|
3298
|
+
const inputs=stageLoadInputs(modelUrl,sha256);
|
|
3299
|
+
const next=await loadModel({modelUrl,...inputs,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;});
|
|
3256
3300
|
const keepFraming=!!keepStage&&!!next.stage&&(['x','y','width','height'] as const).every(key=>keepStage[key]===next.stage![key]);
|
|
3257
3301
|
viewport.state.cameraRestoring=true;viewport.cancelFit();
|
|
3258
3302
|
// The fit-relative zoom also depends on the first-draw framing basis, not just the declared stage.
|
|
@@ -3261,7 +3305,7 @@ async function swapRig(modelUrl:string,prefix:string,sha256:string,world:StageWo
|
|
|
3261
3305
|
pause();player?.dispose();assets?.dispose();assets=next;player=createInspectionPlayer(el('rig-root'),assets);setupChestWorld=readSetupChest(player);stageModelHash=sha256;stageSource={url:modelUrl,prefix,hash:sha256};
|
|
3262
3306
|
// A scratch build may hold another set of animations (a retarget adds one, #114): the picker lists what this build has.
|
|
3263
3307
|
{const animations=select('animation-select');animations.replaceChildren(...assets.animations.map(item=>option(item.name,data.manifest.animations.find(a=>a.id===item.name)?.label??item.name)));animations.disabled=assets.animations.length===0;}
|
|
3264
|
-
try{const catalog=await loadPartModel(modelUrl,sha256,data.feedbackCatalog.slots??[]);inspectionSourceState='ready';partModel=catalog.model;configureTurnPad(catalog.model);refreshAnimationInspection();weightsView?.refresh();meshEditor?.selectionChanged();parts?.register('single',catalog.entries,player,new PartThumbnails(pageRegionTable(catalog.model),assets.pageImages));}catch(error){inspectionSourceState='failed';partModel=null;refreshAnimationInspection();parts?.refuseCatalog('single',error);}
|
|
3308
|
+
try{const catalog=await loadPartModel(modelUrl,sha256,data.feedbackCatalog.slots??[],inputs.fetch);inspectionSourceState='ready';partModel=catalog.model;configureTurnPad(catalog.model);refreshAnimationInspection();weightsView?.refresh();meshEditor?.selectionChanged();parts?.register('single',catalog.entries,player,new PartThumbnails(pageRegionTable(catalog.model),assets.pageImages));}catch(error){inspectionSourceState='failed';partModel=null;refreshAnimationInspection();parts?.refuseCatalog('single',error);}
|
|
3265
3309
|
configurePartSets(keepSet);
|
|
3266
3310
|
// The same world before the first pose: a physics Apply resumes the wind (clock and pulse), the pending jolts, gravity and
|
|
3267
3311
|
// whether the controls are engaged as they stood when Apply was pressed; then the seek re-poses under that world.
|
|
@@ -3279,7 +3323,7 @@ async function swapRig(modelUrl:string,prefix:string,sha256:string,world:StageWo
|
|
|
3279
3323
|
if(keepFraming){viewport.writeCamera('rig',keepRigCamera);viewport.writeCamera('reference',keepReferenceCamera);fitCamera();}
|
|
3280
3324
|
else{viewport.state.cameraRestoring=cameraRestoring;viewport.requestFit();fitCamera();}
|
|
3281
3325
|
// The preview (#104) drives the new player once its bone setups are read (an idle Apply cleared it first).
|
|
3282
|
-
stageDocumentSet=true;void loadModelDocument(modelUrl,sha256).then(loaded=>{if(loaded.ok&&stageModelHash===sha256)idlePanel?.model(boneSetup(loaded.document));});
|
|
3326
|
+
stageDocumentSet=true;void loadModelDocument(modelUrl,sha256,inputs.fetch).then(loaded=>{if(loaded.ok&&stageModelHash===sha256)idlePanel?.model(boneSetup(loaded.document));});
|
|
3283
3327
|
if(wasPlaying)void playPreview();
|
|
3284
3328
|
}finally{viewport.state.cameraRestoring=cameraRestoring;stageCorrectionRebinding--;directionPanel?.refresh();}
|
|
3285
3329
|
}
|
|
@@ -3439,21 +3483,36 @@ function commentCaptureRefusal():string|null {
|
|
|
3439
3483
|
(()=>{const handles=document.getElementById('idle-handles');return handles&&!handles.hidden&&handles.childElementCount>0;})()?'Idle tracks stage handles':null;
|
|
3440
3484
|
return preview?`COMMENT_UNAPPLIED_PREVIEW: ${preview} is active; leave or disable that preview before commenting (nothing is cleared or applied automatically)`:null;
|
|
3441
3485
|
}
|
|
3486
|
+
/** #1048: the shown plan picture or sealed question image takes reference-view pins. The camera is the shared reference viewport's image space,
|
|
3487
|
+
* so `world` is the picture's natural pixels; the identity is the sealed `files` entry. */
|
|
3488
|
+
function planPicturePose(view:StageComment['viewport']):CommentPose|null {
|
|
3489
|
+
const picture=shownPlanPicture(),pane=el('reference-viewport'),camera=numericView().cameras.reference,media=el('reference-content').querySelector('img');
|
|
3490
|
+
if(!picture||view!=='reference'||!camera||!media||pane.clientWidth<=0||pane.clientHeight<=0)return null;
|
|
3491
|
+
return {mode:'setup',capture:{pane,images:true,backend:'canvas2d'},camera,frame:null,timeBasis:timeOnlyBasis,time:0,animation:null,turn:null,
|
|
3492
|
+
sourceHash:host!.record!.sourceHash,modelHash:null,referenceHash:picture.sha256,referenceId:picture.path,rig:picture.name,media};
|
|
3493
|
+
}
|
|
3494
|
+
function planPictureBookmark():InspectionBookmark {
|
|
3495
|
+
const bookmark=inspectionBookmark();
|
|
3496
|
+
return {...bookmark,time:0,selection:{...bookmark.selection,view:'reference',reference:shownPlanPicture()!.path,inspector:'rig'}};
|
|
3497
|
+
}
|
|
3442
3498
|
function setupComments():void {
|
|
3443
3499
|
if(host?.direction||host?.record){restoreRecordComments();liveIssueCount=()=>recordComments.length;if(host?.direction)dirty=dirty||recordComments.length>0;}
|
|
3444
3500
|
if(host?.verdictComments){restoreRecordComments();if(host.verdictComments.rows.length)markDirty();}
|
|
3445
3501
|
comments=bindStageComments<CommentRow,CommentPose>({general:host?.record||host?.direction||host?.verdictComments?{
|
|
3446
3502
|
create:summary=>({id:crypto.randomUUID(),summary}),matches:row=>!('target' in row),
|
|
3447
3503
|
...(host.verdictComments?{rows:host.verdictComments.rows,available:host.verdictComments.available,refusal:()=>readOnly}:{}),
|
|
3448
|
-
}: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')},
|
|
3504
|
+
}:undefined,listHost:el('comments-list-host'),openList:openReview,hasPicture:()=>!hasTransientQuestionImage(screenRoot)||!!shownPlanPicture(),toolbar:el('stage-comment').parentElement!,viewports:host?.record&&!host.record.hasPicture?(recordPictures()?{reference:el('reference-viewport')}:{}):{rig:el('rig-viewport'),reference:el('reference-viewport')},
|
|
3449
3505
|
pose:view=>{
|
|
3506
|
+
if(host?.record&&!host.record.hasPicture)return planPicturePose(view);
|
|
3450
3507
|
if(hasTransientQuestionImage(screenRoot))return null;
|
|
3451
3508
|
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;
|
|
3452
3509
|
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;
|
|
3453
3510
|
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;
|
|
3454
3511
|
},
|
|
3455
|
-
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,
|
|
3512
|
+
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:()=>shownPlanPicture()?planPictureBookmark():inspectionBookmark(),restore:(b,timed)=>host?.record&&!host.record.hasPicture?Promise.resolve():restoreInspection(parseBookmark(b,inspectionBinding()),new AbortController().signal,!!timed),feedback:()=>host?.record||host?.direction?recordComments:session.feedback,
|
|
3456
3513
|
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(/^The source changed, so /.test(draftStatus??''))draftStatus=null;if(host?.record||host?.direction){recordCommentsChanged();if(host?.direction){markDirty();comments?.refresh();}return;}if(host?.verdictComments)persistRecordComments();markDirty();renderProposals();return persistence?.save();},draftChanged:()=>{if(typeof renderAnswerControls==='function')renderAnswerControls();},error:value=>message(value,true),
|
|
3514
|
+
picture:mark=>{const record=host?.record&&!host.record.hasPicture?host.record:undefined,pictures=record?[...record.planPicture?[record.planPicture]:[],...record.questionPictures??[]]:[];
|
|
3515
|
+
return mark.viewport==='reference'&&pictures.find(picture=>mark.referenceId===picture.path&&mark.referenceHash===picture.sha256)?.name||null;},
|
|
3457
3516
|
refusal:()=>host?.record&&!host.record.hasPicture?null:commentCaptureRefusal(),blocked:()=>saving||!!persistence?.restoring()||seekingControl||!!video?.seeking||!!rebuildBusy||!!appliedOnStage,shortcutBlocked:()=>!!meshEditor?.active()
|
|
3458
3517
|
});
|
|
3459
3518
|
if(host?.verdictComments)renderProposals();
|
|
@@ -3534,8 +3593,9 @@ async function prepareStageDraftBuild(
|
|
|
3534
3593
|
if(!nextModelHash)throw new Error(buildId==='inspected'?'STAGE_DRAFT_MISMATCH':'STAGE_DRAFT_STALE');
|
|
3535
3594
|
target=options?.target??await resolveStageDraftTarget(buildId);
|
|
3536
3595
|
if(target.buildId!==buildId||target.sha256!==nextModelHash||!target.url||!target.prefix)throw new Error('STAGE_DRAFT_MISMATCH');
|
|
3537
|
-
|
|
3538
|
-
|
|
3596
|
+
const inputs=stageLoadInputs(target.url,target.sha256);
|
|
3597
|
+
nextAssets=await loadModel({modelUrl:target.url,...inputs,resolvePage:(name,url)=>{const pageUrl=new URL(name,url);if(pageUrl.origin!==location.origin||!pageUrl.pathname.startsWith(target.prefix))throw new Error(`Model page escapes its build: ${name}`);return pageUrl.href;}});
|
|
3598
|
+
const loadedDoc=await loadModelDocument(target.url,target.sha256,inputs.fetch);
|
|
3539
3599
|
if(!loadedDoc.ok)throw new Error('PART_SOURCE_CHANGED: model bytes differ from reviewed SHA-256');
|
|
3540
3600
|
verifiedDoc=loadedDoc.document;
|
|
3541
3601
|
const rawSlots=verifiedDoc&&typeof verifiedDoc==='object'&&!Array.isArray(verifiedDoc)?(verifiedDoc as {slots?:unknown}).slots:null;
|