Drawing line in Script-Fu - Printable Version +- Gimp-Forum.net (https://www.gimp-forum.net) +-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP) +--- Forum: Extending the GIMP (https://www.gimp-forum.net/Forum-Extending-the-GIMP) +---- Forum: Scripting questions (https://www.gimp-forum.net/Forum-Scripting-questions) +---- Thread: Drawing line in Script-Fu (/Thread-Drawing-line-in-Script-Fu) |
Drawing line in Script-Fu - Strzegol - 09-13-2023 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) Second stuff: Why refreshing scripts remove them from menu? RE: Drawing line in Script-Fu - Ofnuts - 09-13-2023 (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) 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. RE: Drawing line in Script-Fu - Strzegol - 09-14-2023 (09-13-2023, 07:26 AM)Ofnuts Wrote: 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. 1. I would say that this is simple size of array. Because coordinates are two. Stroke is one. (In my example). 2,Then how is possible that these scripts were registered at GIMP start, worked fine and get deregistered at refreshing WITHOUT any change to them? 3.How to create a variable of type "GimpFloatArray" from code? Why this is not documented? Why when I do this: Code: (define (script-fu-foobar image drawable orientation) Code: Error: in script, expected type: numeric for element 3 of argument 3 to gimp-paintbrush-default #(0 0 area-width area-height) But when I (print area-width) before (gimp-paintbrush...) it display 1000 so what is "numeric" then? RE: Drawing line in Script-Fu - Ofnuts - 09-14-2023 (09-14-2023, 01:32 AM)Strzegol Wrote:(09-13-2023, 07:26 AM)Ofnuts Wrote: 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. I dearly hate script-fu.... this said when I look for example on the internet, most allocate arrays and plug values in it: Code: (let * You understand why I use Python... RE: Drawing line in Script-Fu - Kevin - 09-14-2023 I would suggest that expecting anything to work on any particular instance of 2.99 is not a good idea. Refreshing scripts is broken, and probably won't be fixed: https://gitlab.gnome.org/GNOME/gimp/-/issues/7445 RE: Drawing line in Script-Fu - Strzegol - 09-14-2023 Guys I thank for all your answers! Quote: I found that changing " Code: '#(0 0 area-width area-height) To: Code: (vector 0 0 area-width area-height) Helps. I don't know why. Quote:You understand why I use Python... I don't think that this is a Scheme problem. This is problem with incomplete documentation of API, and this is problem shared with Python-Fu. In fact, I toy with though of writing myself short tutorial because I figured already some stuff that is not documented. And I have experience with many languages, including Python and Scheme, and I selected Scheme because Python-Fu has even less documentation than Script-Fu. Quote:I would suggest that expecting anything to work on any particular instance of 2.99 is not a good idea. Gimp 2.1x use GTK 2.0 that is no longer maintained. It has problems with handling never tablet drivers. |