@rig-c/review 1.4.2 → 1.4.4
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/PANELS.md +6 -0
- package/package.json +1 -1
- package/web/catalog-en.ts +4 -0
- package/web/catalog-ko.ts +4 -0
- package/web/chest-editor.ts +17 -5
- package/web/compare-picked-tools.ts +10 -5
- package/web/i18n.ts +2 -1
- package/web/main.ts +33 -13
- package/web/playback-clock.ts +57 -0
- package/web/rebuild-client.ts +24 -2
package/docs/PANELS.md
CHANGED
|
@@ -30,6 +30,12 @@ body. A drawer keeps its title and close button in place while its body
|
|
|
30
30
|
scrolls. The per-inspection **Repeat idle** toggle sits in the Animate
|
|
31
31
|
transport row.
|
|
32
32
|
|
|
33
|
+
Animate plays in fixed 1/60 s steps taken from wall-clock time
|
|
34
|
+
(`web/playback-clock.ts`), so the clip and its physics advance the same way at
|
|
35
|
+
any display refresh rate; a frame with less than one step's worth of time draws
|
|
36
|
+
nothing new. A repeating clip wraps without a seek, so physics carries across
|
|
37
|
+
the loop seam; only **Reset physics**, a seek or choosing a clip restarts it.
|
|
38
|
+
|
|
33
39
|
**Settings** (`#workspace-settings`) stores workspace-level preferences across
|
|
34
40
|
tabs under `rig-review.workspace.v1` (`web/workspace-preferences.ts`):
|
|
35
41
|
**Appearance** (`system`, `dark`, `light`), **Language** (`system`, `en`, `ko`),
|
package/package.json
CHANGED
package/web/catalog-en.ts
CHANGED
|
@@ -1210,6 +1210,10 @@ export const enCatalog: Readonly<Record<string, string>> = {
|
|
|
1210
1210
|
"REBUILD_FAILED: {0}": "REBUILD_FAILED: {0}",
|
|
1211
1211
|
"REBUILD_INPUTS_CHANGED: {0} changed since the review was opened; restart review": "REBUILD_INPUTS_CHANGED: {0} changed since the review was opened; restart review",
|
|
1212
1212
|
"REBUILD_INPUTS_UNAVAILABLE: the config states no contour mesh": "REBUILD_INPUTS_UNAVAILABLE: the config states no contour mesh",
|
|
1213
|
+
"This rig has no contour mesh. Chest regions and bust motion need the torso built as a contour mesh, which the builder declares in the config. Nothing is wrong with this rig.": "This rig has no contour mesh. Chest regions and bust motion need the torso built as a contour mesh, which the builder declares in the config. Nothing is wrong with this rig.",
|
|
1214
|
+
"The config states {0} meshes, none of them contour: {1}": "The config states {0} meshes, none of them contour: {1}",
|
|
1215
|
+
"The config states no meshes.": "The config states no meshes.",
|
|
1216
|
+
"This part is not a contour mesh, so chest regions and bust motion cannot be rebuilt on it. The builder chooses each part's mesh kind in the config. Nothing is wrong with this rig.": "This part is not a contour mesh, so chest regions and bust motion cannot be rebuilt on it. The builder chooses each part's mesh kind in the config. Nothing is wrong with this rig.",
|
|
1213
1217
|
"REBUILD_PART_AMBIGUOUS: the config states {0} contour meshes and the designated bones name none of them alone": "REBUILD_PART_AMBIGUOUS: the config states {0} contour meshes and the designated bones name none of them alone",
|
|
1214
1218
|
"REBUILD_PART_AMBIGUOUS: the config states {0} contour meshes and the landmark bones name none of them alone": "REBUILD_PART_AMBIGUOUS: the config states {0} contour meshes and the landmark bones name none of them alone",
|
|
1215
1219
|
"REBUILD_REGION_DUPLICATE: {0} (two regions of the chest part carry this name)": "REBUILD_REGION_DUPLICATE: {0} (two regions of the chest part carry this name)",
|
package/web/catalog-ko.ts
CHANGED
|
@@ -1210,6 +1210,10 @@ export const koCatalog: Readonly<Record<string, string>> = {
|
|
|
1210
1210
|
"REBUILD_FAILED: {0}": "REBUILD_FAILED: {0}",
|
|
1211
1211
|
"REBUILD_INPUTS_CHANGED: {0} changed since the review was opened; restart review": "REBUILD_INPUTS_CHANGED: 리뷰를 연 이후 {0}이(가) 변경되었습니다. 리뷰를 재시작하세요",
|
|
1212
1212
|
"REBUILD_INPUTS_UNAVAILABLE: the config states no contour mesh": "REBUILD_INPUTS_UNAVAILABLE: 설정에 선언된 윤곽 메시가 없습니다",
|
|
1213
|
+
"This rig has no contour mesh. Chest regions and bust motion need the torso built as a contour mesh, which the builder declares in the config. Nothing is wrong with this rig.": "이 리그에는 윤곽(contour) 메시가 없습니다. 흉부 영역과 가슴 움직임은 몸통이 윤곽 메시로 만들어져 있어야 하며, 이는 빌더가 설정에서 선언합니다. 이 리그에는 문제가 없습니다.",
|
|
1214
|
+
"The config states {0} meshes, none of them contour: {1}": "설정에 메시 {0}개가 선언되어 있으며 윤곽 메시는 없습니다: {1}",
|
|
1215
|
+
"The config states no meshes.": "설정에 선언된 메시가 없습니다.",
|
|
1216
|
+
"This part is not a contour mesh, so chest regions and bust motion cannot be rebuilt on it. The builder chooses each part's mesh kind in the config. Nothing is wrong with this rig.": "이 파츠는 윤곽(contour) 메시가 아니어서 흉부 영역과 가슴 움직임을 다시 빌드할 수 없습니다. 파츠마다 메시 종류는 빌더가 설정에서 정합니다. 이 리그에는 문제가 없습니다.",
|
|
1213
1217
|
"REBUILD_PART_AMBIGUOUS: the config states {0} contour meshes and the designated bones name none of them alone": "REBUILD_PART_AMBIGUOUS: 설정에 윤곽 메시 {0}개가 선언되어 있으며 지정된 본들이 어느 하나를 단독으로 가리키지 않습니다",
|
|
1214
1218
|
"REBUILD_PART_AMBIGUOUS: the config states {0} contour meshes and the landmark bones name none of them alone": "REBUILD_PART_AMBIGUOUS: 설정에 윤곽 메시 {0}개가 선언되어 있으며 랜드마크 본들이 어느 하나를 단독으로 가리키지 않습니다",
|
|
1215
1219
|
"REBUILD_REGION_DUPLICATE: {0} (two regions of the chest part carry this name)": "REBUILD_REGION_DUPLICATE: {0} (가슴 파트의 영역 둘이 이 이름을 씀)",
|
package/web/chest-editor.ts
CHANGED
|
@@ -221,7 +221,13 @@ export interface ChestEditor {active:()=>boolean;flashing:(side:BustSide)=>boole
|
|
|
221
221
|
/** The current notice text (empty string when none). */
|
|
222
222
|
noticeText:()=>string;
|
|
223
223
|
/** Apply is disabled while a rebuild runs; Reset is enabled while a rebuilt build is on the stage. */
|
|
224
|
-
rebuildState:(state:{busy:boolean;applied:boolean})=>void
|
|
224
|
+
rebuildState:(state:{busy:boolean;applied:boolean})=>void;
|
|
225
|
+
/** #342: the toggle and Apply are disabled before use, naming the reason, when the rig has nothing to rebuild (null re-enables). */
|
|
226
|
+
unavailable:(reason:string|null)=>void}
|
|
227
|
+
|
|
228
|
+
/** The toggle's and Apply's own tooltips, restored when the editor becomes available again (`web/index.html`). */
|
|
229
|
+
const CHEST_EDIT_TITLE='Place the two chest regions on the rig: drag a centre, the core edge or the band';
|
|
230
|
+
const BUST_APPLY_TITLE='Run the installed producer (rig-parts remesh) on these regions or landmarks into a scratch build and load it here; the package is unchanged';
|
|
225
231
|
|
|
226
232
|
export function bindChestEditor(host:ChestEditorHost):ChestEditor {
|
|
227
233
|
const node=<T extends HTMLElement>(id:string)=>document.getElementById(id) as T;
|
|
@@ -229,7 +235,12 @@ export function bindChestEditor(host:ChestEditorHost):ChestEditor {
|
|
|
229
235
|
const field=(id:string)=>document.getElementById(id) as HTMLInputElement|null;
|
|
230
236
|
const read:ChestFieldReader=id=>{const f=field(id);return f?{value:f.value}:undefined;};
|
|
231
237
|
const log=node<HTMLElement>('chest-editor-log'),apply=node<HTMLButtonElement>('bust-apply'),reset=node<HTMLButtonElement>('bust-reset');
|
|
232
|
-
let notice:{text:string;error:boolean}|null=null;
|
|
238
|
+
let notice:{text:string;error:boolean}|null=null,blocked:string|null=null,busy=false;
|
|
239
|
+
/** #342: a disabled control names its reason in its tooltip, the way an unavailable layout does. */
|
|
240
|
+
const gate=()=>{
|
|
241
|
+
for(const [button,title] of [[toggle,CHEST_EDIT_TITLE],[apply,BUST_APPLY_TITLE]] as const){button.title=blocked??title;if(blocked)button.setAttribute('aria-description',blocked);else button.removeAttribute('aria-description');}
|
|
242
|
+
toggle.disabled=!!blocked;apply.disabled=busy||!!blocked;
|
|
243
|
+
};
|
|
233
244
|
const modeInput=field('bust-mode'),landmarkGroups=[...bar.querySelectorAll<HTMLElement>('[data-chest-mode]')],readout=node<HTMLElement>('lm-derived');
|
|
234
245
|
const mode=():ChestMode=>modeInput?.value==='landmarks'?'landmarks':'circles';
|
|
235
246
|
let armed:LandmarkKey|null=null,landmarkDrag:{key:LandmarkKey;pointer:number}|null=null;
|
|
@@ -274,7 +285,7 @@ export function bindChestEditor(host:ChestEditorHost):ChestEditor {
|
|
|
274
285
|
status.textContent=shown.text;status.title=shown.text;status.classList.toggle('error',shown.error);
|
|
275
286
|
};
|
|
276
287
|
const setActive=(on:boolean)=>{active=on;toggle.setAttribute('aria-pressed',String(on));bar.hidden=!on;if(!on){drag=null;landmarkDrag=null;armed=null;delete host.pane.dataset.chestHover;}sync();host.changed();};
|
|
277
|
-
toggle.addEventListener('click',()=>setActive(!active));
|
|
288
|
+
toggle.addEventListener('click',()=>{if(!blocked)setActive(!active);});
|
|
278
289
|
bar.addEventListener('input',event=>{
|
|
279
290
|
const target=event.target as HTMLInputElement,match=/^bust-([rl])-(x|y|r|band)$/.exec(target.id);if(!match)return;
|
|
280
291
|
const value=Number(target.value);if(!target.value.trim()||!Number.isFinite(value))return;
|
|
@@ -305,7 +316,7 @@ export function bindChestEditor(host:ChestEditorHost):ChestEditor {
|
|
|
305
316
|
write(0,right);write(1,mirrorBust(right,{cx:leftX}));sync();host.changed();
|
|
306
317
|
});
|
|
307
318
|
node<HTMLButtonElement>('bust-download').addEventListener('click',()=>host.download());
|
|
308
|
-
apply.addEventListener('click',()=>host.apply());
|
|
319
|
+
apply.addEventListener('click',()=>{if(!blocked)host.apply();});
|
|
309
320
|
reset.addEventListener('click',()=>host.reset());
|
|
310
321
|
const keyDown=(event:KeyboardEvent)=>{if(event.code==='Space'&&!textEntryFocused(event.target))space=true;};
|
|
311
322
|
const keyUp=(event:KeyboardEvent)=>{if(event.code==='Space')space=false;};
|
|
@@ -350,7 +361,8 @@ export function bindChestEditor(host:ChestEditorHost):ChestEditor {
|
|
|
350
361
|
active:()=>active,flashing:side=>flash.has(side),sync,mode,landmarks:()=>readLandmarks(read),armed:()=>{const l=readLandmarks(read);return nextLandmark(armed,'missing' in l?l.missing:[]);},
|
|
351
362
|
notify:(text,error=false,lines)=>{notice=text===null?null:{text,error};if(lines){log.textContent=lines.join('\n');log.hidden=!lines.length;log.scrollTop=log.scrollHeight;}sync();},
|
|
352
363
|
noticeText:()=>notice?.text??'',
|
|
353
|
-
rebuildState:(
|
|
364
|
+
rebuildState:(state)=>{busy=state.busy;apply.setAttribute('aria-busy',String(busy));reset.disabled=busy||!state.applied;gate();},
|
|
365
|
+
unavailable:reason=>{blocked=reason;if(blocked&&active)setActive(false);gate();},
|
|
354
366
|
dispose:()=>{observer.disconnect();host.pane.removeEventListener('pointerdown',down,true);host.pane.removeEventListener('pointermove',move,true);for(const type of ['pointerup','pointercancel','lostpointercapture'] as const)host.pane.removeEventListener(type,end,true);document.removeEventListener('keydown',keyDown,true);window.removeEventListener('keyup',keyUp,true);window.removeEventListener('blur',blur);},
|
|
355
367
|
};
|
|
356
368
|
}
|
|
@@ -44,7 +44,7 @@ import type { RetargetFlags } from '../src/retarget.ts';
|
|
|
44
44
|
import {
|
|
45
45
|
historyRow, isPatchJob, recordFor, refusedText, restoredOutcomeForJob, retargetStage, undoControl,
|
|
46
46
|
animationAppliedRecord, animationOutcomeLine, appliedRecord, deltaAppliedRecord, deltaOutcomeLine, chestSeed, designatedRegions, handoffText,
|
|
47
|
-
landmarksRequest, seedLandmarks, makePatch, outcomeLine, patchAppliedRecord, patchOutcomeLine,
|
|
47
|
+
landmarksRequest, noContourReason, seedLandmarks, makePatch, outcomeLine, patchAppliedRecord, patchOutcomeLine,
|
|
48
48
|
pickBustPart, pickPart, runRebuild, seedFields, stageModel, retargetAppliedRecord, retargetOutcomeLine, stripPendingAfter,
|
|
49
49
|
type AnimationJobView, type AnimationRequestBody, type AppliedHistoryView, type UndoView, type AnyJobView, type AppliedAnimation, type AppliedDelta, type AppliedPatch,
|
|
50
50
|
type AppliedRecord, type AppliedRetarget, type DeltaJobView, type DeltaRequestBody, type ConfigPatch,
|
|
@@ -949,7 +949,11 @@ export function mountComparePickedTools(host: ComparePickedToolsHost): ComparePi
|
|
|
949
949
|
el('chest-regions').dispatchEvent(new Event('input', { bubbles: true }));
|
|
950
950
|
// #315: a config polygon the editor cannot read as an ellipse is named, never shown as an empty row.
|
|
951
951
|
const refused = chestSeed(status).refusals;
|
|
952
|
-
|
|
952
|
+
// #342: a rig with no contour mesh disables the chest tools before use and says why in words about the rig.
|
|
953
|
+
const noContour = noContourReason(status);
|
|
954
|
+
chestEditor?.unavailable(noContour?.text ?? null);
|
|
955
|
+
if (noContour) chestEditor?.notify(noContour.text, false, noContour.lines);
|
|
956
|
+
else if (!status.available) chestEditor?.notify(status.reason, true);
|
|
953
957
|
else if (refused.length) chestEditor?.notify(refused.join(' · '), true, refused);
|
|
954
958
|
else chestEditor?.notify('', false);
|
|
955
959
|
renderHandoff(status);
|
|
@@ -962,6 +966,7 @@ export function mountComparePickedTools(host: ComparePickedToolsHost): ComparePi
|
|
|
962
966
|
meshPanel?.select(currentSlot);
|
|
963
967
|
animationPanel?.loadSource(status.animations ?? null, status.reason);
|
|
964
968
|
} else {
|
|
969
|
+
chestEditor?.unavailable(null);
|
|
965
970
|
animationPanel?.setSourceLoading();
|
|
966
971
|
}
|
|
967
972
|
if (state.requirementsCatalog) {
|
|
@@ -1242,9 +1247,9 @@ export function mountComparePickedTools(host: ComparePickedToolsHost): ComparePi
|
|
|
1242
1247
|
const side = pickedSide, state = sides[side];
|
|
1243
1248
|
const status = state.rebuildStatus ?? await loadRebuildStatus(side);
|
|
1244
1249
|
if (!status || !status.available || !status.inputs) {
|
|
1245
|
-
const reason = status?.reason ?? 'REBUILD_STATUS_UNAVAILABLE';
|
|
1246
|
-
if (pickedSide === side) chestEditor?.notify(reason,
|
|
1247
|
-
host.message(reason,
|
|
1250
|
+
const noContour = status ? noContourReason(status) : null, reason = noContour?.text ?? status?.reason ?? 'REBUILD_STATUS_UNAVAILABLE';
|
|
1251
|
+
if (pickedSide === side) chestEditor?.notify(reason, !noContour, noContour?.lines ?? [reason]);
|
|
1252
|
+
host.message(reason, !noContour);
|
|
1248
1253
|
return;
|
|
1249
1254
|
}
|
|
1250
1255
|
let part: string, body: RebuildRequestBody;
|
package/web/i18n.ts
CHANGED
|
@@ -530,7 +530,8 @@ const textNodeSource = new WeakMap<Node, { en: string; lastApplied: string }>();
|
|
|
530
530
|
const elementHintSource = new WeakMap<Element, { enHtml: string; lastAppliedHtml: string }>();
|
|
531
531
|
const elementAttrSource = new WeakMap<Element, Map<string, { en: string; lastApplied: string }>>();
|
|
532
532
|
|
|
533
|
-
|
|
533
|
+
// #342: `aria-description` carries a disabled control's reason (the chest tools, unavailable layouts), so it follows the language too.
|
|
534
|
+
const TRANSLATED_ATTRS = ['aria-label', 'title', 'placeholder', 'aria-valuetext', 'aria-description'] as const;
|
|
534
535
|
|
|
535
536
|
function normalizeHtmlKey(html: string): string {
|
|
536
537
|
return html.replace(/\s+/g, ' ').trim();
|
package/web/main.ts
CHANGED
|
@@ -27,7 +27,7 @@ import {bindClothPanel,type ClothPanel} from './cloth-panel.ts';
|
|
|
27
27
|
import {animationAppliedRecord,animationOutcomeLine,retargetAppliedRecord,retargetOutcomeLine,stripPendingAfter,type AnimationJobView,type AnimationRequestBody,type AnimationSourceOp,type StageChange,type AppliedAnimation,type AppliedRetarget,type RetargetJobView,type RetargetRequestBody} from './rebuild-client.ts';
|
|
28
28
|
import {bindRetargetPanel,type PoseMap,type RetargetPanel} from './retarget-panel.ts';
|
|
29
29
|
import type {RetargetFlags} from '../src/retarget.ts';
|
|
30
|
-
import {historyRow,isPatchJob,recordFor,refusedText,restoredOutcomeForJob,retargetStage,undoControl,type AppliedHistoryView,type UndoView,type AnyJobView,appliedRecord,deltaAppliedRecord,deltaOutcomeLine,chestSeed,designatedRegions,handoffText,landmarksRequest,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';
|
|
30
|
+
import {historyRow,isPatchJob,recordFor,refusedText,restoredOutcomeForJob,retargetStage,undoControl,type AppliedHistoryView,type UndoView,type AnyJobView,appliedRecord,deltaAppliedRecord,deltaOutcomeLine,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';
|
|
31
31
|
import {meshEditBinding,meshEditText,type MeshEditDocument} from '../src/mesh-edit.ts';
|
|
32
32
|
import {chestRegionsBinding,cropWorldMapping,type CropWorldMapping} from '../src/chest-regions.ts';
|
|
33
33
|
import {bindWorkspaceUI,selectedInspector,type WorkspaceUI} from './workspace-ui.ts';
|
|
@@ -62,6 +62,7 @@ import {appliedBuildOwner,appliedPanelOps,dropNoticeForPanel,reconcilePanelStatu
|
|
|
62
62
|
import {bindPhysicsPanel,type PhysicsPanel} from './physics-panel.ts';
|
|
63
63
|
import {bindIdlePanel,type BoneSetup,type IdlePanel} from './idle-panel.ts';
|
|
64
64
|
import {composeAdjust,PhysicsPreview} from './preview.ts';
|
|
65
|
+
import {advancePlayback,cueDue} from './playback-clock.ts';
|
|
65
66
|
import {bindRigFieldsPanel,type RigFieldsPanel} from './rig-fields-panel.ts';
|
|
66
67
|
import {assertRigFieldOps,RIG_FIELDS_READOUT_BARS,TURN_BONE} from '../src/rig-fields.ts';
|
|
67
68
|
import {IDLE_READOUT_BARS,type LocalChannel} from '../src/idle-tracks.ts';
|
|
@@ -103,6 +104,8 @@ let time = 0;
|
|
|
103
104
|
let stageClock: StageClock | null = null;
|
|
104
105
|
let duration = 0;
|
|
105
106
|
let lastFrame = 0;
|
|
107
|
+
/** #346: wall-clock seconds accumulated toward the next fixed playback step. */
|
|
108
|
+
let playbackCarry = 0;
|
|
106
109
|
type CameraTarget='rig'|'reference';
|
|
107
110
|
let cameraSync=true,activeCamera:CameraTarget='rig',cameraRestoring=false,cameraLayout='';
|
|
108
111
|
const cameraFrames:Partial<Record<CameraTarget,CameraFrame>>={};
|
|
@@ -505,7 +508,7 @@ function chooseAnimation(name: string, move: ClipMove = { kind: 'choose' }): voi
|
|
|
505
508
|
select('animation-select').value = name;
|
|
506
509
|
// #191: the wind restarts before the clip's first frame is drawn, so the paused stage shows the schedule's t=0 world.
|
|
507
510
|
time = 0; clipMoved(move);
|
|
508
|
-
if (player && runtimeAnimation) { drawRig(()=>{player!.play(name,{loop:
|
|
511
|
+
if (player && runtimeAnimation) { drawRig(()=>{player!.play(name,{loop:canRepeatIdle()});player!.pause();refreshAnimationInspection();player!.draw();}); }
|
|
509
512
|
else if (player && name){text('renderer-state',rendererStatus(null,'failed').label);message(`Animation "${name}" is not present in the rig.`, true);}
|
|
510
513
|
renderTransport(); renderCues();renderIdle();
|
|
511
514
|
}
|
|
@@ -519,7 +522,7 @@ function seek(value: number, move?: ClipMove): void {
|
|
|
519
522
|
}
|
|
520
523
|
|
|
521
524
|
function stopAudio(): void { for (const audio of audioPlaying) audio.pause(); audioPlaying.clear(); }
|
|
522
|
-
function pause(): void { ++playbackIntent;desiredPlay=false;suspendedPreview=false;idleHeld=true; playing = false; lastFrame = 0; player?.pause(); video?.pause(); stopAudio(); button('play').textContent = '▶'; button('play').setAttribute('aria-label', 'Play'); }
|
|
525
|
+
function pause(): void { ++playbackIntent;desiredPlay=false;suspendedPreview=false;idleHeld=true; playing = false; lastFrame = 0; playbackCarry = 0; player?.pause(); video?.pause(); stopAudio(); button('play').textContent = '▶'; button('play').setAttribute('aria-label', 'Play'); }
|
|
523
526
|
|
|
524
527
|
async function audition(clipId: string): Promise<void> {
|
|
525
528
|
const clip = data.manifest.audio.clips.find(item => item.id === clipId); if (!clip) return;
|
|
@@ -646,11 +649,16 @@ function seekReading(clip: string, frame: number, exact: number | null, label: s
|
|
|
646
649
|
function tick(now: number): void {
|
|
647
650
|
if (playing) {
|
|
648
651
|
const dt = lastFrame ? Math.min((now - lastFrame) / 1000, .1) : 0;
|
|
649
|
-
|
|
650
|
-
|
|
652
|
+
// #346: fixed PLAYBACK_STEP steps from wall-clock time; a repeating clip wraps here with no seek, so physics carries across the loop.
|
|
653
|
+
const previous = time, next = advancePlayback({ time, duration, carry: playbackCarry, elapsed: dt, repeat: canRepeatIdle() && !idleHeld });
|
|
654
|
+
playbackCarry = next.carry; time = next.time;
|
|
655
|
+
const stepped = next.steps.reduce((sum, step) => sum + step, 0);
|
|
656
|
+
// The wrap does what the replaced seek(0) did besides the player: restart the wind clock and re-hold the reference at the wrapped time.
|
|
657
|
+
if (next.wrapped) { stopAudio(); clipMoved({ kind: 'replay' }); if (video) { if (video.readyState >= 1) holdVideoReference(video, referenceGeneration); void video.play().catch(error => { pause(); message(errorText(error), true); }); } }
|
|
658
|
+
if (player && player.current && next.steps.length) { try { stepEnvironment(stepped); drawRig(()=>{ for (const step of next.steps) player!.advance(step); player!.draw(); }); } catch (error) { pause(); message(errorText(error), true); } }
|
|
651
659
|
if (video && video.readyState >= 1 && time > video.duration) { if (referenceInput.state !== 'out-of-domain') holdVideoReference(video, referenceGeneration); } else if (video && referenceInput.state === 'loaded' && Math.abs(video.currentTime - time) > .15) video.currentTime = time;
|
|
652
|
-
if (input('sync-audio').checked) for (const cue of activeCues()) if ((
|
|
653
|
-
renderSequenceFrame(); renderTransport(); if
|
|
660
|
+
if (input('sync-audio').checked) for (const cue of activeCues()) if (cueDue(cue.time, previous, next, duration)) void audition(cue.clip);
|
|
661
|
+
renderSequenceFrame(); renderTransport(); if (next.ended) pause(); lastFrame = now;
|
|
654
662
|
}
|
|
655
663
|
requestAnimationFrame(tick);
|
|
656
664
|
}
|
|
@@ -700,7 +708,7 @@ async function initPlayer(initialCheckpoint?:Checkpoint): Promise<void> {
|
|
|
700
708
|
function chooseAxis(): void {
|
|
701
709
|
const axis = data.manifest.axes.find(item => item.id === select('axis-select').value);
|
|
702
710
|
const clip = assets?.animations.find(item => item.name === axis?.animation); if (!axis || !clip || !player) return;
|
|
703
|
-
pause(); chooseAnimation(clip.name); axisInspection = true; el('angle-panel').hidden = false;
|
|
711
|
+
pause(); chooseAnimation(clip.name); axisInspection = true; syncPlayerLoop(); el('angle-panel').hidden = false;
|
|
704
712
|
input('axis-value').min = String(axis.min); input('axis-value').max = String(axis.max); input('axis-value').step = String((axis.max - axis.min) / 200); input('axis-value').value = String((axis.max + axis.min) / 2); text('axis-label', axis.label); applyAxis();
|
|
705
713
|
}
|
|
706
714
|
|
|
@@ -963,7 +971,7 @@ function bind(): void {
|
|
|
963
971
|
for(const target of ['rig','reference'] as const)viewDisposers.push(bindPan(el(target+'-viewport'),(dx,dy)=>cameraAction(()=>panCamera(target,dx,dy)),()=>!comments?.active(),target==='rig'?carryRig:undefined));
|
|
964
972
|
for(const [id,key] of [['layer-images','images'],['layer-mesh','mesh'],['layer-bones','bones']] as const)input(id).onchange=()=>{layers[key]=input(id).checked;redrawOverlay(false);};
|
|
965
973
|
viewDisposers.push(bindLayerShortcuts(document));describeLayerToggles(document,el('layer-state').textContent??'');
|
|
966
|
-
input('idle-repeat').onchange=()=>{renderIdle();if(canRepeatIdle())void playPreview();};
|
|
974
|
+
input('idle-repeat').onchange=()=>{syncPlayerLoop();renderIdle();if(canRepeatIdle())void playPreview();};
|
|
967
975
|
bindEnvironment();
|
|
968
976
|
for(const id of ['proposal-panel','checkpoint-detail'])el(id).addEventListener('focusin',pause);
|
|
969
977
|
bindInspector();bindReviewDialog();
|
|
@@ -1029,11 +1037,21 @@ function redrawOverlay(fresh:boolean):void {
|
|
|
1029
1037
|
lastOverlay=value;
|
|
1030
1038
|
text('layer-state',value.warnings.join(' · ')||'Actual last-drawn mesh edges / bone points');idlePanel?.place(duration);rigFieldsPanel?.place();if(!fresh&&value.needsCapture&&!playing&&!seekingControl)drawRig(()=>player!.draw());
|
|
1031
1039
|
}
|
|
1040
|
+
/**
|
|
1041
|
+
* #346: the player loops exactly when Animate repeats, so a repeating clip wraps inside the track and its physics
|
|
1042
|
+
* carries across the seam. Changing the mode reopens the track at the current time, as a seek does.
|
|
1043
|
+
*/
|
|
1044
|
+
function syncPlayerLoop():void {
|
|
1045
|
+
const want=canRepeatIdle();
|
|
1046
|
+
if(!player?.current||player.composed||player.entry(0)?.loop===want)return;
|
|
1047
|
+
try{drawRig(()=>{player!.play(animation,{loop:want});if(!playing)player!.pause();player!.seek(time);player!.draw();});}
|
|
1048
|
+
catch(error){message(errorText(error),true);}
|
|
1049
|
+
}
|
|
1032
1050
|
function canRepeatIdle():boolean{return !!player&&idleAvailable(assets?.animations.map(a=>a.name)??[],animation)&&!axisInspection&&input('idle-repeat').checked&&duration>0;}
|
|
1033
1051
|
function renderIdle():void {text('idle-state',canRepeatIdle()?'Actual idle · repeat enabled':animation==='idle'?'Idle repeat paused':'Non-idle inspection · no automatic playback');}
|
|
1034
1052
|
async function playPreview():Promise<void> {
|
|
1035
1053
|
if((!player&&!video&&!sequence)||duration<=0)return;
|
|
1036
|
-
const intent=++playbackIntent;desiredPlay=true;idleHeld=false;if(time>=duration)seek(0,{kind:'replay'});
|
|
1054
|
+
const intent=++playbackIntent;desiredPlay=true;idleHeld=false;syncPlayerLoop();if(time>=duration)seek(0,{kind:'replay'});
|
|
1037
1055
|
if(video&&referenceInput.state==='loaded'){try{await video.play();}catch(error){pause();message(`Playback is paused: ${errorText(error)}. Use Play to retry.`,true);return;}}
|
|
1038
1056
|
if(intent!==playbackIntent||!desiredPlay){if(!desiredPlay)video?.pause();return;}playing=true;lastFrame=0;player?.resume();button('play').textContent='Ⅱ';button('play').setAttribute('aria-label','Pause');
|
|
1039
1057
|
}
|
|
@@ -1242,7 +1260,7 @@ async function exportChest():Promise<void> {
|
|
|
1242
1260
|
const environmentInputs=['wind-base','wind-breeze','wind-gust','wind-repeat','wind-gust-peak','wind-gust-duration','gravity','jolt','physics-reset','environment-use','environment-export','environment-check'];
|
|
1243
1261
|
function environmentApplied():boolean{return input('environment-applied').checked;}
|
|
1244
1262
|
function gravityValue():number{return Number(input('gravity').value);}
|
|
1245
|
-
/** Called from `tick` right before
|
|
1263
|
+
/** Called from `tick` right before the fixed playback steps (#346): the gust clock is the stepped time, so a paused player freezes it. */
|
|
1246
1264
|
function stepEnvironment(dt:number):void {
|
|
1247
1265
|
if(!player)return;
|
|
1248
1266
|
wind.advance(dt);
|
|
@@ -1465,7 +1483,9 @@ async function loadRebuildStatus():Promise<RebuildStatusView|null> {
|
|
|
1465
1483
|
if(Object.keys(seed).length){for(const [id,value] of Object.entries(seed)){const node=document.getElementById(id) as HTMLInputElement|HTMLSelectElement|HTMLTextAreaElement|null;if(!node)continue;if(node instanceof HTMLInputElement&&node.type==='checkbox')node.checked=value==='true';else node.value=value;}el('chest-regions').dispatchEvent(new Event('input',{bubbles:true}));}
|
|
1466
1484
|
// #315: a config polygon the editor cannot read as an ellipse is named, never shown as an empty row.
|
|
1467
1485
|
const refused=chestSeed(rebuildStatus).refusals;if(refused.length)chestEditor?.notify(refused.join(' · '),true,refused);
|
|
1468
|
-
|
|
1486
|
+
// #342: a rig with no contour mesh disables the chest tools before use and says why in words about the rig.
|
|
1487
|
+
const noContour=noContourReason(rebuildStatus);chestEditor?.unavailable(noContour?.text??null);
|
|
1488
|
+
if(noContour)chestEditor?.notify(noContour.text,false,noContour.lines);else if(!rebuildStatus.available)chestEditor?.notify(rebuildStatus.reason,!rebuildStatus.viewOnly);
|
|
1469
1489
|
renderHandoff(rebuildStatus);refreshPhysics();
|
|
1470
1490
|
retargetPanel?.load(rebuildStatus.retarget??null,rebuildStatus.reason);
|
|
1471
1491
|
bonesPanel?.load(rebuildStatus.inputs?rebuildStatus.bones??[]:null,rebuildStatus.inputs?null:rebuildStatus.reason??'BONES_UNAVAILABLE: no producer handoff');
|
|
@@ -1634,7 +1654,7 @@ async function applyRebuild():Promise<void> {
|
|
|
1634
1654
|
if(rebuildBusy)return;
|
|
1635
1655
|
if(readOnly){chestEditor?.notify(readOnly,true);return;}
|
|
1636
1656
|
const status=rebuildStatus??await loadRebuildStatus();
|
|
1637
|
-
if(!status||!status.available||!status.inputs){const reason=status?.reason??'REBUILD_STATUS_UNAVAILABLE';chestEditor?.notify(reason,
|
|
1657
|
+
if(!status||!status.available||!status.inputs){const noContour=status?noContourReason(status):null,reason=noContour?.text??status?.reason??'REBUILD_STATUS_UNAVAILABLE';chestEditor?.notify(reason,!noContour,noContour?.lines??[reason]);message(reason,!noContour);return;}
|
|
1638
1658
|
let part:string,body:RebuildRequestBody;const lines:string[]=[];
|
|
1639
1659
|
if(chestEditor?.mode()==='landmarks'){
|
|
1640
1660
|
// #105: refused here, before anything is sent, when a point is missing or the circles would not clear.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* #346: Animate's playback clock. Wall-clock time is accumulated and the clip and its physics advance in fixed
|
|
3
|
+
* `PLAYBACK_STEP` steps, so the integrated physics does not depend on the display's refresh rate. A repeating clip
|
|
4
|
+
* wraps its own time here; the player is opened with `loop: true` and is never re-seeked at the wrap, so physics
|
|
5
|
+
* state carries across the loop seam. Only an explicit reset or a seek restarts physics.
|
|
6
|
+
*/
|
|
7
|
+
export const PLAYBACK_STEP = 1 / 60;
|
|
8
|
+
/** A step this close to whole counts as whole, so float residue in the accumulator never drops a step. */
|
|
9
|
+
const STEP_SLACK = 1e-9;
|
|
10
|
+
|
|
11
|
+
export interface PlaybackInput {
|
|
12
|
+
/** The clip time before this frame, in seconds. */
|
|
13
|
+
time: number;
|
|
14
|
+
duration: number;
|
|
15
|
+
/** Wall-clock seconds accumulated but not yet stepped, carried from the previous frame. */
|
|
16
|
+
carry: number;
|
|
17
|
+
/** Wall-clock seconds since the previous frame. */
|
|
18
|
+
elapsed: number;
|
|
19
|
+
repeat: boolean;
|
|
20
|
+
step?: number;
|
|
21
|
+
}
|
|
22
|
+
export interface PlaybackAdvance {
|
|
23
|
+
/** The player steps to take, in order. Each is `step`, except a shorter last step that lands exactly on a non-repeating clip's end. */
|
|
24
|
+
steps: number[];
|
|
25
|
+
time: number;
|
|
26
|
+
carry: number;
|
|
27
|
+
/** The clip wrapped at least once this frame (repeating clips only). */
|
|
28
|
+
wrapped: boolean;
|
|
29
|
+
/** A non-repeating clip reached its end this frame. */
|
|
30
|
+
ended: boolean;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function advancePlayback(input: PlaybackInput): PlaybackAdvance {
|
|
34
|
+
const step = input.step ?? PLAYBACK_STEP, duration = input.duration, steps: number[] = [];
|
|
35
|
+
let time = input.time, carry = input.carry + Math.max(0, input.elapsed), wrapped = false, ended = false;
|
|
36
|
+
if (!(duration > 0)) return { steps, time, carry: 0, wrapped, ended };
|
|
37
|
+
while (carry >= step - STEP_SLACK) {
|
|
38
|
+
if (!input.repeat && time + step >= duration) {
|
|
39
|
+
const last = duration - time;
|
|
40
|
+
if (last > 0) steps.push(last);
|
|
41
|
+
time = duration; carry = 0; ended = true;
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
steps.push(step); carry = Math.max(0, carry - step); time += step;
|
|
45
|
+
if (input.repeat) while (time >= duration) { time -= duration; wrapped = true; }
|
|
46
|
+
}
|
|
47
|
+
return { steps, time, carry, wrapped, ended };
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Whether an audio cue at `at` seconds falls in the interval this frame played. On a wrap that is
|
|
52
|
+
* (previous, duration] and then [0, time], so a cue just before the clip's end still sounds.
|
|
53
|
+
*/
|
|
54
|
+
export function cueDue(at: number, previous: number, next: PlaybackAdvance, duration: number): boolean {
|
|
55
|
+
if (next.wrapped) return (previous < at && at <= duration) || at <= next.time;
|
|
56
|
+
return (previous < at && at <= next.time) || (previous === 0 && at === 0 && next.steps.length > 0);
|
|
57
|
+
}
|
package/web/rebuild-client.ts
CHANGED
|
@@ -8,7 +8,7 @@ import {deriveBust,parseBustSpec,type BustSpec} from '../src/chest-landmarks.ts'
|
|
|
8
8
|
import {CONFIG_PATCH_SCHEMA,type ConfigPatch,type PatchCmd,type PatchOp} from '../src/config-patch.ts';
|
|
9
9
|
import {APPLIED_ANIMATION_SCHEMA,APPLIED_DELTA_SCHEMA,APPLIED_PATCH_SCHEMA,APPLIED_RETARGET_SCHEMA,filesDiffText,type AppliedAnimation,type AppliedAssembled,type AppliedDelta,type AppliedPatch,type AppliedRetarget,type CheckSummary,type FilesDiff} from '../src/applied-context.ts';
|
|
10
10
|
import {appliedBuildOwner,type RestoredPanelOutcome} from '../src/applied-blocks.ts';
|
|
11
|
-
import {meshApplyOutcome} from '../src/mesh-entry.ts';
|
|
11
|
+
import {meshApplyOutcome,meshMode} from '../src/mesh-entry.ts';
|
|
12
12
|
import type {AnimationSourceOp} from '../src/animation-ops.ts';
|
|
13
13
|
import type {MotionSummary,RetargetFlags,RetargetLine,RetargetRecord} from '../src/retarget.ts';
|
|
14
14
|
export type {ConfigPatch,PatchOp,AppliedPatch,AppliedDelta,AppliedRetarget,AppliedAnimation,AnimationSourceOp,CheckSummary,BustSpec};
|
|
@@ -306,9 +306,31 @@ export function patchOutcomeLine(result:PatchJobView|RebuildRefusal):{text:strin
|
|
|
306
306
|
const wall=building?`${result.reused?'reused the scratch build of this exact patch · ':''}${propose}build ${seconds(result.op==='cloth'?result.cloth?.wallMs.build??null:result.wallMs.op)} (assemble → rig → check) + compile ${seconds(result.wallMs.compile)}`:result.reused?'reused the scratch build of this exact patch':`${propose}${result.op==='cloth'?'rig':result.op??result.request.patch.op.cmd} ${seconds(result.op==='cloth'?result.cloth?.wallMs.build??null:result.wallMs.op)} + compile ${seconds(result.wallMs.compile)}${result.check?.source==='retune'||result.check?.source==='remesh'?'':` + check ${seconds(result.wallMs.check)}`}`;
|
|
307
307
|
return {text:`Applied patch ${result.request.patchSha256.slice(0,12)}… (${result.request.patch.ops.length} op(s)) with ${result.producer.package} ${result.producer.version} · ${wall} · ${check}${result.environment?` under the exported world (${result.environment.steps} step(s), sha256 ${result.environment.sha256.slice(0,16)})`:''} · ${result.files?filesDiffText(result.files):`rig.json differs at ${result.diff?.count??'?'} path(s)`} · Reset returns to the inspected build`,error:!!result.check&&result.check.pass!==true};
|
|
308
308
|
}
|
|
309
|
+
/** The server's code when the config states no contour mesh (`src/rebuild.ts`); kept on the notice's last line for the record. */
|
|
310
|
+
export const NO_CONTOUR_CODE='REBUILD_INPUTS_UNAVAILABLE: the config states no contour mesh';
|
|
311
|
+
/**
|
|
312
|
+
* #342: why the chest tools cannot rebuild this rig, in words about the rig, or null when they can. A config with no
|
|
313
|
+
* contour mesh is a valid handoff (`src/rebuild.ts`); the chest regions and `contour.bust` simply have no part to
|
|
314
|
+
* target. The mesh kinds the config does state are counted from the config, never written into the text.
|
|
315
|
+
*/
|
|
316
|
+
export function noContourReason(status:Pick<RebuildStatusView,'inputs'|'parts'>&{meshes?:Record<string,unknown>}):{text:string;lines:string[]}|null {
|
|
317
|
+
if(!status.inputs||status.parts.length)return null;
|
|
318
|
+
const kinds=new Map<string,number>();
|
|
319
|
+
for(const [part,entry] of Object.entries(status.meshes??{})){const m=meshMode(entry,part),kind='mode' in m?m.mode:'unreadable';kinds.set(kind,(kinds.get(kind)??0)+1);}
|
|
320
|
+
const total=[...kinds.values()].reduce((a,b)=>a+b,0);
|
|
321
|
+
const lines=['This rig has no contour mesh. Chest regions and bust motion need the torso built as a contour mesh, which the builder declares in the config. Nothing is wrong with this rig.',
|
|
322
|
+
total?`The config states ${total} meshes, none of them contour: ${[...kinds].map(([kind,n])=>`${n} ${kind}`).join(', ')}`:'The config states no meshes.',
|
|
323
|
+
NO_CONTOUR_CODE];
|
|
324
|
+
return {text:lines.join('\n'),lines};
|
|
325
|
+
}
|
|
326
|
+
/** #342: a refusal a reviewer reads; REBUILD_PART_NOT_CONTOUR gets a statement about the rig first and keeps its line below. */
|
|
327
|
+
export function reviewerRefusal(text:string):string {
|
|
328
|
+
if(!text.startsWith('REBUILD_PART_NOT_CONTOUR:'))return text;
|
|
329
|
+
return ["This part is not a contour mesh, so chest regions and bust motion cannot be rebuilt on it. The builder chooses each part's mesh kind in the config. Nothing is wrong with this rig.",text].join('\n');
|
|
330
|
+
}
|
|
309
331
|
/** The status line after a job: built (with the wall clock and whether the scratch build was reused) or the producer's line verbatim. */
|
|
310
332
|
export function outcomeLine(result:RebuildJobView|RebuildRefusal):{text:string;error:boolean} {
|
|
311
|
-
if(!('id' in result))return {text:result.producerLine??result.error,error:true};
|
|
333
|
+
if(!('id' in result))return {text:reviewerRefusal(result.producerLine??result.error),error:true};
|
|
312
334
|
if(result.status!=='built')return {text:refusedText(result),error:true};
|
|
313
335
|
const wall=[result.wallMs.remesh,result.wallMs.compile].every(v=>v!==null)?` · remesh ${(result.wallMs.remesh!/1000).toFixed(1)} s + compile ${(result.wallMs.compile!/1000).toFixed(1)} s`:'';
|
|
314
336
|
return {text:`Applied ${result.request.part} with ${result.producer.package} ${result.producer.version}${result.reused?' · reused the scratch build of this exact designation':wall} · Reset returns to the inspected build`,error:false};
|