rig-review 1.4.1 → 1.4.3

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.
@@ -589,7 +589,7 @@ Browser players retain play's default DOM mode and default mesh backend. Rigid
589
589
  parts remain DOM images; a WebGL mesh label does not claim full-frame GL drawing.
590
590
  WebGL is requested by the published default, with Canvas2D as the supported mesh
591
591
  fallback. Accurate public actual-flush telemetry requires play 1.11.1 or later;
592
- this checkout consumes pinned 1.22.2. The consumer does not probe GL or inspect
592
+ this checkout consumes pinned 1.22.3. The consumer does not probe GL or inspect
593
593
  private renderer state. The separate Node strip exporter remains Canvas2D.
594
594
 
595
595
  The backend badge is sampled only after successful draw/frame calls. Fresh mesh
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rig-review",
3
- "version": "1.4.1",
3
+ "version": "1.4.3",
4
4
  "type": "module",
5
5
  "description": "Local human rig inspection and structured feedback export",
6
6
  "license": "MIT",
@@ -19,7 +19,7 @@
19
19
  },
20
20
  "dependencies": {
21
21
  "@napi-rs/canvas": "1.0.11",
22
- "@rig-c/play": "1.22.2"
22
+ "@rig-c/play": "1.22.3"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/bun": "^1.3.0",
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} (가슴 파트의 영역 둘이 이 이름을 씀)",
@@ -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:({busy,applied})=>{apply.disabled=busy;apply.setAttribute('aria-busy',String(busy));reset.disabled=busy||!applied;},
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
- if (!status.available) chestEditor?.notify(status.reason, true);
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, true, [reason]);
1247
- host.message(reason, true);
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
- const TRANSLATED_ATTRS = ['aria-label', 'title', 'placeholder', 'aria-valuetext'] as const;
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';
@@ -1465,7 +1465,9 @@ async function loadRebuildStatus():Promise<RebuildStatusView|null> {
1465
1465
  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
1466
  // #315: a config polygon the editor cannot read as an ellipse is named, never shown as an empty row.
1467
1467
  const refused=chestSeed(rebuildStatus).refusals;if(refused.length)chestEditor?.notify(refused.join(' · '),true,refused);
1468
- if(!rebuildStatus.available)chestEditor?.notify(rebuildStatus.reason,!rebuildStatus.viewOnly);
1468
+ // #342: a rig with no contour mesh disables the chest tools before use and says why in words about the rig.
1469
+ const noContour=noContourReason(rebuildStatus);chestEditor?.unavailable(noContour?.text??null);
1470
+ if(noContour)chestEditor?.notify(noContour.text,false,noContour.lines);else if(!rebuildStatus.available)chestEditor?.notify(rebuildStatus.reason,!rebuildStatus.viewOnly);
1469
1471
  renderHandoff(rebuildStatus);refreshPhysics();
1470
1472
  retargetPanel?.load(rebuildStatus.retarget??null,rebuildStatus.reason);
1471
1473
  bonesPanel?.load(rebuildStatus.inputs?rebuildStatus.bones??[]:null,rebuildStatus.inputs?null:rebuildStatus.reason??'BONES_UNAVAILABLE: no producer handoff');
@@ -1634,7 +1636,7 @@ async function applyRebuild():Promise<void> {
1634
1636
  if(rebuildBusy)return;
1635
1637
  if(readOnly){chestEditor?.notify(readOnly,true);return;}
1636
1638
  const status=rebuildStatus??await loadRebuildStatus();
1637
- if(!status||!status.available||!status.inputs){const reason=status?.reason??'REBUILD_STATUS_UNAVAILABLE';chestEditor?.notify(reason,true,[reason]);message(reason,true);return;}
1639
+ 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
1640
  let part:string,body:RebuildRequestBody;const lines:string[]=[];
1639
1641
  if(chestEditor?.mode()==='landmarks'){
1640
1642
  // #105: refused here, before anything is sent, when a point is missing or the circles would not clear.
@@ -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};