@rig-c/review 1.5.3 → 1.5.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 CHANGED
@@ -35,6 +35,8 @@ Animate plays in fixed 1/60 s steps taken from wall-clock time
35
35
  any display refresh rate; a frame with less than one step's worth of time draws
36
36
  nothing new. A repeating clip wraps without a seek, so physics carries across
37
37
  the loop seam; only **Reset physics**, a seek or choosing a clip restarts it.
38
+ While paused, physics continues in fixed `PLAYBACK_STEP` (1/60 s) steps,
39
+ independent of display refresh.
38
40
 
39
41
  **Settings** (`#workspace-settings`) stores workspace-level preferences across
40
42
  tabs under `rig-review.workspace.v1` (`web/workspace-preferences.ts`):
@@ -261,7 +263,7 @@ The pinned published `@rig-c/play`1.14.0 supplies `slotIdentity()` and frame gen
261
263
 
262
264
  Source-bound links/drafts and explicit feedback preserve that side/slot plus exact attachment/owning skin/set/active skin/null reason. A restored explicit target is checked after restoring its animation/time/set and drawing; `PART_IDENTITY_MISMATCH` rolls back rather than silently substituting another key. Older slot-only links remain readable and resolve from the current authoritative snapshot. Runtime generation is current observation/feedback evidence, never a persistent identity. Named vertex weights and original source alpha remain unavailable in this inspection; packed pages are not original part images.
263
265
 
264
- **A drag on the rig view moves the physics.** A plain drag on the rig pane pans the camera and, on the same move, tells the rig's player it was carried, so hair and cloth trail the way they do in the Family viewer (rig-c/examples `family/viewer/index.html`, whose tuning this takes as written): each pointer move of `dx`, `dy` page px at root scale `s` calls `player.moved({x: clamp(dx/s × 0.25, ±8), y: clamp(−dy/s × 0.25, ±6)})`. A press is a click until it travels more than 3 px from where it went down (`CLICK_SLOP_PX` in `web/stage-pick.ts`, the one line both the pick and the drag read); a click selects a part as below and moves nothing, and a press that once passed the line is a drag even if it is released where it started. The first impulse carries the whole travel since the press. A press made with **Space** held pans only, a press an editor handle or comment mode takes is unchanged, and the reference pane pans without an impulse. On the compare page a drag on either build carries both, each by its own root scale, so A and B take the same stimulus. `player.moved` applies on the player's next step, so on a paused rig nothing swings until it steps. It is inspection only: nothing is recorded in drafts, feedback or exports. The earlier **Drag to trail** toggle, which moved the physics with the camera held, is retired (#331): the default drag covers it and **Jolt** gives an impulse without moving the camera.
266
+ **A drag on the rig view moves the physics.** A plain drag on the rig pane pans the camera and, on the same move, tells the rig's player it was carried, so hair and cloth trail the way they do in the Family viewer (rig-c/examples `family/viewer/index.html`, whose tuning this takes as written): each pointer move of `dx`, `dy` page px at root scale `s` calls `player.moved({x: clamp(dx/s × 0.25, ±8), y: clamp(−dy/s × 0.25, ±6)})`. A press is a click until it travels more than 3 px from where it went down (`CLICK_SLOP_PX` in `web/stage-pick.ts`, the one line both the pick and the drag read); a click selects a part as below and moves nothing, and a press that once passed the line is a drag even if it is released where it started. The first impulse carries the whole travel since the press. A press made with **Space** held pans only, a press an editor handle or comment mode takes is unchanged, and the reference pane pans without an impulse. On the compare page a drag on either build carries both, each by its own root scale, so A and B take the same stimulus. `player.moved` applies on the player's next step, so dragging a paused rig in single-review Animate swings its physics on the continuing held steps. It is inspection only: nothing is recorded in drafts, feedback or exports. The earlier **Drag to trail** toggle, which moved the physics with the camera held, is retired (#331): the default drag covers it and **Jolt** gives an impulse without moving the camera.
265
267
 
266
268
  **Hover preview on the stage.** In **Animate**, where a click on drawn part geometry selects its slot, resting the mouse over the rig view previews that click: the part a click at that point would select gets a solid white outline (dark halo) over a faint light tint, and its slot name sits beside the pointer. It is distinct from the selection's dashed amber box. The preview and the click are one hit test (`web/stage-pick.ts` `pickAt`: the held drawn primitives with their resolved clip, the last drawn on top, only a slot the inspection lists); where a click would select nothing — empty stage, Setup, a button or handle under the pointer, Space held — nothing is shown. It is hidden while a button is pressed (a pan or a drag), while comment mode or an editor handle owns the press, and when the pointer leaves the view. It repaints only when what it would draw changes, so a still pointer over a paused rig paints nothing. Touch and keyboard show no preview, and tap and keyboard selection are unchanged. On the compare page it follows the picked build's own rig. The preview is never recorded: sessions, drafts, feedback and exports are unchanged.
267
269
 
@@ -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.3. The consumer does not probe GL or inspect
592
+ this checkout consumes pinned 1.23.0. 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-c/review",
3
- "version": "1.5.3",
3
+ "version": "1.5.4",
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.3"
22
+ "@rig-c/play": "1.23.0"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/bun": "^1.3.0",
package/web/main.ts CHANGED
@@ -101,6 +101,7 @@ let assets: ModelAssets | null = null;
101
101
  let player: RigPlayer | null = null;
102
102
  let animation = '';
103
103
  let playing = false;
104
+ let heldPhysicsFailed = false;
104
105
  let time = 0;
105
106
  /** The clock a scratch build on the stage states for its own animation (a retarget's report frameTimes, #164). */
106
107
  let stageClock: StageClock | null = null;
@@ -524,7 +525,7 @@ function seek(value: number, move?: ClipMove): void {
524
525
  }
525
526
 
526
527
  function stopAudio(): void { for (const audio of audioPlaying) audio.pause(); audioPlaying.clear(); }
527
- 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'); }
528
+ function pause(): void { ++playbackIntent;desiredPlay=false;suspendedPreview=false;idleHeld=true; heldPhysicsFailed=false; playing = false; lastFrame = 0; playbackCarry = 0; player?.hold(true); player?.resume(); video?.pause(); stopAudio(); button('play').textContent = '▶'; button('play').setAttribute('aria-label', 'Play'); }
528
529
 
529
530
  async function audition(clipId: string): Promise<void> {
530
531
  const clip = data.manifest.audio.clips.find(item => item.id === clipId); if (!clip) return;
@@ -651,9 +652,23 @@ function seekReading(clip: string, frame: number, exact: number | null, label: s
651
652
  function tick(now: number): void {
652
653
  // #356: the scrub box is read before this frame writes anything (a read after the writes forces a layout).
653
654
  if (playing) try { holdScrubBox(input('scrub')); tickPlaying(now); } finally { releaseScrubBox(); }
655
+ else tickHeldPhysics(now);
654
656
  requestAnimationFrame(tick);
655
657
  }
656
658
 
659
+ /** Animate steps held physics under the standing environment; wind time and queued jolts stay frozen. */
660
+ function tickHeldPhysics(now:number):void {
661
+ const elapsed=lastFrame?Math.min((now-lastFrame)/1000,.1):0;lastFrame=now;
662
+ if(heldPhysicsFailed||!player?.current||document.hidden||selectedInspector(document)!=='playback'||seekingControl){playbackCarry=0;return;}
663
+ const next=advancePlayback({time,duration,carry:playbackCarry,elapsed,repeat:false,held:true});
664
+ playbackCarry=next.carry;
665
+ if(!next.steps.length)return;
666
+ try{
667
+ player.hold(true);player.resume();
668
+ drawRig(()=>{for(const step of next.steps)player!.advance(step);player!.draw();});
669
+ }catch(error){heldPhysicsFailed=true;player.pause();playbackCarry=0;message(errorText(error),true);}
670
+ }
671
+
657
672
  function tickPlaying(now: number): void {
658
673
  const dt = lastFrame ? Math.min((now - lastFrame) / 1000, .1) : 0;
659
674
  // #346: fixed PLAYBACK_STEP steps from wall-clock time; a repeating clip wraps here with no seek, so physics carries across the loop.
@@ -1058,7 +1073,7 @@ async function playPreview():Promise<void> {
1058
1073
  if((!player&&!video&&!sequence)||duration<=0)return;
1059
1074
  const intent=++playbackIntent;desiredPlay=true;idleHeld=false;syncPlayerLoop();if(time>=duration)seek(0,{kind:'replay'});
1060
1075
  if(video&&referenceInput.state==='loaded'){try{await video.play();}catch(error){pause();message(`Playback is paused: ${errorText(error)}. Use Play to retry.`,true);return;}}
1061
- if(intent!==playbackIntent||!desiredPlay){if(!desiredPlay)video?.pause();return;}playing=true;lastFrame=0;player?.resume();button('play').textContent='Ⅱ';button('play').setAttribute('aria-label','Pause');
1076
+ 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');
1062
1077
  }
1063
1078
  function localDraft():boolean{return !!comments?.draft()||dirty||!!input('feedback-summary').value.trim()||!!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;}
1064
1079
  function controlState():ControlInspection {
@@ -1742,8 +1757,8 @@ async function applyPatch(patch:ConfigPatch,world:StageWorld|null=null):Promise<
1742
1757
  replay:(t:number,dt:number,steps:readonly {t:number;wind?:[number,number];gravity?:[number,number]}[]=[])=>{
1743
1758
  if(!player?.current||!(dt>0)||!(t>=0))return null;
1744
1759
  const at=(k:number)=>{for(const step of steps)if(Math.max(0,Math.ceil(step.t/dt-1e-9))===k)player!.environment({...(step.wind?{wind:step.wind}:{}),...(step.gravity?{gravity:step.gravity}:{})});};
1745
- pause();if(steps.length)player.environment(null);at(0);player.seek(0);player.resume();
1746
- try{for(let k=1,n=Math.round(t/dt);k<=n;k++){at(k);player.frame(dt);}}finally{player.pause();}
1760
+ pause();if(steps.length)player.environment(null);at(0);player.seek(0);player.hold(false);player.resume();
1761
+ try{for(let k=1,n=Math.round(t/dt);k<=n;k++){at(k);player.frame(dt);}}finally{player.hold(true);player.pause();}
1747
1762
  drawRig(()=>player!.draw());time=player.time;renderTransport();
1748
1763
  const posedTime=player.time;if(steps.length){if(environmentApplied())player.environment(environmentFor(wind.read(),gravityValue()));else player.environment(null);}
1749
1764
  return posedTime;},
@@ -2138,8 +2153,8 @@ function sampleLocals(bone:string,dt:number,n:number):{t:number;rotation:number;
2138
2153
  let recording=false;
2139
2154
  const read:BoneAdjust=(bones,ctx)=>{inner?.(bones,ctx);if(!recording)return;const l=bones.bone(bone);rows.set(ctx.trackTime??0,{t:ctx.trackTime??0,rotation:l.rotation,x:l.x,y:l.y,scaleX:l.scaleX,scaleY:l.scaleY,shearX:l.shearX,shearY:l.shearY});};
2140
2155
  pause();p.adjust=read;
2141
- try{p.seek(0);recording=true;p.repose();p.resume();for(let k=1;k<=n;k++)p.frame(dt);}
2142
- finally{recording=false;p.pause();p.adjust=inner;drawRig(()=>p.draw());time=p.time;renderTransport();}
2156
+ try{p.seek(0);recording=true;p.repose();p.hold(false);p.resume();for(let k=1;k<=n;k++)p.frame(dt);}
2157
+ finally{recording=false;p.hold(true);p.pause();p.adjust=inner;drawRig(()=>p.draw());time=p.time;renderTransport();}
2143
2158
  return [...rows.values()].sort((a,b)=>a.t-b.t);
2144
2159
  }
2145
2160
  async function resetRebuild(world:StageWorld|null=null):Promise<void> {
@@ -17,6 +17,8 @@ export interface PlaybackInput {
17
17
  /** Wall-clock seconds since the previous frame. */
18
18
  elapsed: number;
19
19
  repeat: boolean;
20
+ /** Keep the clip time fixed while supplying wall-clock physics steps. */
21
+ held?: boolean;
20
22
  step?: number;
21
23
  }
22
24
  export interface PlaybackAdvance {
@@ -33,16 +35,16 @@ export interface PlaybackAdvance {
33
35
  export function advancePlayback(input: PlaybackInput): PlaybackAdvance {
34
36
  const step = input.step ?? PLAYBACK_STEP, duration = input.duration, steps: number[] = [];
35
37
  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 };
38
+ if (!input.held && !(duration > 0)) return { steps, time, carry: 0, wrapped, ended };
37
39
  while (carry >= step - STEP_SLACK) {
38
- if (!input.repeat && time + step >= duration) {
40
+ if (!input.held && !input.repeat && time + step >= duration) {
39
41
  const last = duration - time;
40
42
  if (last > 0) steps.push(last);
41
43
  time = duration; carry = 0; ended = true;
42
44
  break;
43
45
  }
44
- steps.push(step); carry = Math.max(0, carry - step); time += step;
45
- if (input.repeat) while (time >= duration) { time -= duration; wrapped = true; }
46
+ steps.push(step); carry = Math.max(0, carry - step); if (!input.held) time += step;
47
+ if (!input.held && input.repeat) while (time >= duration) { time -= duration; wrapped = true; }
46
48
  }
47
49
  return { steps, time, carry, wrapped, ended };
48
50
  }