@rig-c/review 2.11.0 → 2.13.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 +145 -74
- package/docs/PANELS.md +20 -12
- package/docs/PARTS_VIEW.md +31 -11
- package/docs/REVIEW_PACKAGE.md +215 -0
- package/docs/STABILITY.md +98 -2
- package/docs/WORKFLOWS.md +40 -12
- package/package.json +2 -1
- package/skills/rig-review/SKILL.md +29 -1
- package/src/build.ts +10 -2
- package/src/cli.ts +14 -12
- package/src/comment-crops.ts +6 -1
- package/src/compare-html.ts +22 -24
- package/src/compare-server.ts +1 -1
- package/src/compare-session.ts +41 -3
- package/src/create-pin-gate.ts +3 -0
- package/src/feedback-export.ts +67 -0
- package/src/front.ts +10 -16
- package/src/interview-routes.ts +1 -1
- package/src/job-act.ts +39 -21
- package/src/job-api.ts +291 -0
- package/src/job-cli.ts +20 -11
- package/src/job-contract.ts +91 -3
- package/src/job-front.ts +15 -7
- package/src/job-host.ts +15 -0
- package/src/job-hub.ts +4 -4
- package/src/job-image-set.ts +32 -9
- package/src/job-session.ts +19 -11
- package/src/job-source.ts +74 -30
- package/src/joined-project.ts +61 -4
- package/src/open-workspace.ts +12 -12
- package/src/open.ts +17 -9
- package/src/parts-comment.ts +31 -1
- package/src/parts-server.ts +19 -7
- package/src/parts-view.ts +103 -20
- package/src/server.ts +30 -21
- package/src/session.ts +58 -0
- package/src/stage-comment.ts +39 -0
- package/src/stage-parts.ts +18 -10
- package/web/animation-inspection.ts +1 -1
- package/web/bones-panel.ts +1 -3
- package/web/catalog-en.ts +76 -12
- package/web/catalog-ko.ts +76 -12
- package/web/cloth-panel.ts +1 -2
- package/web/compare.css +3 -9
- package/web/compare.html +3 -3
- package/web/compare.ts +69 -64
- package/web/cuts-panel.ts +1 -3
- package/web/density-strip-panel.ts +1 -2
- package/web/i18n.ts +13 -1
- package/web/idle-panel.ts +1 -2
- package/web/index.html +1 -5
- package/web/inspection-persistence.ts +2 -1
- package/web/inspector-blocks.ts +144 -39
- package/web/instance-access.ts +24 -5
- package/web/interview-panel.ts +224 -175
- package/web/job-hub.ts +50 -69
- package/web/job-rig-capture.ts +103 -10
- package/web/job-rig-screen.ts +317 -0
- package/web/job-session.ts +927 -1365
- package/web/main.ts +535 -129
- package/web/mesh-panel.ts +1 -2
- package/web/owner-workspace.ts +88 -109
- package/web/part-selection.ts +47 -6
- package/web/part-thumbnails.ts +20 -6
- package/web/parts-viewport-provider.ts +166 -9
- package/web/physics-panel.ts +1 -2
- package/web/readings-panel.ts +1 -2
- package/web/requirements-panel.ts +1 -3
- package/web/retained-frame-stage.ts +105 -0
- package/web/retarget-panel.ts +2 -3
- package/web/rig-fields-panel.ts +1 -2
- package/web/rig-host.ts +62 -0
- package/web/rig-viewport-provider.ts +63 -16
- package/web/stage-comments.ts +29 -26
- package/web/styles.css +127 -43
- package/web/view-controls.ts +201 -12
- package/web/viewport-controller.ts +97 -26
- package/web/viewport-pair.ts +2 -1
- package/web/workspace-preferences.ts +5 -4
- package/web/workspace-ui.ts +152 -19
- package/src/interview-server.ts +0 -54
- package/web/interview.css +0 -28
- package/web/interview.html +0 -17
- package/web/interview.ts +0 -40
- package/web/job-hub.css +0 -14
- package/web/job-hub.html +0 -5
- package/web/owner-workspace.css +0 -14
- package/web/owner-workspace.html +0 -5
- package/web/parts-flags.ts +0 -48
- package/web/parts-page.ts +0 -217
- package/web/parts.css +0 -116
- package/web/parts.html +0 -15
- package/web/parts.ts +0 -986
- package/web/stage-nav.ts +0 -136
package/web/main.ts
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
|
+
import type {InterviewSubjectEntry} from '../src/joined-project.ts';
|
|
2
|
+
import {joinedInterviewForms} from './job-session.ts';
|
|
3
|
+
import {partsIssueComments,parsePartsIssue,assertPartsIssueBinding} from '../src/parts-comment.ts';
|
|
4
|
+
import type {JobForm} from './job-session.ts';
|
|
5
|
+
import {bindWorkspaceDrawer} from './workspace-layout.ts';
|
|
6
|
+
import {captureRigRestStill,rigRestCanvas} from './job-rig-capture.ts';
|
|
7
|
+
import {createPartsViewportProvider,bindPartsSubject,paintRigDifference,type PartsSubjectEntry,type PartsSubjectSession} from './parts-viewport-provider.ts';
|
|
8
|
+
import {rigWorkspaceMarkup,rigFeedbackMarkup,sharedViewToolsMarkup,sharedCommentMarkup} from '../src/compare-html.ts';
|
|
1
9
|
import {bindDirectionPanel} from './direction-panel.ts';
|
|
2
10
|
import {bindWorkspaceVisibility} from './workspace-visibility.ts';
|
|
3
11
|
import type {DirectionInspection} from '../src/direction-inspection.ts';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {bindStageComments,type CommentPose} from './stage-comments.ts';
|
|
12
|
+
import {parseStageComment,feedbackItemComments,projectComments,timeOnlyBasis,feedbackTimingLabel,requireFeedbackFrames,isTimeOnlyFeedback} from '../src/stage-comment.ts';
|
|
13
|
+
import {bindStageComments,type CommentRow,type CommentPose} from './stage-comments.ts';
|
|
7
14
|
import {discoverTurnDials,TurnState} from '../src/turn-pad.ts';
|
|
8
15
|
import {bindTurnPad,type TurnPad} from './turn-pad.ts';
|
|
9
16
|
import {PartExplorer,loadPartModel,partBounds,partCatalog,type PartEntry} from './part-selection.ts';
|
|
@@ -14,7 +21,7 @@ import {createViewportController,createViewportState,type CameraTarget} from './
|
|
|
14
21
|
import {createRigViewportProvider,rigPanCarry} from './rig-viewport-provider.ts';
|
|
15
22
|
import {mountViewportPair} from './viewport-pair.ts';
|
|
16
23
|
import {rendererStatus} from './renderer-status.ts';
|
|
17
|
-
import {bindAppearance,syncStageLayout,bindInspectorTabs,idleAvailable,initialIdleAnimation,automaticIdlePreview,bindLayerShortcuts,describeLayerToggles,type ViewPoint} from './view-controls.ts';
|
|
24
|
+
import {panelMake,createRigLayerControls,createViewControls,inspectionViewSwitch,actionButton,bindAppearance,syncStageLayout,bindInspectorTabs,idleAvailable,initialIdleAnimation,automaticIdlePreview,idlePreviewOnOpen,bookmarkCameraKept,bindLayerShortcuts,describeLayerToggles,type ViewPoint} from './view-controls.ts';
|
|
18
25
|
import {RigOverlays,type OverlayCircle,type OverlayMarker,type OverlayRegion,type OverlaySnapshot} from './rig-overlays.ts';
|
|
19
26
|
import {bindMeshPanel,type MeshPanel} from './mesh-panel.ts';
|
|
20
27
|
import {bindDensityStrip,type DensityStripPanel,type DensityStripViewLike} from './density-strip-panel.ts';
|
|
@@ -35,13 +42,14 @@ import type {RetargetFlags} from '../src/retarget.ts';
|
|
|
35
42
|
import {appliedCheckState,renderAppliedHistory,isPatchJob,recordFor,refusedText,restoredOutcomeForJob,retargetStage,undoControl,type AppliedHistoryView,type UndoView,type AnyJobView,appliedRecord,deltaAppliedRecord,deltaOutcomeLine,MESH_DELTA_APPLIED_SOURCE,chestPartFields,chestStatusForPart,chestSeed,designatedRegions,handoffText,landmarksRequest,noContourReason,seedLandmarks,makePatch,outcomeLine,patchAppliedRecord,patchOutcomeLine,pickBustPart,pickPart,runRebuild,seedFields,stageModel,type AppliedDelta,type AppliedPatch,type AppliedRecord,type DeltaJobView,type DeltaRequestBody,type ConfigPatch,type PatchJobView,type RebuildJobView,type RebuildRefusal,type RebuildRequestBody,type RebuildStatusView} from './rebuild-client.ts';
|
|
36
43
|
import {meshEditBinding,meshEditText,type MeshEditDocument} from '../src/mesh-edit.ts';
|
|
37
44
|
import {chestRegionsBinding,cropWorldMapping,type CropWorldMapping} from '../src/chest-regions.ts';
|
|
38
|
-
import {bindWorkspaceUI,selectedInspector,type WorkspaceUI} from './workspace-ui.ts';
|
|
39
|
-
import {setSourceAttribute,setSourceText,sourceTextContent,t,tr} from './i18n.ts';
|
|
45
|
+
import {mountWorkspaceShell,mountStatusBar,bindWorkspaceUI,bindHeaderModeAvailability,selectedInspector,type WorkspaceUI} from './workspace-ui.ts';
|
|
46
|
+
import {setSourceAttribute,setSourceText,sourceTextContent,onLanguageChange,t,tr} from './i18n.ts';
|
|
40
47
|
import {holdScrubBox,releaseScrubBox,scrubBox} from './scrub-box.ts';
|
|
41
|
-
import {bindInspectorBlocks,activeBlocksUI,restoreActiveBlocksUI,type InspectorBlocks} from './inspector-blocks.ts';
|
|
48
|
+
import {mountRigInspector,bindInspectorBlocks,activeBlocksUI,restoreActiveBlocksUI,type InspectorBlocks} from './inspector-blocks.ts';
|
|
42
49
|
import {connectControl} from './control.ts';
|
|
43
50
|
import {connectLiveWindow} from './live-connection.ts';
|
|
44
51
|
import {pageInstanceAccess,readOnlyReason} from './instance-access.ts';
|
|
52
|
+
import {rigHost,type RigHostStage} from './rig-host.ts';
|
|
45
53
|
import {controlComparison,type ControlCommand,type ControlInspection,type ControlView} from '../src/control.ts';
|
|
46
54
|
import {singleEligibility,videoReferenceAt,type InputState,type SingleLayout} from '../src/comparison-eligibility.ts';
|
|
47
55
|
import {parseBookmark,connectInspectionPersistence,serializableView,restoredZoom,restoreTransaction,captureInputs,restoreInputs,type InspectionBookmark,type InspectionBinding,type PersistenceConnection} from './inspection-persistence.ts';
|
|
@@ -52,8 +60,8 @@ import type { Checkpoint, Json, Reference, ReviewedSource, ReviewManifest } from
|
|
|
52
60
|
import type { Feedback, ReviewSession } from '../src/session.ts';
|
|
53
61
|
import type { ReportEvent, ReportSeeds } from '../src/report.ts';
|
|
54
62
|
import { frameAtTime, lastFrame as lastProducerFrame, rigPaneLabel, timeAtFrame, transportClock, type StageClock } from '../src/frame-clock.ts';
|
|
55
|
-
import { feedbackLastFrame, feedbackTargetNames, validateFeedbackSelection, type FeedbackCatalog } from '../src/feedback-validation.ts';
|
|
56
|
-
import { eventCoordinates, eventSeekTime, eventSelection, eventTimingLabel, reportCounts,
|
|
63
|
+
import { feedbackLastFrame, feedbackTargetNames, validateFeedbackSelection, validateTimedFeedbackSelection, type FeedbackCatalog } from '../src/feedback-validation.ts';
|
|
64
|
+
import { eventCoordinates, eventSeekTime, eventSelection, eventTimingLabel, reportCounts, targetLabel } from './report-view.ts';
|
|
57
65
|
import type { StripInterval, StripRequest } from '../src/strip.ts';
|
|
58
66
|
import {createWindModel,environmentFor,windReadout,RUNTIME_START_READOUT,joltPacket,dueJolts,dragImpulse,loadModelDocument,environmentContext,environmentJson,type JoltStep,type WindSnapshot,type WindState} from '../src/environment.ts';
|
|
59
67
|
import {tuningRows,readoutRows,type InspectedCheckView} from '../src/physics-tuning.ts';
|
|
@@ -74,12 +82,19 @@ import {assertRigFieldOps,RIG_FIELDS_READOUT_BARS,TURN_BONE} from '../src/rig-fi
|
|
|
74
82
|
import {IDLE_READOUT_BARS,type LocalChannel} from '../src/idle-tracks.ts';
|
|
75
83
|
import type {PatchOp} from '../src/config-patch.ts';
|
|
76
84
|
|
|
85
|
+
/** Mount the existing composition again for a live publication; each instance owns its source-bound state. */
|
|
86
|
+
export function mountRigScreen():{dispose():void} {
|
|
87
|
+
const screenRoot=document.getElementById('app')!;
|
|
88
|
+
const lifecycle=new AbortController();
|
|
89
|
+
let suspended=false,disposed=false,frameHandle=0,navigationMissing=false;
|
|
90
|
+
let publicEditor:unknown;
|
|
91
|
+
let workspace:WorkspaceUI|null=null;
|
|
77
92
|
interface ReviewResponse { direction?:DirectionInspection; setsHash?:string; referenceHashes?:Record<string,string>; initialAnimation?:string|null; manifest: ReviewManifest; referenceBinding?:ReferenceBinding; explicitReference?:{id:string;name:string;sha256:string;url:string}; sourcePainting?:{id:string;path:string;sha256:string;url:string}; sourceHash: string; reviewedSource: ReviewedSource; report: ReportSeeds | null; feedbackCatalog: FeedbackCatalog; assetsBase: string; capabilities: { interview?:true; preRig?:true; playback: boolean; modeling: false; motion: false; feedback: boolean; audio: boolean } }
|
|
78
93
|
interface PoseReference { schema: 'rig-review-pose/1'; coordinateSystem: 'image-pixels-y-down'; width: number; height: number; joints: { id: string; x: number; y: number; parent?: string }[] }
|
|
79
94
|
interface SequenceJoint { state: 'observed' | 'occluded' | 'missing' | 'inferred'; at?: [number, number]; score?: number }
|
|
80
95
|
interface PoseSequence { spec: 'rig-pose-sequence/1'; space: { units: 'picture-px'; origin: 'top-left'; y: 'down' }; width: number; height: number; source?: string; frames: { t: number; people: { id: string; joints: Record<string, SequenceJoint> }[] }[]; camera?: { s: number; tx: number; ty: number; inliers: number }[]; cameraSource?: unknown }
|
|
81
96
|
const el = <T extends HTMLElement = HTMLElement>(id: string): T => {
|
|
82
|
-
const node =
|
|
97
|
+
const node = id==='app'?screenRoot:screenRoot.querySelector<HTMLElement>('#'+id)??workspace?.element(id);
|
|
83
98
|
if (!node) throw new Error(`Missing UI element: ${id}`);
|
|
84
99
|
return node as T;
|
|
85
100
|
};
|
|
@@ -91,21 +106,64 @@ const titledIds = new Set(['message', 'player-state', 'layout-state', 'renderer-
|
|
|
91
106
|
const text = (id: string, value: string) => { const node = el(id); setSourceText(node, value); if (titledIds.has(id)) setSourceAttribute(node, 'title', value); };
|
|
92
107
|
const option = (value: string, label: string) => { const item = document.createElement('option'); item.value = value; item.textContent = label; return item; };
|
|
93
108
|
const errorText = (error: unknown) => error instanceof Error ? error.message : String(error);
|
|
109
|
+
// Capability is consumed before shell composition or any URL-dependent binding.
|
|
110
|
+
// A live job (#709) hosts this screen for a rig subject: its routes, its session and its submit.
|
|
111
|
+
const host=rigHost(),access=host?.access??pageInstanceAccess();
|
|
112
|
+
const partsOnly=host?.subject==='parts'||screenRoot.dataset.reviewScreen==='parts';
|
|
113
|
+
const app=el('app');app.innerHTML=rigWorkspaceMarkup+rigFeedbackMarkup;
|
|
114
|
+
const rigStatusBar=mountStatusBar({
|
|
115
|
+
message:'Loading local review package…',
|
|
116
|
+
readouts:[
|
|
117
|
+
panelMake('span',{id:'player-state',className:'subtle',textContent:'No rig supplied'}),
|
|
118
|
+
panelMake('span',{id:'layout-state',className:'subtle',textContent:'Loading inputs…'}),
|
|
119
|
+
panelMake('span',{id:'renderer-state',className:'subtle',title:'DOM images for rigid parts; WebGL meshes when available, Canvas2D fallback.',textContent:'Not rendered'}),
|
|
120
|
+
panelMake('span',{id:'layer-state',className:'hint',textContent:'No rig supplied'}),
|
|
121
|
+
panelMake('span',{id:'idle-state',className:'hint',textContent:'Idle preview unavailable'}),
|
|
122
|
+
panelMake('span',{id:'control-state',className:'hint'}),
|
|
123
|
+
panelMake('div',{className:'draft-notice'},panelMake('span',{id:'draft-state'}),panelMake('div',{id:'draft-recovery'})),
|
|
124
|
+
],
|
|
125
|
+
source:panelMake('div',{className:'status-source'},
|
|
126
|
+
panelMake('details',{className:'view-region'},panelMake('summary',{},'View region'),
|
|
127
|
+
panelMake('div',{className:'view-region-body'},
|
|
128
|
+
panelMake('span',{className:'hint',textContent:'Numeric source region · opening this link restores a paused inspection'}),
|
|
129
|
+
panelMake('pre',{id:'view-coordinates',className:'numeric-view'}),
|
|
130
|
+
panelMake('p',{className:'hint',textContent:'Sync cameras links fit-relative zoom and viewport-relative pan across visible panes. Turn it off to inspect each pane independently. Toolbar zoom and Fit use the last active pane. Hold Space while dragging a video to pan without taking over its native controls.'}))),
|
|
131
|
+
panelMake('span',{id:'source-hash',className:'subtle'})),
|
|
132
|
+
});
|
|
133
|
+
app.querySelector<HTMLElement>('[data-workspace-status]')!.replaceWith(rigStatusBar.footer);
|
|
134
|
+
for(const id of ['layout-state','idle-state','control-state','draft-state'])el(id).setAttribute('role','status');
|
|
135
|
+
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');
|
|
136
|
+
const shell=mountWorkspaceShell({compatibility:'rigStep1',embedded:new URLSearchParams(location.search).has('stageEmbed')&&!location.pathname.endsWith('/stage-interview.html')});app.prepend(shell.header);
|
|
137
|
+
el('app').querySelector<HTMLElement>('[data-workspace-comment]')!.innerHTML=sharedCommentMarkup;
|
|
138
|
+
el('app').querySelector<HTMLElement>('[data-workspace-layers]')!.append(createRigLayerControls());
|
|
139
|
+
el('app').querySelector<HTMLElement>('[data-workspace-view-tools]')!.innerHTML=sharedViewToolsMarkup;
|
|
140
|
+
const controls=createViewControls({layout:'rigStep1',viewSwitch:inspectionViewSwitch(chooseInspectionView,true)}),cameraControls=el('app').querySelector<HTMLElement>('[data-workspace-camera]')!;cameraControls.append(controls.syncLabel,controls.zoomGroup!);
|
|
141
|
+
const primaryToolbar=app.querySelector<HTMLElement>('.viewbar')!;primaryToolbar.classList.add('workspace-main-toolbar');
|
|
142
|
+
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);
|
|
143
|
+
for(const event of ['click','change'])secondaryToolbar.addEventListener(event,()=>{if(rigDifference){leaveRigDifference();renderLayout();}},true);
|
|
144
|
+
const rigInspector=mountRigInspector();
|
|
145
|
+
const rigAsk=panelMake('button',{className:'workspace-act-ask',id:'workspace-pending-ask',hidden:true});rigAsk.type='button';rigInspector.act.prepend(rigAsk);
|
|
94
146
|
mountViewportPair(el('stage-layout'));
|
|
95
147
|
const viewportState=createViewportState();
|
|
96
|
-
const
|
|
148
|
+
const partsCanvas=document.createElement('canvas'),partsReference=document.createElement('canvas');partsCanvas.width=partsCanvas.height=partsReference.width=partsReference.height=0;
|
|
149
|
+
let partsSubject:ReturnType<typeof bindPartsSubject>|null=null;
|
|
150
|
+
let rigDifference:{assets:ModelAssets;painting:HTMLImageElement;camera:ReturnType<typeof createViewportState>;hidden:Map<HTMLElement,boolean>;label:string;bookmark:InspectionBookmark}|null=null;
|
|
151
|
+
let rigDifferenceFailure:string|null=null;
|
|
152
|
+
const rigRaster={el,canvas:partsCanvas,message,reference:()=>null,frameSize:()=>({w:partsCanvas.width,h:partsCanvas.height}),active:()=>!!rigDifference};
|
|
153
|
+
if(partsOnly){partsCanvas.id='parts-canvas';el('rig-root').append(partsCanvas);el('reference-content').append(partsReference);}
|
|
154
|
+
const viewport=createViewportController(partsOnly?createPartsViewportProvider({el,canvas:partsCanvas,message,reference:()=>partsReference.width>0?partsReference:null,frameSize:target=>partsSubject?.frameSize(target)??null},viewportState):createRigViewportProvider({fitLabel:'Fit',el,player:()=>player,assets:()=>assets,referenceSize:()=>referenceSize,view:()=>view,referenceGeneration:()=>referenceGeneration,parts:()=>parts,text,message,redrawOverlay,raster:rigRaster},viewportState),viewportState);
|
|
97
155
|
const {fitCamera,paneFrame,availableCamera,alignCameras,renderCameraControls,setCameraSync,cameraAction,updateCamera,fitActiveCamera}=viewport;
|
|
98
156
|
// First, before any URL use: take the `#cap=` handoff into memory/session storage and strip it.
|
|
99
|
-
|
|
100
|
-
connectLiveWindow(access);
|
|
157
|
+
if(!host)connectLiveWindow(access);
|
|
101
158
|
let readOnly: string | null = null;
|
|
159
|
+
let actReadOnly: string | null = null;
|
|
102
160
|
let data: ReviewResponse;
|
|
103
161
|
let directionPanel:ReturnType<typeof bindDirectionPanel>|undefined;
|
|
104
162
|
let session: ReviewSession;
|
|
105
163
|
let dirty = false;
|
|
106
164
|
let saving = false;
|
|
107
165
|
let stripBusy = false;
|
|
108
|
-
let persistence:PersistenceConnection|null=null,submittedBaseline:ReviewSession|null=null,draftConflict=false;
|
|
166
|
+
let persistence:PersistenceConnection|null=null,submittedBaseline:ReviewSession|null=null,draftConflict=false,draftStatus:string|null=null;
|
|
109
167
|
let checkpoint: Checkpoint | undefined;
|
|
110
168
|
let assets: ModelAssets | null = null;
|
|
111
169
|
let player: RigPlayer | null = null;
|
|
@@ -120,6 +178,8 @@ let lastFrame = 0;
|
|
|
120
178
|
/** #346: wall-clock seconds accumulated toward the next fixed playback step. */
|
|
121
179
|
let playbackCarry = 0;
|
|
122
180
|
let comments:ReturnType<typeof bindStageComments>|null=null;
|
|
181
|
+
const recordComments:CommentRow[]=[];
|
|
182
|
+
let recordCommentKey='';
|
|
123
183
|
let view: 'compare' | 'reference' | 'rig' = 'compare';
|
|
124
184
|
// Requested layout persists in the source-bound draft; the effective one follows actual load events only.
|
|
125
185
|
let rigInput:InputState={state:'pending'},referenceInput:InputState={state:'absent'},effectiveView:SingleLayout|null=null;
|
|
@@ -145,7 +205,8 @@ function hasStageModel():boolean{return Boolean(data.manifest.model||(data?.capa
|
|
|
145
205
|
/** Apply · Rebuild (#99): the inspected model's URL, the producer status, and the applied record while its scratch build is on the stage. */
|
|
146
206
|
let inspectedModel:{url:string;prefix:string;sha256:string}|null=null,rebuildStatus:RebuildStatusView|null=null,appliedOnStage:AppliedRecord|AppliedPatch|AppliedDelta|AppliedRetarget|AppliedAnimation|null=null,rebuildBusy=false,stageModelHash:string|null=null;
|
|
147
207
|
let appearance:ReturnType<typeof bindAppearance>|null=null;
|
|
148
|
-
|
|
208
|
+
|
|
209
|
+
let inspectorTabs:ReturnType<typeof bindInspectorTabs>|null=null;
|
|
149
210
|
let inspectorBlocks:InspectorBlocks|null=null;
|
|
150
211
|
let idleHeld=false;
|
|
151
212
|
let suspendedPreview=false;
|
|
@@ -191,16 +252,19 @@ let readingsPanel:ReadingsPanel|null=null,readingsJob:ReadingsJobView|null=null,
|
|
|
191
252
|
/** The world an Apply's reload resumes: wind (clock and active pulse), pending jolts, whether the controls are engaged, gravity. */
|
|
192
253
|
interface StageWorld {wind:WindState;jolts:JoltStep[];applied:boolean;gravity:number}
|
|
193
254
|
|
|
194
|
-
function message(value: string, error = false): void {
|
|
255
|
+
function message(value: string, error = false, footerOnly = false): void {
|
|
195
256
|
text('message', value);
|
|
196
257
|
el('message').title = value; // the footer truncates long messages
|
|
197
258
|
el('message').classList.toggle('error', error);
|
|
259
|
+
// A view readout (a Difference count) is not the act's state, so it stays in the footer only.
|
|
260
|
+
if (footerOnly) return;
|
|
198
261
|
// The modal makes the footer inert; the review dialog repeats the latest message for its reader.
|
|
199
262
|
text('review-message', value); el('review-message').classList.toggle('error', error);
|
|
200
263
|
}
|
|
201
264
|
|
|
202
265
|
async function api<T>(path: string, init?: RequestInit): Promise<T> {
|
|
203
266
|
const method = (init?.method ?? 'GET').toUpperCase();
|
|
267
|
+
const hosted = host?.read(path, method); if (hosted) return await hosted as T;
|
|
204
268
|
const response = await fetch(access.route(path), method === 'GET' || method === 'HEAD' ? init : { ...init, headers: access.headers(init?.headers) });
|
|
205
269
|
if (!response.ok) throw new Error(`${response.status}: ${await response.text()}`);
|
|
206
270
|
return await response.json() as T;
|
|
@@ -222,7 +286,16 @@ function updateSavedState(): void {
|
|
|
222
286
|
text('dirty', dirty ? 'Unsubmitted changes' : session.updatedAt ? 'Submitted' : 'Not submitted');
|
|
223
287
|
el('dirty').classList.toggle('dirty', dirty);
|
|
224
288
|
button('save').disabled = saving || draftConflict || !!readOnly || session.feedbackWarnings.length > 0;
|
|
225
|
-
button('save').title =
|
|
289
|
+
button('save').title = actReadOnly ? actReadOnly : session.feedbackWarnings.length ? 'Delete feedback with validation warnings, then add it again with a valid target.' : '';
|
|
290
|
+
renderDraftState();
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/** C10: the act bar renders the latest local draft status; rig only classifies it. Nothing renders before the first status. */
|
|
294
|
+
let liveIssueCount=()=>session?.feedback.length??0;
|
|
295
|
+
function renderDraftState(): void {
|
|
296
|
+
const live=host?.reviewState?.(liveIssueCount(),saving);
|
|
297
|
+
if (draftStatus === null && !live) return;
|
|
298
|
+
rigInspector.actBar.setSaveState({ kind: actReadOnly ? 'read-only' : saving ? 'saving' : draftConflict ? 'failed' : dirty ? 'unsaved' : 'saved', text: actReadOnly??live??draftStatus! });
|
|
226
299
|
}
|
|
227
300
|
|
|
228
301
|
function renderProvenance(): void {
|
|
@@ -255,7 +328,7 @@ function renderCheckpoints(): void {
|
|
|
255
328
|
|
|
256
329
|
async function chooseCheckpoint(point: Checkpoint,initial?:{referenceId?:string;updateUrl:boolean}): Promise<void> {
|
|
257
330
|
pause(); checkpoint = point; axisInspection = false;
|
|
258
|
-
if(initial?.updateUrl!==false){const url = new URL(location.href); url.searchParams.set('checkpoint', point.id); window.history.replaceState(null, '', url);}
|
|
331
|
+
if(!host&&initial?.updateUrl!==false){const url = new URL(location.href); url.searchParams.set('checkpoint', point.id); window.history.replaceState(null, '', url);}
|
|
259
332
|
if (point.animation) chooseAnimation(point.animation);
|
|
260
333
|
time = point.time ?? 0;
|
|
261
334
|
const referenceId=initial?.referenceId??point.reference;
|
|
@@ -265,6 +338,8 @@ async function chooseCheckpoint(point: Checkpoint,initial?:{referenceId?:string;
|
|
|
265
338
|
viewport.state.zoom = Math.min(8, Math.max(.25, point.camera?.zoom ?? 1));
|
|
266
339
|
if(viewport.state.cameraSync)viewport.state.activeCamera=player?'rig':'reference';
|
|
267
340
|
viewport.state.cameraCenter = point.camera ? { x: point.camera.x, y: point.camera.y } : null;
|
|
341
|
+
// A checkpoint without its own camera opens at Fit, held until the panes are measured and until someone moves it.
|
|
342
|
+
if(point.camera)viewport.cancelFit();else viewport.requestFit();
|
|
268
343
|
seek(time);
|
|
269
344
|
if (point.axis && player && !input('axis-value').disabled) {
|
|
270
345
|
select('axis-select').value = point.axis.id; chooseAxis(); input('axis-value').value = String(point.axis.value); applyAxis();
|
|
@@ -277,18 +352,60 @@ function renderCheckpoint(): void {
|
|
|
277
352
|
text('detail-title', checkpoint?.title ?? 'No checkpoint supplied');
|
|
278
353
|
text('detail-note', checkpoint?.note ?? 'Record checkpoint notes and outcomes.');
|
|
279
354
|
const entry = checkpoint ? session.checkpoints[checkpoint.id] : undefined;
|
|
280
|
-
el
|
|
281
|
-
el<HTMLTextAreaElement>('checkpoint-note').disabled = !checkpoint;
|
|
355
|
+
el('checkpoint-note').textContent = entry?.note ?? '';
|
|
282
356
|
for (const radio of document.querySelectorAll<HTMLInputElement>('input[name="outcome"]')) { radio.checked = radio.value === (entry?.outcome ?? 'pending'); radio.disabled = !checkpoint; }
|
|
283
357
|
}
|
|
284
358
|
|
|
285
359
|
function setView(value: typeof view): void {view=value;renderLayout();}
|
|
360
|
+
function chooseInspectionView(id:string):void {
|
|
361
|
+
if(!partsSubject){
|
|
362
|
+
if(id==='difference'){
|
|
363
|
+
const reason=rigDifferenceReason();if(reason){message(reason,true);renderLayout();return;}
|
|
364
|
+
try{
|
|
365
|
+
const painting=el('reference-content').querySelector<HTMLImageElement>('img')!;
|
|
366
|
+
const still=captureRigRestStill(assets!,{width:painting.naturalWidth,height:painting.naturalHeight});
|
|
367
|
+
const result=paintRigDifference(partsCanvas,still,painting);
|
|
368
|
+
pause();
|
|
369
|
+
if(!rigDifference)rigDifference={assets:assets!,painting,camera:structuredClone(viewport.state),hidden:new Map(),label:sourceTextContent(el('rig-label')),bookmark:inspectionBookmark()};
|
|
370
|
+
partsCanvas.id='rig-difference-canvas';el('rig-root').append(partsCanvas);partsCanvas.hidden=false;
|
|
371
|
+
for(const node of [...el('rig-root').children,...el('rig-viewport').children])if(node instanceof HTMLElement&&node!==partsCanvas&&node!==el('rig-root')&&node!==el('rig-label')&&node!==el('rig-empty')){if(!rigDifference.hidden.has(node))rigDifference.hidden.set(node,node.hidden);node.hidden=true;}
|
|
372
|
+
viewport.cancelFit();viewport.state.cameraFrames={};viewport.state.cameraCenter=null;viewport.state.referenceCenter=null;viewport.state.activeCamera='rig';
|
|
373
|
+
text('rig-label','Difference');setView('rig');viewport.fitActiveCamera('rig');
|
|
374
|
+
message(t('Difference: {0} of {1} pixels differ, compared where the rig draws · rest still vs original painting.',[result.count,result.compared],'en'),false,true);
|
|
375
|
+
}catch(error){leaveRigDifference();rigDifferenceFailure=errorText(error);message(rigDifferenceFailure,true);renderLayout();}
|
|
376
|
+
}else{leaveRigDifference();setView(id as SingleLayout);}
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
const overlay=document.getElementById('parts-overlay') as HTMLInputElement;
|
|
380
|
+
if(id==='difference')overlay.checked=false;
|
|
381
|
+
partsSubject.setComparison(id==='difference'?'difference':overlay.checked?'overlay':'part');
|
|
382
|
+
setView(id==='difference'?'rig':id as SingleLayout);
|
|
383
|
+
}
|
|
384
|
+
/** Availability follows the actual loaded image and declared native rig canvas, never a resized reference. */
|
|
385
|
+
function rigDifferenceReason():string|null {
|
|
386
|
+
if(selectedInspector()!=='rig')return 'RIG_DIFFERENCE_SETUP_ONLY: Difference is available in Setup.';
|
|
387
|
+
if(!assets||!player||rigInput.state!=='loaded')return 'RIG_DIFFERENCE_MODEL_UNAVAILABLE: no compiled rig is loaded.';
|
|
388
|
+
const painting=el('reference-content').querySelector<HTMLImageElement>('img');
|
|
389
|
+
if(referenceInput.state!=='loaded'||!painting?.naturalWidth)return 'RIG_DIFFERENCE_REFERENCE_UNAVAILABLE: select a loaded original painting image.';
|
|
390
|
+
try{rigRestCanvas(assets,{width:painting.naturalWidth,height:painting.naturalHeight});}catch{return 'RIG_DIFFERENCE_NATIVE_SCALE: original painting and declared rig canvas must align at native scale.';}
|
|
391
|
+
return rigDifferenceFailure;
|
|
392
|
+
}
|
|
393
|
+
/** Restore the compiled view without carrying image-space zoom, hidden layers or diagnostic pixels into capture. */
|
|
394
|
+
function leaveRigDifference():void {
|
|
395
|
+
const previous=rigDifference;if(!previous)return;rigDifference=null;
|
|
396
|
+
partsCanvas.remove();for(const [node,hidden]of previous.hidden)node.hidden=hidden;
|
|
397
|
+
viewport.cancelFit();Object.assign(viewport.state,previous.camera);viewport.state.cameraFrames={};viewport.state.cameraLayout='';
|
|
398
|
+
text('rig-label',previous.label);
|
|
399
|
+
}
|
|
286
400
|
function layoutEligibility(){return singleEligibility({rig:rigInput,reference:referenceInput,requested:view});}
|
|
287
401
|
/** Unavailable layouts stay visible but disabled with their named reason; no placeholder pane stands in for a missing input. */
|
|
288
402
|
function renderLayout():void {
|
|
403
|
+
if(rigDifference&&(rigDifferenceReason()||rigDifference.assets!==assets||rigDifference.painting!==el('reference-content').querySelector('img')))leaveRigDifference();
|
|
289
404
|
const state=layoutEligibility();effectiveView=state.effective;
|
|
290
|
-
for(const
|
|
291
|
-
|
|
405
|
+
for(const id of controls.viewModeIds)if(id!=='difference')controls.setDisabled(id,state.reasons[id as SingleLayout]??null);
|
|
406
|
+
controls.setMode(rigDifference||partsSubject?.comparison().mode==='difference'?'difference':state.effective,state.effective??state.requested);
|
|
407
|
+
if(partsSubject){controls.setDisabled('difference',partsSubject.differenceAvailable()&&rigInput.state==='loaded'&&referenceInput.state==='loaded'?null:tr('PARTS_DIFFERENCE_UNAVAILABLE: missing painting_in_rig declaration or painting_in_rig.json sidecar and its bound operand.'));if(partsSubject.comparison().mode==='difference')controls.setMode('difference');}
|
|
408
|
+
if(!partsSubject){controls.setDisabled('difference',tr(rigDifferenceReason()??'')||null);if(rigDifference)controls.setMode('difference');}
|
|
292
409
|
el('reference-pane').hidden=state.effective!=='compare'&&state.effective!=='reference';el('rig-pane').hidden=state.effective!=='compare'&&state.effective!=='rig';
|
|
293
410
|
const shown={compare:'Side by side',reference:'Reference only',rig:'Rig only'};
|
|
294
411
|
text('layout-state',state.effective===null?`No input rendered · ${state.reasons.compare??''}`:state.effective===state.requested?shown[state.effective]:`${shown[state.effective]} · ${shown[state.requested]} unavailable: ${state.reasons[state.requested]??''}`);
|
|
@@ -362,6 +479,7 @@ function renderSequenceFrame(): void {
|
|
|
362
479
|
}
|
|
363
480
|
|
|
364
481
|
async function showReference(id: string): Promise<void> {
|
|
482
|
+
rigDifferenceFailure=null;leaveRigDifference();
|
|
365
483
|
const generation = ++referenceGeneration;
|
|
366
484
|
video?.pause(); video = null;controlledVideoSample=null;delete viewport.state.cameraFrames.reference; viewport.state.referenceCenter=null; referenceSize = null; sequence = null; sequenceSvg = null; selectedPerson=''; lastPoseFrame = -1; el('person-control').hidden = true;
|
|
367
485
|
const content = el('reference-content'); content.replaceChildren();
|
|
@@ -481,6 +599,7 @@ function seekFrame(frame: number): void {
|
|
|
481
599
|
}
|
|
482
600
|
|
|
483
601
|
function drawRig(action:()=>void):void {
|
|
602
|
+
if(rigDifference&&rigDifference.assets!==assets){leaveRigDifference();renderLayout();}
|
|
484
603
|
inDrawRig=true;
|
|
485
604
|
try{action();parts?.present('single');if(player&&inspectionSourceState==='ready')animationPanel?.capture(player,parts?.frame('single'));else animationPanel?.capture(null,undefined);text('renderer-state',rendererStatus(player?.renderer??null,'succeeded').label);redrawOverlay(true);}
|
|
486
605
|
catch(error){animationPanel?.capture(null,undefined);overlays?.clear();text('renderer-state',rendererStatus(null,'failed').label);throw error;}
|
|
@@ -488,6 +607,7 @@ function drawRig(action:()=>void):void {
|
|
|
488
607
|
}
|
|
489
608
|
|
|
490
609
|
function chooseAnimation(name: string, move: ClipMove = { kind: 'choose' }): void {
|
|
610
|
+
if(rigDifference){leaveRigDifference();renderLayout();}
|
|
491
611
|
pause(); animation = name; axisInspection = false; el('angle-panel').hidden = true;
|
|
492
612
|
const runtimeAnimation = assets?.animations.find(item => item.name === name);
|
|
493
613
|
duration = clipDuration(name);
|
|
@@ -500,6 +620,7 @@ function chooseAnimation(name: string, move: ClipMove = { kind: 'choose' }): voi
|
|
|
500
620
|
}
|
|
501
621
|
|
|
502
622
|
function seek(value: number, move?: ClipMove): void {
|
|
623
|
+
if(rigDifference){leaveRigDifference();renderLayout();}
|
|
503
624
|
time = duration > 0 ? Math.min(Math.max(0, value), duration) : Math.max(0, value);
|
|
504
625
|
clipMoved(move ?? { kind: 'seek', to: time });
|
|
505
626
|
if (player && player.current) { try { player.seek(time); drawRig(()=>player!.draw()); } catch (error) {text('renderer-state',rendererStatus(null,'failed').label); message(errorText(error), true); } }
|
|
@@ -524,8 +645,8 @@ function renderCues(): void {
|
|
|
524
645
|
const clip = data.manifest.audio.clips.find(item => item.id === cue.clip);
|
|
525
646
|
const row = document.createElement('div'); row.className = 'cue';
|
|
526
647
|
const label = document.createElement('span'); label.textContent = `◇ ${cue.id} · ${cue.time.toFixed(2)} s → ${clip?.label ?? cue.clip}`;
|
|
527
|
-
const jump =
|
|
528
|
-
const play =
|
|
648
|
+
const jump = actionButton('Go to cue', () => { pause(); seek(cue.time); });
|
|
649
|
+
const play = actionButton('Audition', () => { void audition(cue.clip); }, !clip);
|
|
529
650
|
row.append(label, jump, play); area.append(row);
|
|
530
651
|
}
|
|
531
652
|
if (!activeCues().length) area.textContent = 'No linked sound cues.';
|
|
@@ -581,8 +702,7 @@ function prefillReportEvent(): void {
|
|
|
581
702
|
}
|
|
582
703
|
|
|
583
704
|
function chooseReportEvent(event: ReportEvent): void {
|
|
584
|
-
|
|
585
|
-
select('feedback-category').value = draft.category; input('feedback-summary').value = draft.summary;
|
|
705
|
+
if (selectedReportEvent?.id !== event.id) select('feedback-category').value = '';
|
|
586
706
|
pause(); selectedReportEvent = event; selectedReportTime = undefined; selectedReportTarget = undefined;
|
|
587
707
|
const selection = eventSelection(event);
|
|
588
708
|
const times = select('report-time'); times.replaceChildren();
|
|
@@ -633,10 +753,11 @@ function seekReading(clip: string, frame: number, exact: number | null, label: s
|
|
|
633
753
|
}
|
|
634
754
|
|
|
635
755
|
function tick(now: number): void {
|
|
756
|
+
if(suspended||disposed||!screenRoot.isConnected)return;
|
|
636
757
|
// #356: the scrub box is read before this frame writes anything (a read after the writes forces a layout).
|
|
637
758
|
if (playing) try { holdScrubBox(input('scrub')); tickPlaying(now); } finally { releaseScrubBox(); }
|
|
638
759
|
else tickHeldPhysics(now);
|
|
639
|
-
requestAnimationFrame(tick);
|
|
760
|
+
frameHandle=requestAnimationFrame(tick);
|
|
640
761
|
}
|
|
641
762
|
|
|
642
763
|
/** Animate steps held physics under the standing environment; wind time and queued jolts stay frozen. */
|
|
@@ -746,8 +867,15 @@ function applyAxis(): void {
|
|
|
746
867
|
const value = Number(input('axis-value').value); text('axis-value-label', value.toFixed(3)); seek((value - axis.min) / (axis.max - axis.min) * duration);
|
|
747
868
|
}
|
|
748
869
|
|
|
870
|
+
/** A changed draft with the same id is still editable; only the exact submitted row is locked. */
|
|
871
|
+
function isSubmittedFeedback(id:string):boolean {
|
|
872
|
+
const row=session.feedback.find(item=>item.id===id);
|
|
873
|
+
return !!row&&!!submittedBaseline?.updatedAt&&submittedBaseline.feedback.some(item=>item.id===id&&JSON.stringify(item)===JSON.stringify(row));
|
|
874
|
+
}
|
|
875
|
+
|
|
749
876
|
function renderProposals(): void {
|
|
750
877
|
comments?.refresh();
|
|
878
|
+
const count=session.feedback.length;setSourceText(rigInspector.comments.button, `Comments (${count})`);
|
|
751
879
|
const area = el('proposal-list'); area.replaceChildren();
|
|
752
880
|
const warnings = el('feedback-warnings'); warnings.hidden = session.feedbackWarnings.length === 0;
|
|
753
881
|
const unchecked = session.feedback.map(f => appliedCheckRefusal((f.context as Record<string, unknown> | undefined)?.applied)).find(Boolean) ?? null;
|
|
@@ -758,7 +886,8 @@ function renderProposals(): void {
|
|
|
758
886
|
const title = document.createElement('span'); title.className = 'feedback-heading'; title.textContent = `${feedback.category} · ${feedback.target.kind}:${feedback.target.name} · `;
|
|
759
887
|
const timing = document.createElement('span'); timing.textContent = feedbackTimingLabel(feedback); heading.append(title, timing);
|
|
760
888
|
const description = document.createElement('span'); description.className = 'feedback-summary'; description.textContent = feedback.summary;
|
|
761
|
-
|
|
889
|
+
const marked=(feedback.context as any)?.comment?.schema==='rig-review-comment/1';
|
|
890
|
+
if(!marked)item.append(heading, description);
|
|
762
891
|
const context = feedback.context as Record<string, Json> | undefined;
|
|
763
892
|
const correction = context?.correction as {path?: string;selector?:{kind?:string}} | undefined;
|
|
764
893
|
if (correction) {
|
|
@@ -774,7 +903,7 @@ function renderProposals(): void {
|
|
|
774
903
|
item.append(label);
|
|
775
904
|
}
|
|
776
905
|
if ((context?.comment as {schema?: string} | undefined)?.schema === 'rig-review-comment/1' &&
|
|
777
|
-
!
|
|
906
|
+
!isSubmittedFeedback(feedback.id)) {
|
|
778
907
|
const describe = document.createElement('button');
|
|
779
908
|
describe.type = 'button';
|
|
780
909
|
setSourceText(describe, 'Use as described correction');
|
|
@@ -786,8 +915,8 @@ function renderProposals(): void {
|
|
|
786
915
|
}
|
|
787
916
|
for (const warning of session.feedbackWarnings.filter(value => value.id === feedback.id)) { const note = document.createElement('p'); note.className = 'hint'; note.textContent = `Validation warning · ${warning.error}`; item.append(note); }
|
|
788
917
|
const details = document.createElement('details'), summary = document.createElement('summary'), source = document.createElement('pre'); summary.textContent = 'Saved feedback and inspection context'; source.className = 'feedback-json'; source.textContent = JSON.stringify(feedback, null, 2); details.append(summary, source);
|
|
789
|
-
const remove =
|
|
790
|
-
item.append(details);if((feedback.context as any)?.comment?.schema!=='rig-review-comment/1'||!
|
|
918
|
+
const remove = actionButton('Delete', () => { session.feedback = session.feedback.filter(item => item.id !== feedback.id); session.feedbackWarnings = session.feedbackWarnings.filter(warning => warning.id !== feedback.id); markDirty(); renderProposals(); });
|
|
919
|
+
item.append(details);if((feedback.context as any)?.comment?.schema!=='rig-review-comment/1'||!isSubmittedFeedback(feedback.id))item.append(remove); const commentRow=marked?document.querySelector<HTMLElement>(`[data-comment-id="${feedback.id}"]`):null;(commentRow??area).append(item);
|
|
791
920
|
}
|
|
792
921
|
updateSavedState();
|
|
793
922
|
}
|
|
@@ -827,9 +956,9 @@ function propose(tool: string): void {
|
|
|
827
956
|
angle: { target: 'rig', hint: 'One-line feedback on face or torso angle deformation' }, pose: { target: 'bone', hint: 'One-line feedback on differences from the input pose' }, timing: { target: 'rig', hint: 'One-line feedback on timing in the selected range' }, audio: { target: 'rig', hint: 'One-line feedback on event or audio links' },
|
|
828
957
|
};
|
|
829
958
|
const choice = choices[tool]; if (!choice) return;
|
|
830
|
-
select('feedback-target-kind').value = choice.target; input('feedback-target-name').value = choice.target === 'rig' ? data.manifest.id : '';
|
|
959
|
+
select('feedback-target-kind').value = choice.target; input('feedback-target-name').value = choice.target === 'rig' ? data.manifest.id : '';
|
|
831
960
|
renderFeedbackTargets();
|
|
832
|
-
showInspector('feedback');input('feedback-
|
|
961
|
+
showInspector('feedback');input('feedback-start').focus(); message('Specify a frame range and actual bone or slot name to add feedback. Motion keys are not edited.');
|
|
833
962
|
}
|
|
834
963
|
|
|
835
964
|
|
|
@@ -885,6 +1014,44 @@ async function exportStrip(): Promise<void> {
|
|
|
885
1014
|
}
|
|
886
1015
|
|
|
887
1016
|
|
|
1017
|
+
function recordFeedback(summary:string,feedback?:Feedback,correction?:ReturnType<typeof correctionSelection>):void {
|
|
1018
|
+
const start = input('feedback-start').value.trim(), end = input('feedback-end').value.trim(), frameStart = start ? Number(start) : feedback?.frameStart??null, frameEnd = end ? Number(end) : feedback?.frameEnd??null;
|
|
1019
|
+
const name = input('feedback-target-name').value.trim();
|
|
1020
|
+
if(!feedback&&(!start||!end))throw new Error(tr('Enter nonnegative integer start and end frames, with the end at or after the start.'));
|
|
1021
|
+
if (start || end) { if (!start || !end || !Number.isSafeInteger(Number(start)) || !Number.isSafeInteger(Number(end)) || Number(start) < 0 || Number(end) < Number(start)) throw new Error(tr('Enter nonnegative integer start and end frames, with the end at or after the start.')); }
|
|
1022
|
+
if (!['bone', 'slot', 'rig'].includes(select('feedback-target-kind').value) || !['defect', 'quality'].includes(select('feedback-category').value || feedback?.category || '')) throw new Error(tr('Select a target type and defect or quality category.'));
|
|
1023
|
+
if (!name) throw new Error(tr('Enter the actual target name and a one-line summary of up to 1,000 characters.'));
|
|
1024
|
+
const target: Feedback['target'] = { kind: select('feedback-target-kind').value as Feedback['target']['kind'], name };
|
|
1025
|
+
const captured=feedback?.context as Record<string,Json>|undefined;
|
|
1026
|
+
const selectedAnimation = feedback?(typeof captured?.animation==='string'?captured.animation:null):feedbackAnimation();
|
|
1027
|
+
if(feedback&&feedback.frameStart===null&&(start||end))throw new Error(tr('Frame ranges require an explicit producer frame. Leave both fields empty for this seconds-only comment.'));
|
|
1028
|
+
if(frameStart!==null&&frameEnd!==null)validateFeedbackSelection(data.feedbackCatalog, { frameStart, frameEnd, target, animation: selectedAnimation });
|
|
1029
|
+
else validateTimedFeedbackSelection(data.feedbackCatalog,{target,animation:selectedAnimation,time:Number(captured?.time)});
|
|
1030
|
+
const box = assets?.stage ?? player?.bounds();
|
|
1031
|
+
const center = viewport.state.cameraCenter ?? (box ? { x: box.x + box.width / 2, y: box.y + box.height / 2 } : null);
|
|
1032
|
+
session.feedback.push({ id:feedback?.id??crypto.randomUUID(), ...feedback, frameStart, frameEnd, target, category: (select('feedback-category').value || feedback?.category || '') as Feedback['category'], summary, context: {...(feedback?.context as Record<string,Json>),...(turnPad?{turn:JSON.parse(JSON.stringify(turnPad.snapshot())) as Json}:{}),part:parts?.feedback()??null,
|
|
1033
|
+
...(correction ? { correction } : {}),
|
|
1034
|
+
interval: frameStart===null||frameEnd===null ? null : { frameStart, frameEnd, inclusive: true },
|
|
1035
|
+
checkpoint: checkpoint?.id ?? null, animation: selectedAnimation, time:captured?.time??time, frame:feedback?captured?.frame??null:frameAtTime(activeFrameClock(),time),
|
|
1036
|
+
reference: select('reference-select').value || null, person: selectedPerson || null,
|
|
1037
|
+
sourceTime: sequence ? sequence.frames[0]!.t + time : time,
|
|
1038
|
+
camera: center ? { zoom:viewport.state.zoom, x: center.x, y: center.y, coordinateSystem: 'world-y-up' } : { zoom:viewport.state.zoom, coordinateSystem: 'reference-fit' },
|
|
1039
|
+
view:{...serializableView(numericView()),theme:appearance?.get()??'system',layers:{...layers}},
|
|
1040
|
+
axis: axisInspection ? { id: select('axis-select').value, value: Number(input('axis-value').value) } : null,
|
|
1041
|
+
environment: feedbackEnvironment(),
|
|
1042
|
+
// The exported schedule (#112): the drawn clip's rigc-environment/1 bytes and their sha256, and whether readings and Apply read them.
|
|
1043
|
+
environmentSchedule: feedbackSchedule() as unknown as Json,
|
|
1044
|
+
// The exact last applied designation and the producer's line, only while that scratch build is what is drawn.
|
|
1045
|
+
applied: appliedOnStage ? JSON.parse(JSON.stringify(appliedOnStage)) as Json : null,
|
|
1046
|
+
// The readings chosen (#108): the pairs of the last finished run and the builds they ran on, not their results.
|
|
1047
|
+
readings: readingsContext() as unknown as Json,
|
|
1048
|
+
// The declared requirements (#113): the file by hash and content, and its last check, or null when none are declared.
|
|
1049
|
+
requirements: (requirementsPanel?.context() ?? null) as unknown as Json,
|
|
1050
|
+
reportEvent: selectedReportEvent ? { id: selectedReportEvent.id, field: selectedReportEvent.field, source: { ...selectedReportEvent.source }, frames: selectedReportEvent.frames ? [...selectedReportEvent.frames] : null, exactTime: eventSeekTime(selectedReportEvent, selectedReportTime), targets: selectedReportEvent.targets.map(target => ({ ...target })) } : null,
|
|
1051
|
+
} });
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
|
|
888
1055
|
function bind(): void {
|
|
889
1056
|
button('strip-export').onclick = () => { void exportStrip(); };
|
|
890
1057
|
button('chest-export').onclick = () => { void exportChest(); };
|
|
@@ -892,14 +1059,13 @@ function bind(): void {
|
|
|
892
1059
|
// A discarded local draft restores the form after its button's own handler; re-read the tool then.
|
|
893
1060
|
for (const id of ['draft-recovery', 'review-draft-recovery']) el(id).addEventListener('click', () => { renderChest(); restoreEnvironment(); physicsPanel?.restore(); bonesPanel?.restore(); cutsPanel?.restore(); clothPanel?.restore(); idlePanel?.restore(); rigFieldsPanel?.restore(); syncCorrectionStage(); });
|
|
894
1061
|
for (const id of ['strip-scope', 'strip-reference', 'strip-format']) select(id).onchange = () => stripStatus('Selection changed. Check the ranges, animation and reference video before downloading.');
|
|
895
|
-
for (const item of document.querySelectorAll<HTMLButtonElement>('[data-view]')) item.onclick = () => {setView(item.dataset.view as typeof view);const menu=document.getElementById('view-menu') as HTMLDetailsElement|null;if(menu)menu.open=false;};
|
|
896
1062
|
for (const item of document.querySelectorAll<HTMLButtonElement>('[data-proposal]')) item.onclick = () => propose(item.dataset.proposal ?? '');
|
|
897
1063
|
select('reference-select').onchange = () => { void showReference(select('reference-select').value); };
|
|
898
1064
|
select('person-select').onchange = () => { selectedPerson = select('person-select').value; lastPoseFrame = -1; renderSequenceFrame(); };
|
|
899
1065
|
select('animation-select').onchange = () => {chooseAnimation(select('animation-select').value);if(canRepeatIdle())void playPreview();};
|
|
900
1066
|
select('part-set').onchange = () => { try { if(!player)return;player.setSet(select('part-set').value || null);drawRig(()=>player!.draw());fitCamera(); } catch (error) {text('renderer-state',rendererStatus(null,'failed').label); message(errorText(error), true); } };
|
|
901
1067
|
select('axis-select').onchange = chooseAxis; input('axis-value').oninput = applyAxis;
|
|
902
|
-
viewport.bindControls();
|
|
1068
|
+
viewport.bindControls(unitScaleMessage);
|
|
903
1069
|
input('scrub').oninput = () => { pause(); seek(Number(input('scrub').value)); };
|
|
904
1070
|
input('frame-number').onfocus = pause;
|
|
905
1071
|
input('frame-number').onkeydown = event => { if (event.key === 'Enter') { event.preventDefault(); const value = input('frame-number').value.trim(); seekFrame(value ? Number(value) : NaN); } };
|
|
@@ -918,62 +1084,44 @@ function bind(): void {
|
|
|
918
1084
|
select('report-time').onchange = () => { selectedReportTime = Number(select('report-time').value); renderReportSelection(); seekReportEvent(); };
|
|
919
1085
|
select('report-target').onchange = () => { const value = select('report-target').value; selectedReportTarget = value ? Number(value) : undefined; prefillReportEvent(); };
|
|
920
1086
|
select('review-status').onchange = () => { session.status = select('review-status').value as ReviewSession['status']; markDirty(); };
|
|
921
|
-
el<HTMLTextAreaElement>('checkpoint-note').oninput = () => { const entry = checkpointEntry(); if (entry) { entry.note = el<HTMLTextAreaElement>('checkpoint-note').value; markDirty(); } };
|
|
922
1087
|
for (const radio of document.querySelectorAll<HTMLInputElement>('input[name="outcome"]')) radio.onchange = () => { const entry = checkpointEntry(); if (entry) { entry.outcome = radio.value as typeof entry.outcome; markDirty(); renderCheckpoints(); } };
|
|
923
1088
|
select('feedback-target-kind').onchange = () => renderFeedbackTargets();
|
|
924
1089
|
button('add-proposal').onclick = async () => {
|
|
925
|
-
const
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
summary = new TextDecoder('utf-8', { fatal: true, ignoreBOM: true }).decode(await file.arrayBuffer());
|
|
937
|
-
}
|
|
938
|
-
if (!summary.trim() || summary.length > 1000) throw new Error(tr('Correction text must be valid UTF-8 and at most 1,000 characters.'));
|
|
939
|
-
if (path === 'made' && (!capturedApply || capturedApply !== appliedOnStage)) throw new Error(tr('CORRECTION_APPLY_PENDING: Apply and check the correction first.'));
|
|
940
|
-
} catch (error) { message(errorText(error), true); return; }
|
|
941
|
-
}
|
|
942
|
-
if (!start || !end || !Number.isSafeInteger(frameStart) || !Number.isSafeInteger(frameEnd) || frameStart < 0 || frameEnd < frameStart) { message('Enter nonnegative integer start and end frames, with the end at or after the start.', true); return; }
|
|
943
|
-
if (!['bone', 'slot', 'rig'].includes(select('feedback-target-kind').value) || !['defect', 'quality'].includes(select('feedback-category').value)) { message('Select a target type and defect or quality category.', true); return; }
|
|
944
|
-
if (!name || !summary || (!correction && /[\r\n]/.test(summary)) || summary.length > 1000) { message('Enter the actual target name and a one-line summary of up to 1,000 characters.', true); return; }
|
|
945
|
-
const target: Feedback['target'] = { kind: select('feedback-target-kind').value as Feedback['target']['kind'], name };
|
|
946
|
-
const selectedAnimation = feedbackAnimation();
|
|
947
|
-
try { validateFeedbackSelection(data.feedbackCatalog, { frameStart, frameEnd, target, animation: selectedAnimation }); } catch (error) { message(errorText(error), true); return; }
|
|
948
|
-
const box = assets?.stage ?? player?.bounds();
|
|
949
|
-
const center = viewport.state.cameraCenter ?? (box ? { x: box.x + box.width / 2, y: box.y + box.height / 2 } : null);
|
|
950
|
-
session.feedback.push({ id: crypto.randomUUID(), frameStart, frameEnd, target, category: select('feedback-category').value as Feedback['category'], summary, context: {...(turnPad?{turn:JSON.parse(JSON.stringify(turnPad.snapshot())) as Json}:{}),part:parts?.feedback()??null,
|
|
951
|
-
...(correction ? { correction } : {}),
|
|
952
|
-
interval: { frameStart, frameEnd, inclusive: true },
|
|
953
|
-
checkpoint: checkpoint?.id ?? null, animation: selectedAnimation, time, frame: frameAtTime(activeFrameClock(), time),
|
|
954
|
-
reference: select('reference-select').value || null, person: selectedPerson || null,
|
|
955
|
-
sourceTime: sequence ? sequence.frames[0]!.t + time : time,
|
|
956
|
-
camera: center ? { zoom:viewport.state.zoom, x: center.x, y: center.y, coordinateSystem: 'world-y-up' } : { zoom:viewport.state.zoom, coordinateSystem: 'reference-fit' },
|
|
957
|
-
view:{...serializableView(numericView()),theme:appearance?.get()??'system',layers:{...layers}},
|
|
958
|
-
axis: axisInspection ? { id: select('axis-select').value, value: Number(input('axis-value').value) } : null,
|
|
959
|
-
environment: feedbackEnvironment(),
|
|
960
|
-
// The exported schedule (#112): the drawn clip's rigc-environment/1 bytes and their sha256, and whether readings and Apply read them.
|
|
961
|
-
environmentSchedule: feedbackSchedule() as unknown as Json,
|
|
962
|
-
// The exact last applied designation and the producer's line, only while that scratch build is what is drawn.
|
|
963
|
-
applied: appliedOnStage ? JSON.parse(JSON.stringify(appliedOnStage)) as Json : null,
|
|
964
|
-
// The readings chosen (#108): the pairs of the last finished run and the builds they ran on, not their results.
|
|
965
|
-
readings: readingsContext() as unknown as Json,
|
|
966
|
-
// The declared requirements (#113): the file by hash and content, and its last check, or null when none are declared.
|
|
967
|
-
requirements: (requirementsPanel?.context() ?? null) as unknown as Json,
|
|
968
|
-
reportEvent: selectedReportEvent ? { id: selectedReportEvent.id, field: selectedReportEvent.field, source: { ...selectedReportEvent.source }, frames: selectedReportEvent.frames ? [...selectedReportEvent.frames] : null, exactTime: eventSeekTime(selectedReportEvent, selectedReportTime), targets: selectedReportEvent.targets.map(target => ({ ...target })) } : null,
|
|
969
|
-
} });
|
|
970
|
-
input('feedback-summary').value = ''; input('correction-words').value = ''; markDirty(); renderProposals(); message('Added structured feedback. Submit the review to save it.');
|
|
1090
|
+
const path=select('correction-path').value,capturedApply=appliedOnStage;
|
|
1091
|
+
try {
|
|
1092
|
+
if(path!=='described'&&path!=='made')throw new Error(tr('Choose the explicit Create source identity.'));
|
|
1093
|
+
const correction=correctionSelection(path),file=input('correction-words').files?.[0];
|
|
1094
|
+
if(!file||file.size>4000)throw new Error(tr('Correction text must be valid UTF-8 and at most 1,000 characters.'));
|
|
1095
|
+
const summary=new TextDecoder('utf-8',{fatal:true,ignoreBOM:true}).decode(await file.arrayBuffer());
|
|
1096
|
+
if(!summary.trim()||summary.length>1000)throw new Error(tr('Correction text must be valid UTF-8 and at most 1,000 characters.'));
|
|
1097
|
+
if(path==='made'&&(!capturedApply||capturedApply!==appliedOnStage))throw new Error(tr('CORRECTION_APPLY_PENDING: Apply and check the correction first.'));
|
|
1098
|
+
recordFeedback(summary,undefined,correction);
|
|
1099
|
+
input('correction-words').value='';markDirty();renderProposals();message('Added structured feedback. Submit the review to save it.');
|
|
1100
|
+
}catch(error){message(errorText(error),true);}
|
|
971
1101
|
};
|
|
972
1102
|
button('save').onclick = async () => {
|
|
973
1103
|
if(readOnly){message(readOnly,true);return;}
|
|
974
1104
|
if(draftConflict){message('Resolve the saved local draft conflict before submitting.',true);return;}
|
|
975
1105
|
if (session.feedbackWarnings.length) { message('Resolve validation warnings in existing feedback before submitting. Delete the marked entries and add valid replacements.', true); return; }
|
|
976
1106
|
saving = true; updateSavedState(); const savedPayload = JSON.stringify(session);
|
|
1107
|
+
if (host) {
|
|
1108
|
+
try {
|
|
1109
|
+
const sent = await host.submit(structuredClone(session), async committed => {
|
|
1110
|
+
submittedBaseline = {...submittedBaseline!, ...committed.review,
|
|
1111
|
+
checkpoints: {...submittedBaseline!.checkpoints, ...committed.checkpoints}, updatedAt: committed.at};
|
|
1112
|
+
session.updatedAt = committed.at;
|
|
1113
|
+
const ids = new Set([...Object.keys(session.checkpoints), ...Object.keys(submittedBaseline.checkpoints)]);
|
|
1114
|
+
dirty = session.status !== submittedBaseline.status || JSON.stringify(session.feedback) !== JSON.stringify(submittedBaseline.feedback) ||
|
|
1115
|
+
[...ids].some(id => JSON.stringify(session.checkpoints[id] ?? {outcome: 'pending', note: ''}) !==
|
|
1116
|
+
JSON.stringify(submittedBaseline!.checkpoints[id] ?? {outcome: 'pending', note: ''}));
|
|
1117
|
+
await persistence?.submitted(submittedBaseline);
|
|
1118
|
+
comments?.refresh(); renderProposals();
|
|
1119
|
+
});
|
|
1120
|
+
message(sent);
|
|
1121
|
+
} catch (error) { message(errorText(error), true); }
|
|
1122
|
+
finally { saving = false; updateSavedState(); }
|
|
1123
|
+
return;
|
|
1124
|
+
}
|
|
977
1125
|
try { const saved = await api<ReviewSession>('/api/session', { method: 'PUT', headers: { 'Content-Type': 'application/json' }, body: savedPayload });
|
|
978
1126
|
if (JSON.stringify(session) === savedPayload) { session = saved; dirty = false; } else session.updatedAt = saved.updatedAt;
|
|
979
1127
|
submittedBaseline=structuredClone(saved);comments?.refresh();await persistence?.submitted(saved);renderProvenance();renderProposals();
|
|
@@ -990,11 +1138,7 @@ function bind(): void {
|
|
|
990
1138
|
const picker=select('part-set');picker.value=name;picker.dispatchEvent(new Event('change',{bubbles:true}));
|
|
991
1139
|
});
|
|
992
1140
|
viewDisposers.push(()=>directionPanel?.dispose());
|
|
993
|
-
|
|
994
|
-
workspace=bindWorkspaceUI({changed:fitCamera,defaultTheme:theme=>appearance?.set(theme),currentTheme:()=>appearance?.get()});
|
|
995
|
-
viewport.state.cameraSync=workspace.defaults().defaultCameraSync;input('camera-sync').checked=viewport.state.cameraSync;input('idle-repeat').checked=workspace.defaults().defaultIdleRepeat;
|
|
996
|
-
appearance=bindAppearance(select('settings-theme'),workspace.defaults().theme);
|
|
997
|
-
inspectorBlocks=bindInspectorBlocks({sections:[el('inspector-rig'),el('inspector-playback')],changed:()=>persistence?.save()});
|
|
1141
|
+
bindWorkspace();
|
|
998
1142
|
overlays=new RigOverlays({canvas:el<HTMLCanvasElement>('rig-overlay'),rigRoot:el('rig-root')});
|
|
999
1143
|
chestEditor=bindChestEditor({pane:el('rig-pane'),canvas:el('rig-overlay'),project:()=>player?rigProject():null,mapping:()=>activeChestMapping(),changed:renderChest,download:()=>{void exportChest();},apply:()=>{void applyRebuild();},reset:()=>{void resetRebuild();},message,inspector:()=>selectedInspector()});viewDisposers.push(()=>chestEditor?.dispose());
|
|
1000
1144
|
meshEditor=bindMeshEditor({pane:el('rig-pane'),canvas:el('rig-overlay'),project:()=>player?rigProject():null,mapping:()=>chestMapping,inspector:()=>selectedInspector(),source:meshSource,pause,changed:()=>redrawOverlay(false),download:doc=>{void exportMesh(doc);},apply:(doc,line)=>applyMeshDelta(doc,line),applied:()=>appliedOnStage?.schema==='rig-review-applied/3',resetBuild:()=>resetRebuild(stageWorld()),message,confirm:text=>window.confirm(tr(text)),token:name=>getComputedStyle(document.documentElement).getPropertyValue(name).trim()});viewDisposers.push(()=>meshEditor?.dispose());
|
|
@@ -1044,19 +1188,33 @@ function bind(): void {
|
|
|
1044
1188
|
input('idle-repeat').onchange=()=>{syncPlayerLoop();renderIdle();if(canRepeatIdle())void playPreview();};
|
|
1045
1189
|
bindEnvironment();
|
|
1046
1190
|
for(const id of ['proposal-panel','checkpoint-detail'])el(id).addEventListener('focusin',pause);
|
|
1047
|
-
bindInspector();
|
|
1048
|
-
document.addEventListener('visibilitychange',()=>{if(document.hidden){const resume=playing;pause();suspendedPreview=resume;}else if(suspendedPreview){suspendedPreview=false;void playPreview();}});
|
|
1191
|
+
bindInspector();
|
|
1192
|
+
document.addEventListener('visibilitychange',()=>{if(!screenRoot.isConnected)return;if(document.hidden){const resume=playing;pause();suspendedPreview=resume;}else if(suspendedPreview){suspendedPreview=false;void playPreview();}},{signal:lifecycle.signal});
|
|
1049
1193
|
const resize = viewport.observeResize();
|
|
1050
|
-
window.addEventListener('beforeunload', event => { if (dirty) { event.preventDefault(); event.returnValue = ''; } });
|
|
1051
|
-
|
|
1194
|
+
window.addEventListener('beforeunload', event => { if (screenRoot.isConnected&&dirty) { event.preventDefault(); event.returnValue = ''; } },{signal:lifecycle.signal});
|
|
1195
|
+
viewDisposers.push(()=>resize.disconnect());
|
|
1052
1196
|
}
|
|
1053
1197
|
|
|
1198
|
+
/** The one shell and block binding, for either subject. */
|
|
1199
|
+
function bindWorkspace():void {
|
|
1200
|
+
workspace=bindWorkspaceUI({root:screenRoot,regions:{layout:screenRoot.querySelector<HTMLElement>('.layout')!,left:screenRoot.querySelector<HTMLElement>('.left-panel')!,main:el('stage-layout').parentElement!,stage:el('stage-layout'),bottom:screenRoot.querySelector<HTMLElement>('.inspector')!,columns:{left:'rightWidth',right:null}},language:shell.language!,bottomPanel:rigInspector,changed:fitCamera,defaultTheme:theme=>appearance?.set(theme),currentTheme:()=>appearance?.get()});
|
|
1201
|
+
viewport.state.cameraSync=workspace.defaults().defaultCameraSync;input('camera-sync').checked=viewport.state.cameraSync;input('idle-repeat').checked=workspace.defaults().defaultIdleRepeat;
|
|
1202
|
+
appearance=bindAppearance(select('settings-theme'),workspace.defaults().theme);
|
|
1203
|
+
bindReviewDialog();
|
|
1204
|
+
inspectorBlocks=bindInspectorBlocks({sections:[el('inspector-rig'),el('inspector-playback')],bottom:{strip:rigInspector.strip,comment:rigInspector.comments.button,panel:rigInspector.comments.panel},changed:()=>{workspace?.refresh();persistence?.save();}});
|
|
1205
|
+
}
|
|
1054
1206
|
async function start(): Promise<void> {
|
|
1055
1207
|
try {
|
|
1208
|
+
if(host?.record&&!host.record.hasPicture){await startRecord();return;}
|
|
1056
1209
|
let writes: { capabilityRequired: boolean; control?: boolean };
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1210
|
+
const opened=await api<ReviewResponse|PartsSubjectEntry|InterviewSubjectEntry>('/api/review');
|
|
1211
|
+
if('subject' in opened&&opened.subject==='interview'){await startRecord(opened);return;}
|
|
1212
|
+
const [saved,accessState]=await Promise.all([api<ReviewSession|PartsSubjectSession>('/api/session'),api<{capabilityRequired:boolean;control?:boolean}>('/api/access')]);
|
|
1213
|
+
if('subject' in opened&&opened.subject==='parts'){await startParts(opened,saved as PartsSubjectSession,accessState);return;}
|
|
1214
|
+
data=opened as ReviewResponse;session=saved as ReviewSession;writes=accessState;
|
|
1215
|
+
readOnly = host?.record ? tr('JOB_REVIEW_READ_ONLY') : readOnlyReason(access, writes.capabilityRequired);
|
|
1216
|
+
actReadOnly = readOnlyReason(access, writes.capabilityRequired, host?.ownerActAccess);
|
|
1217
|
+
if(data.capabilities.preRig){rigInspector.comments.button.disabled=true;rigInspector.act.hidden=true;}
|
|
1060
1218
|
submittedBaseline=structuredClone(session);
|
|
1061
1219
|
text('package-title', data.manifest.title); text('revision', data.manifest.revision); document.title = `${data.manifest.title} · rig review`; text('source-hash', `source ${data.sourceHash.slice(0, 12)}`); select('review-status').value = session.status; select('feedback-target-kind').value = 'rig'; input('feedback-target-name').value = data.manifest.id;
|
|
1062
1220
|
select('reference-select').replaceChildren(); for (const reference of data.manifest.references) select('reference-select').append(option(reference.id, `${reference.label} · ${reference.type}`));
|
|
@@ -1065,9 +1223,11 @@ async function start(): Promise<void> {
|
|
|
1065
1223
|
// Checkpoints and reference fold away when the package supplies neither.
|
|
1066
1224
|
(el('package-context') as HTMLDetailsElement).open = data.manifest.checkpoints.length > 0 || data.manifest.references.length > 0;
|
|
1067
1225
|
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';
|
|
1068
|
-
populateChestBones(); bind(); parts=new PartExplorer(el('workspace-left'),el('selected-part'),previous=>{const part=parts?.value();if(!stageCorrectionRebinding&&(previous?.side!==part?.side||previous?.slot!==part?.slot||previous?.mode!==part?.mode))stageDraftRequestToken++;if(player&&inspectionSourceState==='ready')animationPanel?.capture(player,parts?.frame('single'));else animationPanel?.capture(null,undefined);weightsView?.refresh();redrawOverlay(true);meshEditor?.selectionChanged();if(stageCorrectionPart&&!stageCorrectionRebinding&&(part?.slot??null)!==stageCorrectionPart){stageCorrectionPart=null;document.getElementById('stage-draft-label')?.remove();}animationPanel?.fromParts(part?.slot??null);meshPanel?.select(part?.slot??null);requirementsPanel?.selectionChanged();renderDropNotices();if(part){viewport.state.activeCamera='rig';if(view==='reference')setView('rig');if(selectedInspector(document)!=='playback')showInspector('rig');renderCameraControls();}if(!viewport.state.cameraRestoring&&(previous?.side!==part?.side||previous?.slot!==part?.slot))cameraAction(()=>fitActiveCamera(part?'rig':availableCamera()));persistence?.save();},part=>{select('feedback-target-kind').value='slot';renderFeedbackTargets(true);input('feedback-target-name').value=part.slot;showInspector('feedback');}); animationPanel=new AnimationInspectionPanel({host:el('animation-inspection'),stage:el('rig-viewport'),project:(x,y)=>rigProject()(x,y),enabled:()=>inspectionSourceState==='ready'&&selectedInspector(document)==='playback',pause,preview:fn=>{animAdjust=fn;if(!player)return;player.adjust=composeAdjust(composeAdjust(composeAdjust(idleAdjust,dialAdjust),turnAdjust),animAdjust);if(!inDrawRig&&player.current&&!playing){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();
|
|
1226
|
+
populateChestBones(); bind(); parts=new PartExplorer(el('workspace-left'),el('selected-part'),previous=>{if(rigDifference){leaveRigDifference();renderLayout();}const part=parts?.value();if(!stageCorrectionRebinding&&(previous?.side!==part?.side||previous?.slot!==part?.slot||previous?.mode!==part?.mode))stageDraftRequestToken++;if(player&&inspectionSourceState==='ready')animationPanel?.capture(player,parts?.frame('single'));else animationPanel?.capture(null,undefined);weightsView?.refresh();redrawOverlay(true);meshEditor?.selectionChanged();if(stageCorrectionPart&&!stageCorrectionRebinding&&(part?.slot??null)!==stageCorrectionPart){stageCorrectionPart=null;document.getElementById('stage-draft-label')?.remove();}animationPanel?.fromParts(part?.slot??null);meshPanel?.select(part?.slot??null);requirementsPanel?.selectionChanged();renderDropNotices();if(part){viewport.state.activeCamera='rig';if(view==='reference')setView('rig');if(selectedInspector(document)!=='playback')showInspector('rig');renderCameraControls();}if(!viewport.state.cameraRestoring&&(previous?.side!==part?.side||previous?.slot!==part?.slot))cameraAction(()=>fitActiveCamera(part?'rig':availableCamera()));persistence?.save();},part=>{select('feedback-target-kind').value='slot';renderFeedbackTargets(true);input('feedback-target-name').value=part.slot;showInspector('feedback');}); animationPanel=new AnimationInspectionPanel({host:el('animation-inspection'),stage:el('rig-viewport'),project:(x,y)=>rigProject()(x,y),enabled:()=>inspectionSourceState==='ready'&&selectedInspector(document)==='playback',pause,preview:fn=>{animAdjust=fn;if(!player)return;player.adjust=composeAdjust(composeAdjust(composeAdjust(idleAdjust,dialAdjust),turnAdjust),animAdjust);if(!inDrawRig&&player.current&&!playing){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();
|
|
1069
1227
|
const requestedId = new URLSearchParams(location.search).get('checkpoint'),initial=initialReviewSelection(data.manifest,requestedId,data.explicitReference?.id,data.initialAnimation??undefined),first=initial.checkpoint;
|
|
1070
1228
|
rigInput=data.manifest.model?{state:'pending'}:{state:'absent'};renderLayout();
|
|
1229
|
+
// A job rig subject lands in Animate before the model finishes loading (#709).
|
|
1230
|
+
if(host)showInspector('playback');
|
|
1071
1231
|
if(initial.referenceId){select('reference-select').value=initial.referenceId;await showReference(initial.referenceId);}
|
|
1072
1232
|
await initPlayer(first);
|
|
1073
1233
|
// initPlayer keeps `player` only after its first draw succeeded; a declared model path alone never counts.
|
|
@@ -1076,32 +1236,258 @@ async function start(): Promise<void> {
|
|
|
1076
1236
|
if (first) await chooseCheckpoint(first,initial); else renderCheckpoint();
|
|
1077
1237
|
viewport.state.activeCamera=player?'rig':'reference';if(viewport.state.cameraSync)alignCameras();renderTransport();fitCamera();
|
|
1078
1238
|
if (requestedId && !first) message(`Checkpoint "${requestedId}" is not in this package. Select one from the list.`, true);
|
|
1079
|
-
else if (
|
|
1239
|
+
else if (actReadOnly) message(actReadOnly, true);
|
|
1240
|
+
else if (host?.ownerActAccess) message('Not submitted');
|
|
1080
1241
|
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.');
|
|
1081
|
-
requestAnimationFrame(tick);
|
|
1082
|
-
const restored=await setupPersistence();setupComments();await loadRebuildStatus();void loadRequirements();renderChest();restoreEnvironment();physicsPanel?.restore();bonesPanel?.restore();cutsPanel?.restore();clothPanel?.restore();idlePanel?.restore();rigFieldsPanel?.restore();meshPanel?.restore();void refreshDensityStrip();renderIdle();if(
|
|
1242
|
+
frameHandle=requestAnimationFrame(tick);
|
|
1243
|
+
const restored=await setupPersistence();setupComments();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();
|
|
1083
1244
|
// Only an instance that serves agent control is asked for its config: a plain open has no control endpoint (#164).
|
|
1084
1245
|
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)});
|
|
1085
1246
|
bindWorkspaceVisibility({key:access.key,sourceHash:data.sourceHash,pause});
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
}
|
|
1247
|
+
if(host){
|
|
1248
|
+
if(!player)throw new Error('JOB_VISUAL_UNAVAILABLE');
|
|
1249
|
+
await restorePublicationNavigation();document.body.dataset.ready='true';
|
|
1250
|
+
host.attach({recordForms:renderRecordForms,pendingSubjects:renderPendingSubjects,stage:hostStage,redraw:()=>{if(player&&!playing)drawRig(()=>player!.draw());},message,...host.record?{}:{incompatible:()=>navigationMissing,navigation:()=>({subject:'rig' as const,bookmark:inspectionBookmark()})},suspend:suspendScreen,resume:resumeScreen,dispose:disposeScreen});showInspector('playback');host.displayed();
|
|
1251
|
+
}
|
|
1252
|
+
} catch (error) { message(`Could not open review package: ${errorText(error)}`, true); text('dirty', 'Load failed'); host?.failed(error); }
|
|
1253
|
+
}
|
|
1254
|
+
/** Parts have a verdict and image-space pixels, never fabricated model/session fields. */
|
|
1255
|
+
async function startParts(opened:PartsSubjectEntry,saved:PartsSubjectSession,writes:{capabilityRequired:boolean}):Promise<void>{
|
|
1256
|
+
const subject=opened.parts,issues=saved.issues,submittedIssues=new Set(host? saved.issues.map(issue=>issue.id):[]);
|
|
1257
|
+
liveIssueCount=()=>issues.length;
|
|
1258
|
+
if(!partsOnly)throw new Error('PARTS_SUBJECT_ENTRY_REQUIRED');
|
|
1259
|
+
readOnly=host?.record?tr('JOB_REVIEW_READ_ONLY'):readOnlyReason(access,writes.capabilityRequired);
|
|
1260
|
+
actReadOnly=readOnlyReason(access,writes.capabilityRequired,host?.ownerActAccess);
|
|
1261
|
+
text('package-title',subject.title);text('revision','Parts package, before rigging');text('source-hash',`source ${subject.sourceHash.slice(0,12)}`);document.title=subject.title;
|
|
1262
|
+
bindWorkspace();bindInspector(true);
|
|
1263
|
+
const base=host?'/api/stage-parts':'/api/parts';
|
|
1264
|
+
const request=async(path:string,init?:RequestInit)=>{
|
|
1265
|
+
const response=await fetch(access.route(path),{...init,headers:access.headers(init?.headers)});
|
|
1266
|
+
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;
|
|
1267
|
+
};
|
|
1268
|
+
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})`);};
|
|
1269
|
+
// A parts verdict is saved only over a drawn subject: until the first paint, or after a failed one, Save stays off.
|
|
1270
|
+
const saveBlocked=()=>!!readOnly||!!subject.legacyVerdict?.readOnly||rigInput.state!=='loaded';
|
|
1271
|
+
text('rig-empty','Loading package…');
|
|
1272
|
+
partsSubject=bindPartsSubject({data:subject,canvas:partsCanvas,referenceCanvas:partsReference,viewport,el,toolbar:primaryToolbar,commentsHost:el('comments-list-host'),issues,...host?.record?{recordComments}:{},request,base,paintingPath:host?'/review-painting':'/api/parts/painting',mesh:()=>layers.mesh,restoreMesh:on=>{layers.mesh=on;input('layer-mesh').checked=on;},images:()=>layers.images,changed:()=>{if(host?.record){recordCommentsChanged();return;}changed();},selectionChanged:()=>parts?.refreshImages(),locked:id=>submittedIssues.has(id),refusal:()=>readOnly,drawn:state=>{rigInput=state;button('save').disabled=saveBlocked();if(state.state==='failed')text('rig-empty',state.reason);text('renderer-state',state.state==='loaded'?'Parts raster drawn · Canvas2D':'Rendering failed');text('player-state',state.state==='loaded'?'Parts images · no compiled rig loaded':'Rig load failed');renderLayout();},message});
|
|
1273
|
+
parts=new PartExplorer(el('workspace-left'),el('selected-part'),()=>{},()=>openReview());
|
|
1274
|
+
const thumbnails=new PartThumbnails();viewDisposers.push(()=>thumbnails.dispose());
|
|
1275
|
+
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});
|
|
1276
|
+
const unavailable='PARTS_RIG_UNAVAILABLE: this parts subject has no compiled rig.';
|
|
1277
|
+
for(const node of el('proposal-panel').children)if(node.id!=='comments-list-host')(node as HTMLElement).hidden=true;
|
|
1278
|
+
for(const control of document.querySelectorAll<HTMLInputElement|HTMLSelectElement|HTMLButtonElement>('#checkpoint-detail input,#proposal-panel input,#proposal-panel select,#proposal-panel button,#strip-panel input,#strip-panel select,#strip-panel button'))if(!control.closest('#comments-list-host')){control.disabled=true;setSourceAttribute(control,'title',unavailable);if(control instanceof HTMLInputElement&&control.name==='outcome')control.checked=false;}
|
|
1279
|
+
text('detail-note',unavailable);text('checkpoint-note','');el('strip-panel').hidden=true;
|
|
1280
|
+
text('provenance-version','Parts package, before rigging');text('provenance-rig','Not supplied');text('provenance-motion','Not supplied');
|
|
1281
|
+
text('provenance-full',JSON.stringify({subject:'parts',sourceHash:subject.sourceHash,painting:subject.painting,images:subject.items.map(({name,imageHash})=>({name,imageHash}))},null,2));
|
|
1282
|
+
text('source-files',`source ${subject.sourceHash}`);const provenanceHint=document.querySelector<HTMLElement>('.provenance>.hint');if(provenanceHint)setSourceText(provenanceHint,'Source files remain unchanged.');
|
|
1283
|
+
for(const tab of document.querySelectorAll<HTMLButtonElement>('[data-block-target]'))if(!['selected-part','feedback'].includes(tab.dataset.blockTarget??'')){tab.disabled=true;setSourceAttribute(tab,'title',unavailable);}
|
|
1284
|
+
for(const tool of document.querySelectorAll<HTMLButtonElement>('[data-workspace-view-tools] button')){tool.hidden=false;tool.disabled=true;setSourceAttribute(tool,'title',unavailable);}
|
|
1285
|
+
input('layer-images').disabled=false;input('layer-mesh').disabled=!subject.items.some(item=>item.mesh);input('layer-bones').disabled=true;
|
|
1286
|
+
describeLayerToggles(document,unavailable);
|
|
1287
|
+
for(const [id,key]of [['layer-images','images'],['layer-mesh','mesh']]as const)input(id).onchange=()=>{layers[key]=input(id).checked;partsSubject?.redraw();};
|
|
1288
|
+
const overlay=panelMake('input',{id:'parts-overlay',type:'checkbox',disabled:!subject.painting}),opacity=panelMake('input',{id:'parts-opacity',type:'range',min:'0',max:'1',step:'0.001',value:'0.5',disabled:!subject.painting});
|
|
1289
|
+
const overlayLabel=panelMake('label',{},overlay,tr('Overlay')),opacityLabel=panelMake('label',{},tr('Part opacity'),opacity);
|
|
1290
|
+
if(!subject.painting)for(const node of [overlayLabel,opacityLabel])setSourceAttribute(node,'title','PARTS_REFERENCE_UNAVAILABLE: supply --painting to compare the original painting');
|
|
1291
|
+
secondaryToolbar.append(overlayLabel,opacityLabel);
|
|
1292
|
+
overlay.onchange=()=>{partsSubject?.setComparison(overlay.checked?'overlay':'part');if(overlay.checked){view='rig';renderLayout();}};
|
|
1293
|
+
opacity.oninput=()=>partsSubject?.opacity(Number(opacity.value));
|
|
1294
|
+
controls.setDisabled('difference',subject.differenceAvailable&&subject.painting?null:tr('PARTS_DIFFERENCE_UNAVAILABLE: missing painting_in_rig declaration or painting_in_rig.json sidecar and its bound operand.'));
|
|
1295
|
+
const reference=select('reference-select');reference.replaceChildren(option('',subject.painting?'Original painting':'No references supplied'));reference.disabled=true;
|
|
1296
|
+
el('package-context').removeAttribute('open');el('reference-empty').hidden=!!subject.painting;el('rig-overlay').hidden=true;
|
|
1297
|
+
const state=rigInspector.actBar;state.setSaveState({kind:actReadOnly?'read-only':'unsaved',text:actReadOnly??'Not submitted'});
|
|
1298
|
+
select('review-status').hidden=true;document.querySelector<HTMLLabelElement>('label[for="review-status"]')!.hidden=true;
|
|
1299
|
+
button('save').disabled=saveBlocked();
|
|
1300
|
+
button('save').onclick=async()=>{
|
|
1301
|
+
if(saving||saveBlocked())return;saving=true;button('save').disabled=true;state.setSaveState({kind:'saving',text:'Saving…'});renderDraftState();
|
|
1302
|
+
const frozen=structuredClone(issues);
|
|
1303
|
+
try{
|
|
1304
|
+
if(host?.submitParts)message(await host.submitParts(frozen));
|
|
1305
|
+
else await request(base+'/verdict',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({status:frozen.length?'changes-requested':'approved',issues:frozen})});
|
|
1306
|
+
if(host)for(const issue of frozen)submittedIssues.add(issue.id);
|
|
1307
|
+
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);
|
|
1308
|
+
}catch(error){message(errorText(error),true);state.setSaveState({kind:'failed',text:'Save failed.'});}
|
|
1309
|
+
finally{saving=false;button('save').disabled=saveBlocked();renderDraftState();}
|
|
1310
|
+
};
|
|
1311
|
+
viewDisposers.push(viewport.bindControls(unitScaleMessage),viewport.bindNavigation(undefined,()=>!el('stage-layout').getAttribute('aria-busy')?.includes('true')),bindLayerShortcuts(document));
|
|
1312
|
+
const resize=viewport.observeResize();viewDisposers.push(()=>resize.disconnect());
|
|
1313
|
+
viewport.requestFit();await partsSubject.ready();text('dirty','Not submitted');message(actReadOnly??(host?.ownerActAccess?'Not submitted':'Parts ready. Source files remain unchanged.'),!!actReadOnly);referenceInput=subject.painting?{state:'loaded'}:{state:'absent'};renderLayout();
|
|
1314
|
+
renderPendingSubjects(host?.pendingSubjects?.()??[{kind:'parts-verdict'}]);
|
|
1315
|
+
if(host){await restorePublicationNavigation();host.attach({recordForms:renderRecordForms,stage:()=>null,redraw:()=>partsSubject?.redraw(),message,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();}
|
|
1316
|
+
|
|
1317
|
+
document.body.dataset.ready='true';
|
|
1318
|
+
}
|
|
1319
|
+
/** Record-only publications reuse the empty main view; no package or model is manufactured. */
|
|
1320
|
+
async function startRecord(interview?:InterviewSubjectEntry):Promise<void> {
|
|
1321
|
+
if(!host?.record&&!interview)throw new Error('JOB_DISPLAY_MISMATCH');
|
|
1322
|
+
const unavailable=interview?'MODEL_UNAVAILABLE: no compiled model is supplied in this inspection.':'This request has no picture.';
|
|
1323
|
+
readOnly=tr(interview?'MODEL_UNAVAILABLE':'JOB_REVIEW_READ_ONLY');
|
|
1324
|
+
if(!interview)actReadOnly=readOnlyReason(access,true,host?.ownerActAccess);
|
|
1325
|
+
bindWorkspace();bindInspector(true);rigInput={state:'absent'};referenceInput={state:'absent'};renderLayout();
|
|
1326
|
+
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??unavailable,!!actReadOnly);
|
|
1327
|
+
text('package-title',interview?.label??host!.record!.label);text('revision','');text('source-hash',`source ${(interview?.sourceHash??host!.record!.sourceHash).slice(0,12)}`);
|
|
1328
|
+
el('rig-pane').hidden=false;el('rig-empty').hidden=false;text('rig-empty',unavailable);
|
|
1329
|
+
for(const region of document.querySelectorAll('.inspector,.workspace-secondary-toolbar'))for(const control of region.querySelectorAll<HTMLInputElement|HTMLSelectElement|HTMLButtonElement>('input,select,textarea,button')){control.disabled=true;setSourceAttribute(control,'title',unavailable);}
|
|
1330
|
+
if(interview){
|
|
1331
|
+
button('save').disabled=true;setSourceAttribute(button('save'),'title',unavailable);
|
|
1332
|
+
const label=()=>{setSourceText(rigAsk,t('interview.title'));recordDialog?.setAttribute('aria-label',t('interview.title'));};
|
|
1333
|
+
label();viewDisposers.push(onLanguageChange(label));
|
|
1334
|
+
viewDisposers.push(await joinedInterviewForms(access,forms=>renderRecordForms(forms,t('interview.title'),true)));
|
|
1335
|
+
text('provenance-rig',unavailable);text('provenance-motion',unavailable);text('source-files','project.json');
|
|
1336
|
+
}else{setupComments();rigInspector.comments.button.disabled=false;button('stage-comment').disabled=false;}
|
|
1337
|
+
const resize=viewport.observeResize();viewDisposers.push(()=>resize.disconnect());
|
|
1338
|
+
await workspace?.settle();if(disposed)return;
|
|
1339
|
+
document.body.dataset.ready='true';
|
|
1340
|
+
if(!interview){host!.attach({recordForms:renderRecordForms,pendingSubjects:renderPendingSubjects,stage:()=>null,redraw:()=>{},message,suspend:suspendScreen,resume:resumeScreen,dispose:disposeScreen});host!.displayed();}
|
|
1341
|
+
}
|
|
1342
|
+
let recordDialog:HTMLDialogElement|null=null;
|
|
1343
|
+
/** Reuse the form's publication binding for native record comments, without a package session. */
|
|
1344
|
+
function restoreRecordComments(form:HTMLFormElement):void {
|
|
1345
|
+
if(!host?.record||recordCommentKey)return;
|
|
1346
|
+
const publicationId=form.dataset.jobPublication,sourceHash=host.record.sourceHash;
|
|
1347
|
+
if(!publicationId)throw new Error('JOB_DISPLAY_MISMATCH');
|
|
1348
|
+
recordCommentKey='rig-review-record-comments/1:'+publicationId+':'+sourceHash;
|
|
1349
|
+
try {
|
|
1350
|
+
const saved=JSON.parse(localStorage.getItem(recordCommentKey)??'null');
|
|
1351
|
+
if(saved?.publicationId!==publicationId||saved?.sourceHash!==sourceHash||!Array.isArray(saved.comments)||saved.comments.length>1000)return;
|
|
1352
|
+
const ids=new Set<string>();
|
|
1353
|
+
const rows=saved.comments as CommentRow[];
|
|
1354
|
+
for(const row of rows){
|
|
1355
|
+
if(!row||typeof row.id!=='string'||!row.id||ids.has(row.id)||typeof row.summary!=='string'||!row.summary.trim()||row.summary.length>1000)throw new Error('JOB_ACT_INVALID');
|
|
1356
|
+
ids.add(row.id);
|
|
1357
|
+
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());}
|
|
1358
|
+
else if('target' in row){const mark=parseStageComment((row.context as {comment?:unknown})?.comment);if(!host.record.hasPicture||mark.sourceHash!==data.sourceHash)throw new Error('JOB_DISPLAY_MISMATCH');}
|
|
1359
|
+
else if(Object.keys(row).some(key=>key!=='id'&&key!=='summary'))throw new Error('JOB_ACT_INVALID');
|
|
1360
|
+
}
|
|
1361
|
+
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}));
|
|
1362
|
+
recordComments.push(...rows);
|
|
1363
|
+
}catch{/* A mismatched or invalid local draft has no authority. */}
|
|
1364
|
+
}
|
|
1365
|
+
/** Comments remain native rows locally; the old act field carries their scalar projection only. */
|
|
1366
|
+
function recordCommentWords():string {
|
|
1367
|
+
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}));
|
|
1368
|
+
}
|
|
1369
|
+
function recordCommentsChanged():void {
|
|
1370
|
+
if(!host?.record)return;
|
|
1371
|
+
try{if(recordCommentKey)localStorage.setItem(recordCommentKey,JSON.stringify({publicationId:recordDialog?.querySelector<HTMLFormElement>('form[data-job-ask]')?.dataset.jobPublication,sourceHash:host.record.sourceHash,comments:recordComments}));}catch{/* In-memory comments remain bound to this host. */}
|
|
1372
|
+
setSourceText(rigInspector.comments.button,`Comments (${recordComments.length})`);
|
|
1373
|
+
for(const form of recordDialog?.querySelectorAll('form[data-job-ask]')??[])form.dispatchEvent(new Event('input',{bubbles:true}));
|
|
1374
|
+
}
|
|
1375
|
+
/** The shared answer forms use the one native dialog, opened from the current ask line. */
|
|
1376
|
+
function renderRecordForms(forms:readonly HTMLElement[],label='job.pending',standalone=false):void {
|
|
1377
|
+
if(!forms.length&&!recordDialog)return;
|
|
1378
|
+
if(!recordDialog){
|
|
1379
|
+
recordDialog=panelMake('dialog',{id:'job-record-asks',className:'workspace-drawer'});recordDialog.setAttribute('aria-label',tr(label));
|
|
1380
|
+
const close=panelMake('button',{className:'workspace-drawer-close',type:'button'},tr('Close'));recordDialog.append(close);app.append(recordDialog);
|
|
1381
|
+
viewDisposers.push(bindWorkspaceDrawer({trigger:rigAsk,drawer:recordDialog,label:tr(label),close}));
|
|
1382
|
+
viewDisposers.push(()=>{recordDialog?.close();recordDialog?.remove();recordDialog=null;});
|
|
1383
|
+
}
|
|
1384
|
+
recordDialog.classList.toggle('interview-modal',forms.some(form=>form.classList.contains('interview-answer')));
|
|
1385
|
+
for(const form of recordDialog.querySelectorAll<HTMLFormElement>('form.interview-answer,form[data-job-ask]'))if(!forms.includes(form)){if(!standalone)form.dispatchEvent(new Event('job-form-dispose'));form.remove();}
|
|
1386
|
+
if(!standalone&&forms[0])restoreRecordComments(forms[0] as HTMLFormElement);
|
|
1387
|
+
const added=forms.filter(form=>!recordDialog!.contains(form));
|
|
1388
|
+
for(const form of forms){
|
|
1389
|
+
if(!standalone)(form as JobForm['form']).commentWords=()=>host?.record?recordCommentWords():partsOnly?projectComments(partsIssueComments(partsSubject?.issues()??[])):projectComments(feedbackItemComments(session.feedback));
|
|
1390
|
+
if(!recordDialog.contains(form)){if(!form.classList.contains('interview-answer'))form.style.overflow='auto';form.style.minHeight='0';recordDialog.append(form);}
|
|
1391
|
+
}
|
|
1392
|
+
if(host?.record){
|
|
1393
|
+
for(const child of el('proposal-panel').children)if(child.id!=='comments-list-host')(child as HTMLElement).hidden=true;
|
|
1394
|
+
setSourceText(rigInspector.comments.button,`Comments (${recordComments.length})`);comments?.refresh();partsSubject?.refreshComments();
|
|
1395
|
+
button('save').disabled=!forms.some(form=>!form.querySelector('fieldset')?.disabled);button('save').onclick=()=>rigAsk.click();
|
|
1396
|
+
}
|
|
1397
|
+
if(standalone){rigAsk.hidden=false;setSourceText(rigAsk,t('interview.title'));}
|
|
1398
|
+
rigAsk.disabled=!forms.length;
|
|
1399
|
+
if((standalone?added.length>0:added.some(form=>form.classList.contains('interview-answer')))&&!recordDialog.open)rigAsk.click();
|
|
1400
|
+
}
|
|
1401
|
+
/** The ask heading reads only already-pending subjects. It never synthesizes an agent request. */
|
|
1402
|
+
function renderPendingSubjects(subjects:readonly {kind:string;stage?:string}[]):void {
|
|
1403
|
+
const requests:Record<string,string>={'parts-verdict':'Check the parts and meshes.','interview-picks':'Answer these questions.','review-verdict:rig-review':'Check the rig and motion.','review-verdict:direction-review':'Check the direction.','review-verdict:image-review':'Check these images.','checkpoint':'Review this checkpoint.','signoff':'Approve this stage.','reopen':'Review the reopened stage.'};
|
|
1404
|
+
const labels=subjects.map(subject=>requests[subject.kind+':'+subject.stage]??requests[subject.kind]).filter((label):label is string=>!!label);
|
|
1405
|
+
renderDraftState();
|
|
1406
|
+
rigAsk.hidden=!labels.length;setSourceText(rigAsk,labels.join(' · '));setSourceAttribute(rigAsk,'title',labels.join(' · '));
|
|
1407
|
+
}
|
|
1408
|
+
/** The rig pane for a live job's still (#709): the job binds and copies it, this screen keeps its view. */
|
|
1409
|
+
function hostStage():RigHostStage|null {
|
|
1410
|
+
if(!player)return null;const frame=parts?.frame('single');
|
|
1411
|
+
return {pane:el('rig-viewport'),paneHidden:el('rig-pane').hidden,root:el('rig-root'),player,frameGeneration:frame?.generation,camera:numericView().cameras.rig,frame:paneFrame('rig'),
|
|
1412
|
+
wholeRig:!rigDifference&&!parts?.value()&&player.slots===null&&layers.images,playing,posed:frame,assets};
|
|
1413
|
+
}
|
|
1414
|
+
/** Navigation alone crosses publication identity. The source's draft and submitted baseline were loaded normally above. */
|
|
1415
|
+
async function restorePublicationNavigation():Promise<void> {
|
|
1416
|
+
const navigation=host?.navigation;if(!navigation)return;
|
|
1417
|
+
if(navigation.subject==='parts'){
|
|
1418
|
+
if(!partsSubject)return;
|
|
1419
|
+
const opened=await api<PartsSubjectEntry>('/api/review');
|
|
1420
|
+
const exists=navigation.part===null||opened.parts.items.some(item=>item.name===navigation.part);
|
|
1421
|
+
partsSubject.select(exists?navigation.part:null);partsSubject.isolate(exists&&navigation.solo);parts?.refreshImages();
|
|
1422
|
+
await partsSubject.paint();
|
|
1423
|
+
view=navigation.view==='reference'?'reference':navigation.view==='compare'?'compare':'rig';renderLayout();
|
|
1424
|
+
viewport.cancelFit();
|
|
1425
|
+
for(const target of ['rig','reference']as const){const camera=navigation.camera.cameras[target];if(camera)viewport.writeCamera(target,camera);}
|
|
1426
|
+
viewport.state.cameraSync=navigation.camera.cameraSync??false;fitCamera();
|
|
1427
|
+
navigationMissing=!exists;if(!exists)message(tr('job.incompatible'));return;
|
|
1428
|
+
}
|
|
1429
|
+
if(partsOnly)return;
|
|
1430
|
+
const bookmark=structuredClone(navigation.bookmark);bookmark.binding=inspectionBinding();
|
|
1431
|
+
let missing=false;
|
|
1432
|
+
if(bookmark.selection.part){
|
|
1433
|
+
const {side,slot,mode}=bookmark.selection.part;bookmark.selection.part={side,slot,mode};
|
|
1434
|
+
try{parts?.validate(bookmark.selection.part);}catch{bookmark.selection.part=null;missing=true;}
|
|
1435
|
+
}
|
|
1436
|
+
if(bookmark.selection.checkpoint&&!data.manifest.checkpoints.some(item=>item.id===bookmark.selection.checkpoint))bookmark.selection.checkpoint=null;
|
|
1437
|
+
if(bookmark.selection.reference&&!data.manifest.references.some(item=>item.id===bookmark.selection.reference)){bookmark.selection.reference=null;bookmark.view.cameras.reference=null;missing=true;}
|
|
1438
|
+
if(bookmark.animation&&!assets?.animations.some(item=>item.name===bookmark.animation)){bookmark.animation=null;bookmark.time=0;bookmark.selection.axis=null;missing=true;}
|
|
1439
|
+
if(bookmark.selection.turn){try{if(!turnPad)throw new Error('TURN_UNAVAILABLE');turnPad.state.validate(bookmark.selection.turn);}catch{delete bookmark.selection.turn;missing=true;}}
|
|
1440
|
+
if(bookmark.selection.partSet&&!player?.sets().some(item=>item.name===bookmark.selection.partSet)){bookmark.selection.partSet=null;missing=true;}
|
|
1441
|
+
if(bookmark.selection.axis){const saved=bookmark.selection.axis,axis=data.manifest.axes.find(item=>item.id===saved.id);if(!axis||axis.animation!==bookmark.animation||saved.value<axis.min||saved.value>axis.max){bookmark.selection.axis=null;missing=true;}}
|
|
1442
|
+
const info=await inspectionReferenceInfo(bookmark.selection.reference===undefined?select('reference-select').value:bookmark.selection.reference,new AbortController().signal);
|
|
1443
|
+
const limit=inspectionTimeLimit(bookmark,info);
|
|
1444
|
+
if(bookmark.time!==null&&(bookmark.time<0||bookmark.time>limit&&limit>=0)){bookmark.time=0;missing=true;}
|
|
1445
|
+
if(bookmark.selection.person&&!info.people.includes(bookmark.selection.person)){bookmark.selection.person=null;missing=true;}
|
|
1446
|
+
await restoreInspection(bookmark,new AbortController().signal,true,true);
|
|
1447
|
+
persistence?.save();
|
|
1448
|
+
navigationMissing=missing;if(missing)message(tr('job.incompatible'));
|
|
1449
|
+
}
|
|
1450
|
+
function suspendScreen():void {
|
|
1451
|
+
if(suspended||disposed)return;
|
|
1452
|
+
if(!partsOnly&&(!host?.record||host.record.hasPicture))pause();
|
|
1453
|
+
persistence?.dispose();persistence=null;suspended=true;cancelAnimationFrame(frameHandle);
|
|
1454
|
+
}
|
|
1455
|
+
async function resumeScreen():Promise<void> {
|
|
1456
|
+
if(disposed)return;
|
|
1457
|
+
(window as unknown as {rigReviewEditor:unknown}).rigReviewEditor=publicEditor;
|
|
1458
|
+
const wasInert=screenRoot.inert;let ready=false;screenRoot.inert=true;document.body.removeAttribute('data-ready');
|
|
1459
|
+
try{
|
|
1460
|
+
await workspace?.settle();
|
|
1461
|
+
if(disposed)return;
|
|
1462
|
+
if(!partsOnly&&(!host?.record||host.record.hasPicture))await setupPersistence(true);
|
|
1463
|
+
suspended=false;if(!partsOnly&&(!host?.record||host.record.hasPicture))frameHandle=requestAnimationFrame(tick);ready=true;
|
|
1464
|
+
}finally{screenRoot.inert=ready?wasInert:true;if(ready&&!disposed)document.body.dataset.ready='true';}
|
|
1465
|
+
}
|
|
1466
|
+
function disposeScreen():void {
|
|
1467
|
+
if(disposed)return;suspendScreen();disposed=true;lifecycle.abort();
|
|
1468
|
+
comments?.dispose();partsSubject?.dispose();turnPad?.dispose();inspectorBlocks?.dispose();inspectorTabs?.dispose();
|
|
1469
|
+
workspace?.dispose();controlDispose?.();appearance?.dispose();rigInspector.actBar.dispose();shell.dispose();
|
|
1470
|
+
viewDisposers.forEach(dispose=>dispose());overlays?.dispose();player?.dispose();assets?.dispose();
|
|
1471
|
+
}
|
|
1472
|
+
window.addEventListener('pagehide',disposeScreen,{once:true,signal:lifecycle.signal});
|
|
1473
|
+
/** Old feedback bookmarks keep their inspection mode; only an explicit reveal opens the act. */
|
|
1474
|
+
function showInspector(name:string,reveal=true):void {if(name==='feedback'){if(reveal)openReview();return;}if(reveal)inspectorTabs?.select(name);else inspectorTabs?.restore(name);}
|
|
1475
|
+
function bindInspector(partsSubject=false):void {
|
|
1476
|
+
inspectorTabs?.dispose();
|
|
1477
|
+
rigInspector.row.reveal=()=>workspace?.revealInspector();
|
|
1478
|
+
inspectorTabs=bindInspectorTabs(()=>{const mode=inspectorTabs?.state();if(mode)inspectorBlocks?.activate(mode);workspace?.afterTab();renderLayout();},()=>workspace?.beforeTab(),rigInspector.row);
|
|
1479
|
+
viewDisposers.push(bindHeaderModeAvailability(partsSubject?{model:false,parts:true}:{model:!!data.manifest.model,preRig:data.capabilities.preRig}));
|
|
1480
|
+
for(const mode of document.querySelectorAll<HTMLButtonElement>('[data-mode]'))if(mode.dataset.mode==='rig'||mode.dataset.mode==='playback')mode.onclick=()=>showInspector(mode.dataset.mode!);
|
|
1481
|
+
}
|
|
1482
|
+
/** Pause at the held time and reveal the existing act without changing Setup/Animate mode. */
|
|
1483
|
+
function openReview():void {pause();if(!partsOnly)syncCorrectionStage();inspectorBlocks?.select(selectedInspector()??'rig','feedback');workspace?.revealInspector();}
|
|
1484
|
+
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.');}
|
|
1485
|
+
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.');}
|
|
1101
1486
|
|
|
1102
1487
|
/** Rig world → rig-pane pixels for the current camera. */
|
|
1103
1488
|
function rigProject(){const root=el('rig-root');return (x:number,y:number)=>({x:parseFloat(root.style.left||'0')+x*viewport.state.rigScale,y:parseFloat(root.style.top||'0')-y*viewport.state.rigScale});}
|
|
1104
1489
|
function redrawOverlay(fresh:boolean):void {
|
|
1490
|
+
if(rigDifference)return;
|
|
1105
1491
|
animationPanel?.redraw(layers.bones);
|
|
1106
1492
|
if(!overlays||!player)return;
|
|
1107
1493
|
const project=rigProject();
|
|
@@ -1128,7 +1514,7 @@ async function playPreview():Promise<void> {
|
|
|
1128
1514
|
if(video&&referenceInput.state==='loaded'){try{await video.play();}catch(error){pause();message(`Playback is paused: ${errorText(error)}. Use Play to retry.`,true);return;}}
|
|
1129
1515
|
if(intent!==playbackIntent||!desiredPlay){if(!desiredPlay)video?.pause();return;}playing=true;lastFrame=0;player?.hold(false);player?.resume();button('play').textContent='Ⅱ';button('play').setAttribute('aria-label','Pause');
|
|
1130
1516
|
}
|
|
1131
|
-
function localDraft():boolean{return !!comments?.draft()||dirty||!!input('feedback-
|
|
1517
|
+
function localDraft():boolean{return !!comments?.draft()||dirty||!!input('feedback-start').value.trim()||!!input('feedback-end').value.trim()||!!select('feedback-category').value||!!input('feedback-target-name').value.trim()&&input('feedback-target-name').value!==data.manifest.id;}
|
|
1132
1518
|
function controlState():ControlInspection {
|
|
1133
1519
|
const box=assets?.stage??player?.bounds(),center=viewport.paneFrame('rig')?.center??(box?{x:box.x+box.width/2,y:box.y+box.height/2}:null);
|
|
1134
1520
|
return {part:parts?.value()??null,partGeneration:parts?.observation()?.generation??null,view:numericView(),theme:appearance?.get()??'system',layout:'auto',effectiveLayout:el('stage-layout').dataset.orientation==='vertical'?'column':'row',cameras:{rig:{zoom:player?viewport.state.zoom:1,pan:{x:center&&viewport.state.cameraCenter?(center.x-viewport.state.cameraCenter.x)*viewport.state.rigScale:0,y:center&&viewport.state.cameraCenter?(viewport.state.cameraCenter.y-center.y)*viewport.state.rigScale:0}},reference:{zoom:referenceSize?viewport.state.referenceZoom:1,pan:{x:referenceSize&&viewport.state.referenceCenter?(referenceSize.width/2-viewport.state.referenceCenter.x)*viewport.state.referenceScale:0,y:referenceSize&&viewport.state.referenceCenter?(referenceSize.height/2-viewport.state.referenceCenter.y)*viewport.state.referenceScale:0}}},animation:animation||null,time,playing,loop:canRepeatIdle()?'idle':'off',layers:{images:!!player&&layers.images,meshes:!!player&&layers.mesh,bones:!!player&&layers.bones},ready:!!data,seeking:seekingControl||!!video?.seeking||!!persistence?.restoring(),dirty:localDraft(),busy:saving||stripBusy||!!persistence?.restoring(),feedbackEligible:!persistence?.restoring(),comparison:controlComparison(layoutEligibility()),capabilities:{camera:!!player,referenceCamera:!!referenceSize,animation:!!player,time:duration>0,playback:duration>0,layers:{images:!!player,meshes:!!player,bones:!!player}}};
|
|
@@ -1194,9 +1580,9 @@ async function decodedControlTime(media:HTMLVideoElement,target:number,signal:Ab
|
|
|
1194
1580
|
function numericView():ControlView {return viewport.numericView();}
|
|
1195
1581
|
function inspectionBinding():InspectionBinding{return {mode:'single',sourceHash:data.sourceHash,rigs:[data.reviewedSource.rig?.sha256??null]};}
|
|
1196
1582
|
// Persist the displayed inspection clock; the runtime clock accumulates across idle loops for physics.
|
|
1197
|
-
function inspectionBookmark():InspectionBookmark {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:selectedInspector()??'
|
|
1198
|
-
async function restoreInspection(bookmark:InspectionBookmark,signal:AbortSignal,preserveSeconds=false):Promise<void> {
|
|
1199
|
-
await restoreTransaction(()=>prepareInspection(bookmark,signal),()=>({bookmark:inspectionBookmark(),inputs:captureInputs()}),()=>applyInspection(bookmark,signal,preserveSeconds),async previous=>{await applyInspection(previous.bookmark,new AbortController().signal);restoreInputs(previous.inputs);renderFeedbackRange();});
|
|
1583
|
+
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}};}
|
|
1584
|
+
async function restoreInspection(bookmark:InspectionBookmark,signal:AbortSignal,preserveSeconds=false,keepCamera=true):Promise<void> {
|
|
1585
|
+
await restoreTransaction(()=>prepareInspection(bookmark,signal),()=>({bookmark:inspectionBookmark(),inputs:captureInputs()}),()=>applyInspection(bookmark,signal,preserveSeconds,keepCamera),async previous=>{await applyInspection(previous.bookmark,new AbortController().signal);restoreInputs(previous.inputs);renderFeedbackRange();});
|
|
1200
1586
|
}
|
|
1201
1587
|
/** Read the SELECTED reference without replacing the currently inspected DOM/player. */
|
|
1202
1588
|
async function inspectionReferenceInfo(id:string|null,signal:AbortSignal):Promise<{width:number;height:number;duration:number|null;people:string[]}> {
|
|
@@ -1208,11 +1594,17 @@ async function inspectionReferenceInfo(id:string|null,signal:AbortSignal):Promis
|
|
|
1208
1594
|
const media=document.createElement('video');media.preload='metadata';media.muted=true;
|
|
1209
1595
|
try{media.src=referenceUrl(reference);await waitReferenceMetadata(media,signal);return {width:media.videoWidth,height:media.videoHeight,duration:media.duration,people:[]};}finally{media.pause();media.removeAttribute('src');media.load();}
|
|
1210
1596
|
}
|
|
1597
|
+
/** One duration bound for validation and carried publication navigation. */
|
|
1598
|
+
function inspectionTimeLimit(bookmark:InspectionBookmark,info:{duration:number|null}):number {
|
|
1599
|
+
const selection=bookmark.selection;
|
|
1600
|
+
const clipDuration=bookmark.animation?assets?.animations.find(a=>a.name===bookmark.animation)?.duration:undefined,referenceId=selection.reference===undefined?select('reference-select').value:selection.reference,isVideo=data.manifest.references.find(r=>r.id===referenceId)?.type==='video';
|
|
1601
|
+
return clipDuration===undefined?info.duration??0:isVideo&&info.duration!==null?Math.min(clipDuration,info.duration):clipDuration;
|
|
1602
|
+
}
|
|
1211
1603
|
async function prepareInspection(bookmark:InspectionBookmark,signal:AbortSignal):Promise<void> {
|
|
1212
1604
|
const selection=bookmark.selection;
|
|
1213
1605
|
if(selection.turn){if(!turnPad)throw new Error('TURN_UNAVAILABLE');turnPad.state.validate(selection.turn);}
|
|
1214
1606
|
parts?.validate(selection.part);
|
|
1215
|
-
if(
|
|
1607
|
+
if(bookmark.animation&&!assets?.animations.some(a=>a.name===bookmark.animation))throw new Error('Saved animation is absent from this rig');
|
|
1216
1608
|
if(selection.reference&&!data.manifest.references.some(r=>r.id===selection.reference))throw new Error('Saved reference is not declared');
|
|
1217
1609
|
if(selection.checkpoint&&!data.manifest.checkpoints.some(c=>c.id===selection.checkpoint))throw new Error('Saved checkpoint is absent');
|
|
1218
1610
|
const axis=selection.axis?data.manifest.axes.find(a=>a.id===selection.axis!.id):null;
|
|
@@ -1221,7 +1613,7 @@ async function prepareInspection(bookmark:InspectionBookmark,signal:AbortSignal)
|
|
|
1221
1613
|
if(bookmark.view.cameras.a||bookmark.view.cameras.b||bookmark.view.cameras.rig&&!player)throw new Error('Saved camera is unavailable in this single review');
|
|
1222
1614
|
const info=await inspectionReferenceInfo(selection.reference===undefined?select('reference-select').value:selection.reference,signal);
|
|
1223
1615
|
if(selection.person&&!info.people.includes(selection.person))throw new Error('Saved pose person is absent');
|
|
1224
|
-
const
|
|
1616
|
+
const limit=inspectionTimeLimit(bookmark,info);
|
|
1225
1617
|
if(bookmark.time!==null&&(bookmark.time<0||bookmark.time>limit&&limit>=0))throw new Error('Saved inspection time is outside the selected clip/reference');
|
|
1226
1618
|
const rig=bookmark.view.cameras.rig,ref=bookmark.view.cameras.reference;
|
|
1227
1619
|
if(rig&&!player)throw new Error('Saved rig camera is unavailable');
|
|
@@ -1230,7 +1622,7 @@ async function prepareInspection(bookmark:InspectionBookmark,signal:AbortSignal)
|
|
|
1230
1622
|
// Range fitting belongs to the transactional apply after that layout is measured.
|
|
1231
1623
|
if(signal.aborted)throw new Error('Inspection restore superseded');
|
|
1232
1624
|
}
|
|
1233
|
-
async function applyInspection(bookmark:InspectionBookmark,signal:AbortSignal,preserveSeconds=false):Promise<void> {
|
|
1625
|
+
async function applyInspection(bookmark:InspectionBookmark,signal:AbortSignal,preserveSeconds=false,keepCamera=true):Promise<void> {
|
|
1234
1626
|
viewport.state.cameraRestoring=true;try{
|
|
1235
1627
|
const selection=bookmark.selection;
|
|
1236
1628
|
if(turnPad){if(selection.turn)turnPad.restore(selection.turn);else{turnPad.state.reset();turnPad.restore(turnPad.snapshot());}}
|
|
@@ -1239,6 +1631,7 @@ async function applyInspection(bookmark:InspectionBookmark,signal:AbortSignal,pr
|
|
|
1239
1631
|
if(selection.checkpoint!==undefined){checkpoint=data.manifest.checkpoints.find(c=>c.id===selection.checkpoint);renderCheckpoint();renderCheckpoints();}
|
|
1240
1632
|
if(selection.reference!==undefined&&select('reference-select').value!==(selection.reference??'')){select('reference-select').value=selection.reference??'';await showReference(selection.reference??'');if(selection.reference&&!referenceSize&& !video)throw new Error('Saved reference did not load');}
|
|
1241
1633
|
if(bookmark.animation&&player)chooseAnimation(bookmark.animation);
|
|
1634
|
+
else if(player){player.clear();animation='';duration=0;time=0;select('animation-select').value='';}
|
|
1242
1635
|
if(selection.axis){select('axis-select').value=selection.axis.id;chooseAxis();input('axis-value').value=String(selection.axis.value);applyAxis();}
|
|
1243
1636
|
if(selection.partSet!==undefined&&player){if(selection.partSet||player.sets().length)player.setSet(selection.partSet||null);select('part-set').value=selection.partSet??'';}
|
|
1244
1637
|
if(bookmark.time!==null){if(video&&video.readyState<1)await waitReferenceMetadata(video,signal);await inspectControlTime(bookmark.time,signal,preserveSeconds);}
|
|
@@ -1253,16 +1646,22 @@ async function applyInspection(bookmark:InspectionBookmark,signal:AbortSignal,pr
|
|
|
1253
1646
|
const camera=bookmark.view.cameras.rig,ref=bookmark.view.cameras.reference,rigViewport=el('rig-viewport'),referenceViewport=el('reference-viewport');
|
|
1254
1647
|
const nextZoom=camera&&player&&rigViewport.clientWidth&&rigViewport.clientHeight?restoredZoom(camera,viewport.state.rigScale/viewport.state.zoom,rigViewport.clientWidth,rigViewport.clientHeight):camera?.zoom??null;
|
|
1255
1648
|
const nextReferenceZoom=ref&&referenceSize&&referenceViewport.clientWidth&&referenceViewport.clientHeight?restoredZoom(ref,viewport.state.referenceScale/viewport.state.referenceZoom,referenceViewport.clientWidth,referenceViewport.clientHeight):ref?.zoom??null;
|
|
1649
|
+
// A job rig subject opens at Fit (#709): the bookmark camera was saved at another window size, so opening requests the Fit instead.
|
|
1650
|
+
if(keepCamera){viewport.cancelFit();
|
|
1256
1651
|
if(nextZoom!==null&&camera){viewport.state.zoom=nextZoom;viewport.state.cameraCenter={...camera.center};}
|
|
1257
|
-
if(nextReferenceZoom!==null&&ref){viewport.state.referenceZoom=nextReferenceZoom;viewport.state.referenceCenter={...ref.center};}
|
|
1652
|
+
if(nextReferenceZoom!==null&&ref){viewport.state.referenceZoom=nextReferenceZoom;viewport.state.referenceCenter={...ref.center};}}
|
|
1258
1653
|
viewport.state.cameraSync=bookmark.view.cameraSync??false;viewport.state.activeCamera=bookmark.view.activeCamera==='reference'?'reference':'rig';
|
|
1259
1654
|
if(player)drawRig(()=>player!.draw());if(selection.part)parts?.assertIdentity(selection.part);fitCamera();redrawOverlay(false);pause();renderTransport();renderCameraControls();
|
|
1260
1655
|
}finally{viewport.state.cameraRestoring=false;}
|
|
1656
|
+
if(!keepCamera){viewport.requestFit();fitCamera();}
|
|
1261
1657
|
}
|
|
1262
1658
|
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});});}
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1659
|
+
let inspectionOpening=false;
|
|
1660
|
+
async function setupPersistence(keepCameraOnResume=false):Promise<boolean> {
|
|
1661
|
+
inspectionOpening=true;try{
|
|
1662
|
+
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)),
|
|
1663
|
+
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();}});
|
|
1664
|
+
}finally{inspectionOpening=false;}
|
|
1266
1665
|
return persistence.restored;
|
|
1267
1666
|
}
|
|
1268
1667
|
/** Setup's Chest regions tool: designation values, an overlay and a two-file client download. Nothing reaches the session's feedback or the package. */
|
|
@@ -1826,7 +2225,7 @@ async function applyPatch(patch:ConfigPatch,world:StageWorld|null=null):Promise<
|
|
|
1826
2225
|
finally{rebuildBusy=false;rebuildState();}
|
|
1827
2226
|
}
|
|
1828
2227
|
/** The client's edit entry point for automation and the edit cards to come: apply a patch, return to the inspected build, read the stage. */
|
|
1829
|
-
(window as unknown as {rigReviewEditor:unknown}).rigReviewEditor={
|
|
2228
|
+
(window as unknown as {rigReviewEditor:unknown}).rigReviewEditor=publicEditor={
|
|
1830
2229
|
applyPatch,reset:()=>resetRebuild(),
|
|
1831
2230
|
/** #166: undo the last Apply, and the applied records as the server holds them. */
|
|
1832
2231
|
undo:()=>undoApply(),history:()=>appliedHistory?JSON.parse(JSON.stringify(appliedHistory)):null,
|
|
@@ -2448,6 +2847,7 @@ void start();
|
|
|
2448
2847
|
|
|
2449
2848
|
/** Only live, unrecorded authoring effects block capture; unsent form ops alone do not. */
|
|
2450
2849
|
function commentCaptureRefusal():string|null {
|
|
2850
|
+
if(rigDifference)return 'RIG_DIFFERENCE_COMMENT_UNAVAILABLE: return to Rig or Reference before adding a comment.';
|
|
2451
2851
|
if(appliedOnStage)return 'COMMENT_APPLIED_BUILD_UNSUPPORTED: return to the inspected source before commenting on this applied scratch build';
|
|
2452
2852
|
if(rebuildBusy)return 'COMMENT_SOURCE_BUSY: wait for the rebuild or candidate model replacement before commenting';
|
|
2453
2853
|
const preview=idleAdjust?'Idle tracks':typeof animAdjust!=='undefined'&&animAdjust?'Keyed animation preview':dialAdjust?'Rig fields turn dial':physicsPreview.read().length?'Physics live overrides':stripPending?'Density strip candidate':
|
|
@@ -2458,15 +2858,15 @@ function commentCaptureRefusal():string|null {
|
|
|
2458
2858
|
return preview?`COMMENT_UNAPPLIED_PREVIEW: ${preview} is active; leave or disable that preview before commenting (nothing is cleared or applied automatically)`:null;
|
|
2459
2859
|
}
|
|
2460
2860
|
function setupComments():void {
|
|
2461
|
-
comments=bindStageComments({toolbar:el('stage-comment').parentElement!,viewports:{rig:el('rig-viewport'),reference:el('reference-viewport')},
|
|
2861
|
+
comments=bindStageComments<CommentRow,CommentPose>({general:host?.record?{create:summary=>({id:crypto.randomUUID(),summary}),matches:row=>!('target' in row)}:undefined,listHost:el('comments-list-host'),toolbar:el('stage-comment').parentElement!,viewports:host?.record&&!host.record.hasPicture?{}:{rig:el('rig-viewport'),reference:el('reference-viewport')},
|
|
2462
2862
|
pose:view=>{
|
|
2463
2863
|
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;
|
|
2464
2864
|
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;
|
|
2465
2865
|
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;
|
|
2466
2866
|
},
|
|
2467
|
-
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:()=>session.feedback,
|
|
2468
|
-
locked:
|
|
2469
|
-
refusal:commentCaptureRefusal,blocked:()=>saving||!!persistence?.restoring()||seekingControl||!!video?.seeking||!!rebuildBusy||!!appliedOnStage,shortcutBlocked:()=>!!meshEditor?.active()
|
|
2867
|
+
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?recordComments:session.feedback,
|
|
2868
|
+
locked:host?.record?()=>false:isSubmittedFeedback,add:f=>{if(host?.record)recordComments.push(f);else session.feedback.push(f as Feedback);},changed:()=>{if(host?.record){recordCommentsChanged();return;}markDirty();renderProposals();persistence?.save();},error:value=>message(value,true),
|
|
2869
|
+
refusal:()=>host?.record&&!host.record.hasPicture?null:commentCaptureRefusal(),blocked:()=>saving||!!persistence?.restoring()||seekingControl||!!video?.seeking||!!rebuildBusy||!!appliedOnStage,shortcutBlocked:()=>!!meshEditor?.active()
|
|
2470
2870
|
});
|
|
2471
2871
|
}
|
|
2472
2872
|
|
|
@@ -2765,3 +3165,9 @@ async function openStageCorrection(request:{part:string;sourceHash:string;buildI
|
|
|
2765
3165
|
redrawOverlay(true);
|
|
2766
3166
|
message(tr('Draft rig · structure evidence only')+tr(` · ${mapping.part} · rig-parts remesh ${request.instrument==='delta'?'--delta':'--mesh'}`));
|
|
2767
3167
|
}
|
|
3168
|
+
|
|
3169
|
+
return {dispose:disposeScreen};
|
|
3170
|
+
}
|
|
3171
|
+
|
|
3172
|
+
// Package entries mount directly; the live host invokes this same composition for each publication.
|
|
3173
|
+
if(!rigHost())mountRigScreen();
|