Skip to content

Add AnimationKeyMode and open-frame shorthand; update parsing, sampling, optimization, and static emission - #7

Merged
TiernanDeFranco merged 4 commits into
mainfrom
codex/plan-and-implement-closed-vs-open-frames
May 8, 2026
Merged

TiernanDeFranco merged 4 commits into
mainfrom
codex/plan-and-implement-closed-vs-open-frames

Conversation

@TiernanDeFranco

Copy link
Copy Markdown
Collaborator

Motivation

  • Introduce a per-key mode to distinguish open (one-sided) keys from closed keys so open-frame shorthand can be expressed and handled.
  • Ensure optimization and sampling respect open keys so redundant-key removal and value sampling remain correct for open segments.
  • Propagate key mode through the parser and track-building to allow .panim to express open frames with a compact shorthand ([FrameN?]).

Description

  • Added AnimationKeyMode enum with Open and Closed variants and added a mode field to AnimationObjectKey with Closed as the default and adjusted Default implementations accordingly.
  • Updated parser to accept an open-frame shorthand by returning (frame, key_mode) from parse_frame_header when a frame header ends with ?, and threaded key_mode through parse_frame_block, parse_object_block, parse_object_field_action, and FrameAction::Field.
  • Threaded key mode into track building by storing per-frame mode in TrackKey and setting key.mode for keys that originate from frame headers; insertion defaults keys to Closed where appropriate.
  • Modified optimization and sampling logic so optimize_animation_track_keys skips tracks that contain any non-Closed keys, and sample_track_value_from_keys returns None for frames that fall after an Open key segment start (except at the exact open key frame).
  • Updated static emission (emit_static_animation_const) to include key mode in generated AnimationObjectKey constants and added emit_key_mode helper.
  • Updated tests and helpers across crates to account for the new mode field and added new tests: optimize_track_keys_does_not_optimize_tracks_with_open_keys, sample_track_value_returns_none_after_open_key_segment_start, and parses_open_frame_header_shorthand.

Testing

  • Ran cargo test for the modified crates, including parser and animation unit tests (perro_animation and pipeline tests); all automated tests passed.

Codex Task

@TiernanDeFranco
TiernanDeFranco merged commit be4dd2d into main May 8, 2026
3 checks passed
@TiernanDeFranco
TiernanDeFranco deleted the codex/plan-and-implement-closed-vs-open-frames branch May 8, 2026 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant