From 9f4923385f06a5d6f8e86b5004398a0c335cd6db Mon Sep 17 00:00:00 2001 From: skal Date: Mon, 16 Feb 2026 21:47:09 +0100 Subject: refactor: remove END_DEMO directive, auto-calculate from sequences Remove END_DEMO keyword from timeline format. Demo duration now calculated from max effect end time across all sequences. Sort sequences by start time at compile time for deterministic ordering. Changes: - seq_compiler.py: Auto-calculate duration, sort sequences - seq_compiler.cc: Remove END_DEMO parsing, sort by start time - workspaces/test/timeline.seq: Remove END_DEMO directive - Generated timeline.cc: Duration now 40.0f (was hardcoded) Co-Authored-By: Claude Sonnet 4.5 --- tools/seq_compiler.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'tools/seq_compiler.py') diff --git a/tools/seq_compiler.py b/tools/seq_compiler.py index 3b8d126..70faf5b 100755 --- a/tools/seq_compiler.py +++ b/tools/seq_compiler.py @@ -446,6 +446,16 @@ def main(): print("Error: No sequences found in input file", file=sys.stderr) sys.exit(1) + # Sort sequences by start time + sequences.sort(key=lambda s: s.start_time) + + # Calculate demo duration from max effect end time (absolute time) + demo_duration = 0.0 + for seq in sequences: + for effect in seq.effects: + # Effect times are relative to sequence start + demo_duration = max(demo_duration, seq.start_time + effect.end) + # Process each sequence all_cpp = '''// Generated by seq_compiler.py // DO NOT EDIT @@ -523,7 +533,7 @@ void RenderTimeline(WGPUCommandEncoder encoder, float time, int width, int heigh } float GetDemoDuration() { - return 40.0f; // TODO: Calculate from sequences + return ''' + f'{demo_duration:.1f}f' + '''; } // Surface-based rendering with framebuffers -- cgit v1.2.3