From 8726a5c44c16503697197d089d3880218d61df83 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Sat, 24 Oct 2020 16:54:50 +0200 Subject: Match cue-part attributes by name as well --- guile/starlet/base.scm | 7 ++++++- guile/starlet/playback.scm | 21 ++++++++++++++++++--- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/guile/starlet/base.scm b/guile/starlet/base.scm index 21e9590..4cb9716 100644 --- a/guile/starlet/base.scm +++ b/guile/starlet/base.scm @@ -37,7 +37,8 @@ intensity? state-find get-attr-type - fixture?)) + fixture? + fixture-attribute?)) (define-class () (name @@ -91,6 +92,10 @@ (is-a? f )) +(define (fixture-attribute? f) + (is-a? f )) + + ;; A "state" is just a thin wrapper around a hash table ;; of (fixture . attribute) --> value (define-class () diff --git a/guile/starlet/playback.scm b/guile/starlet/playback.scm index 5a3c2a1..c340c52 100644 --- a/guile/starlet/playback.scm +++ b/guile/starlet/playback.scm @@ -302,9 +302,24 @@ (define (match-fix-attr attr-el fix attr) - (if (fixture? attr-el) - (eq? attr-el fix) - (eqv? attr-el (cons fix attr)))) + (cond + + ((fixture? attr-el) + (eq? attr-el fix)) + + ((and (pair? attr-el) + (fixture? (car attr-el)) + (fixture-attribute? (cdr attr-el))) + (and (eq? (car attr-el) fix) + (eq? (cdr attr-el) attr))) + + ((and (pair? attr-el) + (fixture? (car attr-el)) + (symbol? (cdr attr-el))) + (and (eq? (car attr-el) fix) + (eq? (cdr attr-el) (get-attr-name attr)))) + + (else #f))) (define (in-cue-part? cue-part fix attr) -- cgit v1.2.3