Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Drawing line in Script-Fu
#4
(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.

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

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?  Confused 

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)
    (let*
        (
            (area-width 1000)
            (area-height 1000)
        )

        (gimp-paintbrush-default drawable 4 '#(0 0 area-width area-height))
        (gimp-displays-flush)
    )
)
Them GIMP complain that:


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?


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 *
    (
        (points (cons-array 4 'double))
        (ax 100)
        (ay 100)
        (bx 300)
        (by 300)
    )
    (aset points 0 ax)
    (aset points 1 ay)
    (aset points 2 bx)
    (aset points 3 by)
    (gimp-paintbrush-default layerId 4 points)
)



You understand why I use Python...
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: