Skip to content

feat(visualization): shared viser playback clock, timeline controls, and primitives - #2659

Merged
TATP-233 merged 2 commits into
mainfrom
feat/shared-viser-playback-primitives
Nov 27, 2026
Merged

TATP-233 merged 2 commits into
mainfrom
feat/shared-viser-playback-primitives

Conversation

@TATP-233

Copy link
Copy Markdown
Collaborator

Summary

Port the generic viser playback/rendering components identified by a downstream leanretarget audit into unilab.visualization, so downstream projects can drop their local copies. Purely additive — no existing UniLab behavior changes.

  • src/unilab/visualization/playback_clock.py: PlaybackClock maps monotonic wall time onto an arbitrary non-uniform timestamp grid, with seek / set_playing / set_speed / advance and loop-or-clamp ends. Deterministic tests can inject now.
  • src/unilab/visualization/viser_playback_controls.py: PlaybackTimelineGui creates the Frame slider plus Play/Speed/Loop controls on a viser gui registry and wires them to one PlaybackClock. The serve loop advances the clock and calls sync(current_frame), which handles the slider writeback (_updating_slider guard) and play-checkbox sync, returning whether the caller should re-render. User seeks flow through an on_seek callback.
  • src/unilab/visualization/viser_utils.py: set_handle_property (assign only on change), nominal_fps (median-interval nominal rate), cylinder_transform (unit-z cylinder midpoint/wxyz/scale between two points), scaled_vector_endpoint (length-capped vector display endpoint).

Ported from downstream leanretarget audit; no driving issue.

Validation

  • uv run pytest tests/visualization/ tests/scripts/test_check_docs.py -q — 100 passed.
  • uv run ruff format / uv run ruff check on changed files — clean.
  • uv run ruff check tests --select F401,F821,F811,F841 --output-format concise — clean.
  • uv run mypy src/unilab — Success: no issues found in 216 source files.
  • uv run interrogate -c pyproject.toml src/unilab — PASSED (49.7% vs 40% floor); new modules at 100%.

Notes

  • unilab/visualization/__init__.py stays lightweight; the new modules are imported by path, matching viser_scene / viser_playback.
  • Changelog entry added under ## Unreleased (### Added / 新增, bilingual).

…and primitives

Port the generic viser playback components identified by the downstream
leanretarget audit into unilab.visualization:

- PlaybackClock maps monotonic wall time onto an arbitrary non-uniform
  timestamp grid with seek/set_playing/set_speed/advance and loop-or-clamp
  ends.
- PlaybackTimelineGui binds the Frame slider plus Play/Speed/Loop controls
  to one clock and centralizes the serve-loop slider writeback pattern.
- viser_utils adds set_handle_property, nominal_fps, cylinder_transform,
  and scaled_vector_endpoint for handle updates, nominal-rate estimation,
  and vector display geometry.

Purely additive; no existing UniLab behavior changes.
@TATP-233
TATP-233 merged commit 51084ea into main Nov 27, 2026
12 checks passed
@TATP-233
TATP-233 deleted the feat/shared-viser-playback-primitives branch November 27, 2026 03:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant