From 0447be4186ef500a439293442519f32ee9282da8 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 20 May 2021 21:00:44 +0200 Subject: Add home-fixture!/blackout! --- guile/starlet/state.scm | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'guile/starlet/state.scm') diff --git a/guile/starlet/state.scm b/guile/starlet/state.scm index 83dace5..35db6bd 100644 --- a/guile/starlet/state.scm +++ b/guile/starlet/state.scm @@ -45,7 +45,8 @@ show-state lighting-state programmer-state - blackout + home-fixture! + blackout! sel selection-hook value->number @@ -151,20 +152,21 @@ (set-in-state! state fix attr)))) ;; Try again -(define (blackout state) - (state-for-each - (lambda (fix attr val) - (when (intensity? attr) - (set-in-state! state fix attr 0.0))) - state)) +;; Set any intensity attributes in the current state to zero +(define (blackout!) + (let ((state (current-state))) + (state-for-each + (lambda (fix attr val) + (when (intensity? attr) + (set-in-state! state fix attr 0.0))) + state))) -;; Set a single attribute to home position -(define (home-attr! state fix attr) - (set-in-state! state - fix - attr - (get-attr-home-val fix attr))) +;; Set all attributes of the fixture to their home values +(define (home-fixture! fix) + (for-each (lambda (attr) + (at fix attr (get-attr-home-val fix attr))) + (get-fixture-attrs fix))) (define (copy-state state) -- cgit v1.2.3