aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2020-10-24 16:54:50 +0200
committerThomas White <taw@physics.org>2020-10-24 16:54:50 +0200
commit8726a5c44c16503697197d089d3880218d61df83 (patch)
tree35cd1914079e828a789d9173a9f442ea7a911aaf
parentcd1e43183ac01466ecb91709671046a22036acf7 (diff)
Match cue-part attributes by name as well
-rw-r--r--guile/starlet/base.scm7
-rw-r--r--guile/starlet/playback.scm21
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 <fixture-attribute> (<object>)
(name
@@ -91,6 +92,10 @@
(is-a? f <fixture>))
+(define (fixture-attribute? f)
+ (is-a? f <fixture-attribute>))
+
+
;; A "state" is just a thin wrapper around a hash table
;; of (fixture . attribute) --> value
(define-class <starlet-state> (<object>)
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)