Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Troubles with porting a script to Gimp3
#8
(03-05-2025, 07:41 AM)Ofnuts Wrote: SF-ONE-DRAWABLE doesn't change the structure of the script arguments (you still get a list, even if it has only one element). It is only a flag used by the UI to enable/disable the menu entry depending on application state (and technically, you would still have to check that you have only one drawable in th elist, because you could hypothetically be called by another script that could ignore the flag.

Thank you for your suggestion. I have almost re-written the script into Script-Fu v.3 dialect. But now I have another problem. The following code is expected to check whether the drawable is a group, a layer mask, a selection, or a text layer to prevent the text to be added to either of these.
Code:
(cond (#t (gimp-item-is-group (vector-ref drawables 0))) (set! parent-layer-type 1)
          (#t (gimp-item-id-is-layer-mask (vector-ref drawables 0))) (set! parent-layer-type 1)
          (#t (gimp-item-id-is-selection (vector-ref drawables 0))) (set! parent-layer-type 1)
          (#t (gimp-item-id-is-text-layer (vector-ref drawables 0))) (set! parent-layer-type 1))

However, this code always sets the parent-layer-type to 0, even when drawable is a normal layer. Unfortunately, with this code, I cannot figure out how to select active drawable. Interestingly, that this code works fine and selects active drawable
Code:
(layer-width (gimp-drawable-get-width (vector-ref drawables 0)))

Am I missing something with the conditional code?
Reply


Messages In This Thread
Troubles with porting a script to Gimp3 - by alvk - 03-03-2025, 10:42 AM
RE: Troubles with porting a script to Gimp3 - by alvk - 03-05-2025, 01:35 PM

Forum Jump: