Ok well after spending a whole day on this one simple problem I am now looking for help.... Yes this is a simple problem and although I found many samples, examples, tutorials, this continues to elude me. What exactly....
I have a bunch of layers that were chosen and populated to a list previously I need to do a filtering based on each layer name and remove the ones that do not match.
This is the code that populates the list, that seems to work. The simplest cond for that follows:
(set! layerList (get-all-real-layers image)))
So now I have layerList and filter-regex, which is a string containing a simple regex. The default regex is ".". I want to remove all layers where the layer name does not match with filter-regex, the regex. Currently my code reads:
(if (<> (strcmp filter-regex "") 0)
(gimp-message (string-append "filter-regex = " filter-regex))
(map (lambda (x) (
(let* (
(layerName (car (gimp-layer-get-name x)))
)
(gimp-message (string-append "layerName = " layerName))
(if (re-match filter-regex layerName)
(set! layerList (delq x layerList))
) ;enif re-match
) ;;enlet
)) layerList)
) ;enif <>
It seems to loop through as an empty list, no error reported. It does print the filter as "." (the default), but no layer names.
Thanks in advance. Yeah I have done a few dozen pyfu scripts, and many years ago I did a few scriptfu ones, but it is like learning all over again.