Skip to content

Timeline: parallel events (model playback and style changes alongside camera moves) and hold-not-wrap semantics #920

Open

Description

@javierbq

Problem

The Movie-tab timeline is a single sequential lane: camera items (Roll, Rock, captured views), scenes, and Play-models clips each take their own slot, one after another. Every part of the movie (camera, Move-mode object positions, models) is driven by keyframes that appkit_movie.rebuild() stores and then interpolates with mview interpolate. With movie_loop on (the default), that interpolation wraps across the loop seam. Outside its own keyframes, each part glides from its last keyframe back round to its first.

What users see:

  • Roll → Play models (morph): the morph runs backwards during the Roll, then forwards in its clip. It looks like the morph plays at the same time as the rotation. (Reported while testing PR feat(morph): morph multi-state objects into smooth trajectories #918. The same happens with plain Play-models clips; the code has been on master since July.)
  • Scene A → Scene B → Play-models clip: during the clip the camera drifts from B back to A, arriving at A on the last frame. Measured headless: view = B at frame 61, between A and B at 121 and 181, A at 241.
  • Scene A → Scene B (ligand moved into the pocket in Move mode) → clip: the ligand slides back out during the clip.
  • Related quirks found along the way:
    • Scene keyframes carry the object's own state setting, so models move during scene transitions after any playback or scrub.
    • In a scenes-only lane, multi-state objects lose their Move-mode motion.
    • A Lockstep clip anywhere but last truncates the movie (tracked separately).

There's also a structural limit: everything is sequential. A model sweep can't run during a Rock, and a style change (e.g. fading a surface's transparency) can't run over a camera move. Today style settings only animate as part of scene transitions.

Stopgap (PR #918)

A stopgap fix in PR #918 makes model tracks and Move-mode positions hold outside their keyframes instead of wrapping:

  • Each multi-state object's model track is keyed at frame 1 and the movie's end. It holds a clip's first model before the clip, its last model after it, and the end model between clips.
  • Scene keyframes re-store each object's position.
  • Objects moved by scenes hold the first scene's position before it and the last scene's after it.

The camera still wraps (unchanged).

Known limits of the stopgap:

  • A key strictly between two Move-mode scenes holds the earlier scene's position, so that move happens later.
  • Models can kink at a scene frame inside a clip (keys hold integer models).
  • Lockstep doesn't move objects that have their own track.

Proposed design: two kinds of timeline events

  1. Sequential events, the spine. Camera moves and scenes, laid out one after another as today, each with a transition (duration plus Smooth/Linear easing).
  2. Parallel events, overlays. Things that run during the spine over a time range on their own lanes, with a start and duration that can overlap anything on the spine:
    • Play models / morph: model playback of one object, or a group's members, over the span. Keeps Sweep/Loop/Lockstep, the model range, and morph stride mapping. Example: a morph spanning the same 8 s as a Rock.
    • Style changes: animate one setting on one object or selection over the span. Examples: surface transparency 0 → 0.6 over seconds 2–5, a colour fade, cartoon transparency, stick radius. Reuse the scene setting-animation machinery (raymol_scene_anim, mdo per frame), driven by an event instead of a scene pair.

Semantics

  • Every lane holds outside its events. A model stays on its last model, a setting keeps its last value, and the camera holds after its last move. Nothing moves unless an event says so.
  • A seamless loop is explicit: end the spine with a move back to the opening view, as a Roll already does, or add an explicit "Loop to start" event. It's no longer a side effect of movie_loop.
  • Overlapping events on the same lane/property: decide whether the later one wins or they're disallowed in the UI.

Engine notes

These come from the stopgap investigation, as measured:

  • Per-object mview store always writes the object's current TTT into the matrix channel (TTTToViewElem). Without state=, it also flags the object's own state setting (SettingGetIfDefined_i).
  • The state channel interpolates linearly, and only between two consecutive keys that both carry a state (layer1/View.cpp). So any matrix key inside a model ramp has to carry a model too. That's the root of the integer kink and of most coupling bugs. Recommended: interpolate the state channel independently of matrix keys in the core (ObjectMotion), so model tracks and position tracks no longer share keyframes.
  • set_object_ttt with a movie defined auto-stores a model-less key at the current frame (movie_auto_store, default -1) and reinterpolates every track.
  • mview interpolate only refills never-filled frames. reinterpolate refills everything.
  • ObjectPrepareContext applies an object's state only on frames whose keys carry one. Unkeyed frames keep the last applied model.
  • mset(seq, start) truncates the movie at the span end (separate Lockstep bug).

UI sketch

  • Lanes: the camera/scenes spine on top. Below it, one lane per parallel event kind (Models, Style), or one lane per object.
  • Events: drag the start and edges; long-press to configure. The composer gets "Add as overlay" for Play models and a new Style event.
  • Timing: the ruler stays in seconds. Parallel events use absolute frames; spine items keep the ripple layout.
  • Persistence: events must round-trip through .pse sessions (TimelineRecord) and movie export.

Open questions

  • Per-object lanes or per-kind lanes?
  • Which style properties to support first?
  • Lockstep as an overlay event?
  • What happens to a parallel event when its object is deleted or renamed?
  • How should iPhone compact layout show multiple lanes?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions