Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Drawing line in Script-Fu
#2
(09-13-2023, 12:25 AM)Strzegol Wrote: Hello. Still another newbie question. Why this script don't work? (GIMP 2.99 but this is so basic stuff that this should don't matter)

EDIT: I checked documentations for hours and also mined examples shipped with GIMP but there are no examples that use gimp-paintbrush-default and oddly I don't found anything in documentation about creation of scripts that draw something on existing images despite this kind of scripts seems to be most common)

EDIT: It should draw line from cornet to pixel at x=100 y=100 using current brush.
Code:
(define (script-fu-linedraw drawable orientation)
    (gimp-paintbrush-default drawable 2 #(0 0 100 100))

)

(script-fu-register
    "script-fu-linedraw"
    "Linedraw"
    "Try draw a line in GIMP"
    "Strzegol"
    "copyright 2023 Strzegol"
    "September 12,2023"
    ""
    SF-DRAWABLE "Drawable" 0

)
(script-fu-menu-register "script-fu-linedraw"
    "<Image>/Tools")

Second stuff: Why refreshing scripts remove them from menu?

The catch is that the num_strokes parameter is the number of coordinates, not the number of strokes (so, the size of the list...). So in your case it should be 4, not 2.

Refreshing scripts re-runs them for registration, so my guess is that if they contain syntax errors, they can't run, so are deregistered.
Reply


Messages In This Thread
Drawing line in Script-Fu - by Strzegol - 09-13-2023, 12:25 AM
RE: Drawing line in Script-Fu - by Ofnuts - 09-13-2023, 07:26 AM
RE: Drawing line in Script-Fu - by Strzegol - 09-14-2023, 01:32 AM
RE: Drawing line in Script-Fu - by Ofnuts - 09-14-2023, 07:37 AM
RE: Drawing line in Script-Fu - by Kevin - 09-14-2023, 09:10 AM
RE: Drawing line in Script-Fu - by Strzegol - 09-14-2023, 11:01 PM

Forum Jump: