Repository navigation
feat(visualization): shared viser playback clock, timeline controls, and primitives - #2659
Merged
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:PlaybackClockmaps monotonic wall time onto an arbitrary non-uniform timestamp grid, withseek/set_playing/set_speed/advanceand loop-or-clamp ends. Deterministic tests can injectnow.src/unilab/visualization/viser_playback_controls.py:PlaybackTimelineGuicreates the Frame slider plus Play/Speed/Loop controls on a viserguiregistry and wires them to onePlaybackClock. The serve loop advances the clock and callssync(current_frame), which handles the slider writeback (_updating_sliderguard) and play-checkbox sync, returning whether the caller should re-render. User seeks flow through anon_seekcallback.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 checkon 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__.pystays lightweight; the new modules are imported by path, matchingviser_scene/viser_playback.## Unreleased(### Added / 新增, bilingual).