I'm trying to set up a script for raw photos, to allow me to add two copies of the existing file (all taken from ufraw), at different exposures so I can recover shadow and highlight detail. The part for the shadow file is now working, hard-coded to use the same layer for its mask and with a mode of NORMAL.
But I want to pass an option for the shadow mask, so that I can take it from the shadow layer or the base layer (the normal exposure) AND set the mode to NORMAL or LIGHTEN-ONLY. The following code does not error:
(cond ( < shadow-option 2 ) (define (sm-source shadow-layer))
(else (define (sm-source base-layer))))
(cond ( = shadow-option 0 ) (define (shadow-mode NORMAL))
(else (define (shadow-mode LIGHTEN-ONLY))))
Maybe my cond tests are not going to do what I want, but AFAICS both sm-source and shadow-mode must have a value, either from the test being true, or from the else ?
But both appear to not be defined when I try to reference them. The first use is on the next line of my script:
(gimp-layer-set-mode shadow-layer shadow-mode)
But I get Error: ( : 1) eval: unbound variable: shadow-mode. If I comment that line and replace it by a hardcoded mode, I then get a similar error for sm-source.