03-09-2025, 04:58 AM
(03-09-2025, 03:44 AM)teapot Wrote:(03-09-2025, 01:02 AM)alvk Wrote: Yes, I did. It works as expected. Well, almost as I expect. I just check it and found that if a layer has a mask and the mask is selected, i.e., the border around the layer is green, the script actually inserts the text into the mask. Probably I misunderstand what a layer mask is and how to work with them. I need to read about this. Other types of drawables, i.e., text layer, layer group, path, and selection works as expected.
The idea behind (< 1 layer-type) is to extend the script messaging by providing different messages depending on the selected type of drawable. This is a kind of preliminary code to be extended later. But even in its current form, it works.
Interesting. From your version in post #12, layer-type is initialised to 0 and set to 1 if current-layer meets your criteria. In gimp's scheme console:
Code:
> (< 1 0)
#f
> (< 1 1)
#f
So I would have expected (< 1 layer-type) to be false in both cases thus would not expect the "Cannot add the label to the selected layer" message to occur.
Hm... you are right. I don't understand why it works, as was I expecting when writing the script.