Skip to content

Take Tracks in TimelineBuilder::compile - #125

Merged
nixonyh merged 2 commits into
mainfrom
nixon/tracks
Jul 31, 2026
Merged

Take Tracks in TimelineBuilder::compile#125
nixonyh merged 2 commits into
mainfrom
nixon/tracks

Conversation

@nixonyh

@nixonyh nixonyh commented Jul 31, 2026

Copy link
Copy Markdown
Member

Follows the builder no longer accumulating tracks itself. Tracks wraps a NonEmpty<Track>, so a timeline can't be built with zero tracks, and compile takes impl Into<Tracks> with a From<Track> impl so the single-track case stays b.compile(track).

Multiple tracks go through Tracks(nonempty![a, b]), with nonempty re-exported from motiongfx so callers don't depend on it directly.

CompileError::EmptyTimeline goes with it - the type now rules that case out, leaving the variant unconstructible.

Follows the builder no longer accumulating tracks itself. `Tracks`
wraps a `NonEmpty<Track>`, so a timeline can't be built with zero
tracks, and `compile` takes `impl Into<Tracks>` with a `From<Track>`
impl so the single-track case stays `b.compile(track)`.

Multiple tracks go through `Tracks(nonempty![a, b])`, with `nonempty`
re-exported from `motiongfx` so callers don't depend on it directly.

`CompileError::EmptyTimeline` goes with it - the type now rules that
case out, leaving the variant unconstructible.
@nixonyh
nixonyh requested a review from Jaghov July 31, 2026 09:11
@nixonyh
nixonyh marked this pull request as ready for review July 31, 2026 09:11
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 17009e68-5f31-4e2c-b176-5fefe92f9ba4

📥 Commits

Reviewing files that changed from the base of the PR and between 4db0f7b and dc312b2.

📒 Files selected for processing (5)
  • crates/motiongfx/src/lib.rs
  • crates/motiongfx/src/timeline.rs
  • crates/motiongfx/src/track.rs
  • examples/bevy_examples/examples/slide_basic.rs
  • examples/vello_winit_example/examples/lissajous.rs
🚧 Files skipped from review as they are similar to previous changes (3)
  • crates/motiongfx/src/lib.rs
  • examples/vello_winit_example/examples/lissajous.rs
  • examples/bevy_examples/examples/slide_basic.rs

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added support for compiling timelines from one or more tracks through a unified track collection.
    • Exposed track collection utilities through the public API and prelude.
    • Track collections now require at least one track.
  • Refactor

    • Simplified timeline construction by removing separate track registration and empty-timeline handling.
    • Updated scene compilation, editor workflows, examples, benchmarks, and documentation to use the streamlined API.

Walkthrough

The PR adds a public non-empty TrackList, changes TimelineBuilder::compile to accept tracks directly, removes track accumulation and fallible empty compilation, updates scene error handling, and migrates repository call sites.

Changes

Timeline compilation API

Layer / File(s) Summary
Tracks collection contract
crates/motiongfx/src/track.rs, crates/motiongfx/src/lib.rs
Adds TrackList, collection helpers, boxed-slice conversion, and nonempty prelude exports.
TimelineBuilder compilation
crates/motiongfx/src/timeline.rs
Changes compile to accept impl Into<TrackList>. Removes internal track storage, add_tracks, and try_compile.
Scene compilation and errors
crates/motiongfx_scene/src/compile.rs, crates/motiongfx_scene/src/error.rs
Passes the root track directly to builder.compile and removes CompileError::EmptyTimeline.
Repository call-site migration
crates/*/README.md, crates/motiongfx/benches/*, crates/motiongfx/docs/*, crates/motiongfx/examples/*, editor/motiongfx_editor/*, examples/bevy_examples/examples/*, examples/vello_winit_example/examples/*
Updates timeline construction to compile single tracks or explicitly ordered TrackList collections.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: jaghov

Poem

A rabbit builds a track list bright,
The builder compiles it right.
Examples follow the new API,
Ordered tracks hop by.
Empty timelines leave the run—
The migration is done!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 31.58% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main API change: passing tracks to TimelineBuilder::compile.
Description check ✅ Passed The description explains the TrackList API, non-empty track enforcement, and removal of EmptyTimeline.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Jaghov Jaghov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Although the name Tracks is quite visually similar to track. Maybe TrackList might be better, or just a more distinct name.

@nixonyh
nixonyh enabled auto-merge (squash) July 31, 2026 09:40
@Jaghov
Jaghov self-requested a review July 31, 2026 09:46
@nixonyh
nixonyh merged commit c2d17f1 into main Jul 31, 2026
8 checks passed
@nixonyh
nixonyh deleted the nixon/tracks branch July 31, 2026 09:47
nixonyh added a commit that referenced this pull request Jul 31, 2026
Follows the builder no longer accumulating tracks itself. `Tracks` wraps
a `NonEmpty<Track>`, so a timeline can't be built with zero tracks, and
`compile` takes `impl Into<Tracks>` with a `From<Track>` impl so the
single-track case stays `b.compile(track)`.

Multiple tracks go through `Tracks(nonempty![a, b])`, with `nonempty`
re-exported from `motiongfx` so callers don't depend on it directly.

`CompileError::EmptyTimeline` goes with it - the type now rules that
case out, leaving the variant unconstructible.
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.

2 participants