From 873fa985bb4b3ec3841fa77adc16a99184cb9507 Mon Sep 17 00:00:00 2001 From: skal Date: Thu, 5 Feb 2026 00:15:00 +0100 Subject: feat: Replace explicit priorities with stack-based priority modifiers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Simplifies effect priority management by using relative modifiers instead of explicit numbers, making timeline reordering much more practical. ## New Priority System Effects now use priority modifiers after EFFECT keyword: - `+` increment priority by 1 (or start at 0 if first) - `=` keep same priority as previous effect - `-` decrement priority (or start at -1 if first, for background) Old syntax: ``` EFFECT FlashEffect 0.0 0.5 0 EFFECT FadeEffect 0.1 0.3 1 EFFECT BgCube 0.2 3 -1 ``` New syntax: ``` EFFECT - BgCube 0.2 3 # Priority -1 (background) EFFECT + FlashEffect 0.0 0.5 # Priority 0 EFFECT + FadeEffect 0.1 0.3 # Priority 1 ``` ## Benefits ✓ Reordering effects no longer requires renumbering all priorities ✓ Priority relationships are explicit and relative ✓ File order matches render order (easier to understand) ✓ Same-priority effects clearly marked with `=` ✓ Background layers (-1) clearly marked with `-` ✓ Reduces errors when reorganizing timelines ## Implementation - Updated seq_compiler to parse +/=/- modifiers - Tracks current priority per sequence - First effect sets base priority (0 or -1) - Subsequent effects modify relative to previous - Generated C++ code unchanged (still uses integer priorities) ## Changes to demo.seq - All effects updated to use new syntax - Effects reordered by priority within sequences - Priority gaps removed (were likely unintentional) - Comments updated to reflect new system ## Documentation - Updated SEQUENCE.md with new syntax - Added examples showing +, =, - usage - Explained priority calculation rules This makes timeline authoring significantly more maintainable, especially when experimenting with different effect orderings during development. --- assets/demo.seq | 110 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 56 insertions(+), 54 deletions(-) (limited to 'assets/demo.seq') diff --git a/assets/demo.seq b/assets/demo.seq index 35935a7..44df234 100644 --- a/assets/demo.seq +++ b/assets/demo.seq @@ -8,10 +8,10 @@ # # QUICK REFERENCE: # SEQUENCE [optional_end] -# EFFECT +# EFFECT <+|=|-> # +# Priority modifiers: + (increment), = (same), - (decrement/background) # Time notation: 0b (beats), 0.0 (seconds) -# Priority: Higher numbers render later (on top) # # VALIDATION & VISUALIZATION: # ./build/seq_compiler assets/demo.seq # Validate only @@ -19,86 +19,88 @@ # # ============================================================================ +# BPM 120 + SEQUENCE 0b 0 - EFFECT FlashEffect 0.0 1. 0 - EFFECT FadeEffect 0.1 1. 1 # Add fade - EFFECT FlashCubeEffect .2 3 -1 # Background cube (priority -1 = behind everything) - EFFECT SolarizeEffect 0 4b 3 # Color inversion (last) + EFFECT - FlashCubeEffect .2 3 # Background cube (priority -1 = behind everything) + EFFECT + FlashEffect 0.0 1. # Priority 0 + EFFECT + FadeEffect 0.1 1. # Priority 1 + EFFECT + SolarizeEffect 0 4b # Priority 2 (was 3, now contiguous) SEQUENCE 4b 0 - EFFECT FlashEffect 0.0 0.2 4 # Add flash after solarize - EFFECT FlashCubeEffect 0.1 3. -1 + EFFECT - FlashCubeEffect 0.1 3. # Priority -1 + EFFECT + FlashEffect 0.0 0.2 # Priority 0 (was 4, now contiguous) SEQUENCE 6b 1 - EFFECT ParticlesEffect 0 4 1 # Particles layer - EFFECT GaussianBlurEffect 0 8 1 # Blur + EFFECT + ParticlesEffect 0 4 # Priority 0 + EFFECT = GaussianBlurEffect 0 8 # Priority 0 (same layer) SEQUENCE 7b 0 - EFFECT FadeEffect 0.1 1.0 5 # Add fade - EFFECT HeptagonEffect 0.0 .2 0 # Main geometric effect + EFFECT + HeptagonEffect 0.0 .2 # Priority 0 + EFFECT + FadeEffect 0.1 1.0 # Priority 1 (was 5, now contiguous) # Post-processing chain (priority 10 = applied after scene rendering) # Effects are applied in priority order: lower numbers first SEQUENCE 8b 3 - EFFECT ThemeModulationEffect 0 4 0 # Brightness modulation (first) - EFFECT HeptagonEffect 0.0 4.0 0 # Main geometric effect - EFFECT GaussianBlurEffect 0 8 1 # Blur - EFFECT ChromaAberrationEffect 0 6 2 # Color separation - EFFECT SolarizeEffect 0 10 3 # Color inversion (last) + EFFECT + ThemeModulationEffect 0 4 # Priority 0 + EFFECT = HeptagonEffect 0.0 4.0 # Priority 0 (same layer) + EFFECT + GaussianBlurEffect 0 8 # Priority 1 + EFFECT + ChromaAberrationEffect 0 6 # Priority 2 + EFFECT + SolarizeEffect 0 10 # Priority 3 SEQUENCE 12b 2 - EFFECT FlashCubeEffect .2 3 -1 # Background cube (priority -1 = behind everything) - EFFECT HeptagonEffect 0 4 0 - EFFECT ParticlesEffect 0 4 1 # Particles layer + EFFECT - FlashCubeEffect .2 3 # Priority -1 (background) + EFFECT + HeptagonEffect 0 4 # Priority 0 + EFFECT + ParticlesEffect 0 4 # Priority 1 SEQUENCE 15b 2 - EFFECT FlashCubeEffect .2 3 -1 # Background cube (priority -1 = behind everything) - EFFECT FlashEffect 0.0 1 0 + EFFECT - FlashCubeEffect .2 3 # Priority -1 (background) + EFFECT + FlashEffect 0.0 1 # Priority 0 SEQUENCE 16b 10 - EFFECT FlashCubeEffect .2 3 -1 # Background cube (priority -1 = behind everything) - EFFECT GaussianBlurEffect 0 8 1 # Blur - EFFECT FlashEffect 0.0 0.2 4 # Add flash after solarize - EFFECT FlashEffect 1b 0.2 4 # Add flash after solarize + EFFECT - FlashCubeEffect .2 3 # Priority -1 (background) + EFFECT + GaussianBlurEffect 0 8 # Priority 0 + EFFECT + FlashEffect 0.0 0.2 # Priority 1 + EFFECT = FlashEffect 1b 0.2 # Priority 1 (same layer) SEQUENCE 17b 2 - EFFECT ThemeModulationEffect 0 4 0 # Brightness modulation (first) - EFFECT HeptagonEffect 0.2 2.0 1 # Main geometric effect - EFFECT ParticlesEffect 0 4 1 # Particles layer - EFFECT GaussianBlurEffect 0 8 3 # Blur - EFFECT Hybrid3DEffect 0 4 2 # 3D objects (priority 2 = foreground) - EFFECT ChromaAberrationEffect 0 6 4 # Color separation + EFFECT + ThemeModulationEffect 0 4 # Priority 0 + EFFECT + HeptagonEffect 0.2 2.0 # Priority 1 + EFFECT = ParticlesEffect 0 4 # Priority 1 (same layer) + EFFECT + Hybrid3DEffect 0 4 # Priority 2 + EFFECT + GaussianBlurEffect 0 8 # Priority 3 + EFFECT + ChromaAberrationEffect 0 6 # Priority 4 SEQUENCE 24b 1 - EFFECT ThemeModulationEffect 0 8 0 # Brightness modulation (first) - EFFECT HeptagonEffect 0.2 2.0 1 # Main geometric effect - EFFECT Hybrid3DEffect 0 20 2 # 3D objects (priority 2 = foreground) - EFFECT GaussianBlurEffect 0 8 3 # Blur - EFFECT ChromaAberrationEffect 0 10 4 # Color separation - EFFECT SolarizeEffect 0 10 5 # Color inversion (last) + EFFECT + ThemeModulationEffect 0 8 # Priority 0 + EFFECT + HeptagonEffect 0.2 2.0 # Priority 1 + EFFECT + Hybrid3DEffect 0 20 # Priority 2 + EFFECT + GaussianBlurEffect 0 8 # Priority 3 + EFFECT + ChromaAberrationEffect 0 10 # Priority 4 + EFFECT + SolarizeEffect 0 10 # Priority 5 SEQUENCE 32b 0 - EFFECT ThemeModulationEffect 0 4 0 # Brightness modulation (first) - EFFECT HeptagonEffect 0 16 1 # Main geometric effect - EFFECT ChromaAberrationEffect 0 16 3 # Color separation - EFFECT GaussianBlurEffect 0 8 4 # Blur + EFFECT + ThemeModulationEffect 0 4 # Priority 0 + EFFECT + HeptagonEffect 0 16 # Priority 1 + EFFECT + ChromaAberrationEffect 0 16 # Priority 2 + EFFECT + GaussianBlurEffect 0 8 # Priority 3 SEQUENCE 48b 0 - EFFECT ThemeModulationEffect 0 4 0 # Brightness modulation (first) - EFFECT HeptagonEffect 0.2 2.0 1 # Main geometric effect - EFFECT GaussianBlurEffect 0 8 3 # Blur - EFFECT SolarizeEffect 0 2 5 # Color inversion (last) + EFFECT + ThemeModulationEffect 0 4 # Priority 0 + EFFECT + HeptagonEffect 0.2 2.0 # Priority 1 + EFFECT + GaussianBlurEffect 0 8 # Priority 2 + EFFECT + SolarizeEffect 0 2 # Priority 3 SEQUENCE 56b 0 - EFFECT ThemeModulationEffect 0 8 0 # Brightness modulation (first) - EFFECT HeptagonEffect 0.2 2.0 0 # Main geometric effect - EFFECT Hybrid3DEffect 0 4 1 # 3D objects (priority 2 = foreground) - EFFECT HeptagonEffect 0 16 2 # Main geometric effect - EFFECT ChromaAberrationEffect 0 16 3 # Color separation - EFFECT GaussianBlurEffect 0 8 4 # Blur + EFFECT + ThemeModulationEffect 0 8 # Priority 0 + EFFECT = HeptagonEffect 0.2 2.0 # Priority 0 (same layer) + EFFECT + Hybrid3DEffect 0 4 # Priority 1 + EFFECT + HeptagonEffect 0 16 # Priority 2 + EFFECT + ChromaAberrationEffect 0 16 # Priority 3 + EFFECT + GaussianBlurEffect 0 8 # Priority 4 SEQUENCE 62b 0 - EFFECT ThemeModulationEffect 0 3 0 # Brightness modulation (first) - EFFECT SolarizeEffect 0 3 5 # Color inversion (last) + EFFECT + ThemeModulationEffect 0 3 # Priority 0 + EFFECT + SolarizeEffect 0 3 # Priority 1 # Demo automatically exits at this time (supports beat notation) END_DEMO 65b -- cgit v1.2.3