2828; The GNU Public License is available at
2929; http://www.gnu.org/copyleft/gpl.html
3030
31- (define (script-fu-hex-grid img inLayer inElement inLength inOrientation inStroke inXoff inYoff inColour )
31+ (define (script-fu-hex-grid img inLayer
32+ inElement
33+ inLength
34+ inOrientation
35+ inStroke
36+ inXoff
37+ inYoff
38+ inColour
39+ inBrushtoUse)
3240 (let*
3341 (
3442 (width (car (gimp-image-width img)))
117125 ; (gimp-message "ok to line 115")
118126
119127 (gimp-context-set-paint-method " gimp-paintbrush" )
120- (set! brushTemp (car (gimp-brush-new " HexGrid Temp Stroke Circle Brush" )))
121- (gimp-brush-set-shape brushTemp BRUSH-GENERATED-CIRCLE)
122- (gimp-brush-set-hardness brushTemp 0.99 )
123- (gimp-brush-set-radius brushTemp (round (+ (/ inStroke 2 ) 1.0 )))
124- (gimp-brush-set-spacing brushTemp 20.0 )
125- (gimp-brush-set-spikes brushTemp 2 )
126- (gimp-brush-set-aspect-ratio brushTemp 1.0 )
127- (gimp-brush-set-angle brushTemp 1.0 )
128128
129- (gimp-context-set-brush " HexGrid Temp Stroke Circle Brush" ) ; was brushTemp variable
130- (gimp-context-set-paint-mode LAYER-MODE-NORMAL)
131- (gimp-context-set-brush-size inStroke)
132- (gimp-context-set-dynamics " Dynamics Off" )
129+ (if (= inBrushtoUse 0 )
130+ (begin
131+
132+ (set! brushTemp (car (gimp-brush-new " HexGrid Temp Stroke Circle Brush" )))
133+ (gimp-brush-set-shape brushTemp BRUSH-GENERATED-CIRCLE)
134+ (gimp-brush-set-hardness brushTemp 1.0 )
135+ (gimp-brush-set-radius brushTemp (round (+ (/ inStroke 2 ) 1.0 )))
136+ (gimp-brush-set-spacing brushTemp 20.0 )
137+ ; (gimp-brush-set-spikes brushTemp 2)
138+ ; (gimp-brush-set-aspect-ratio brushTemp 1.0)
139+ ; (gimp-brush-set-angle brushTemp 1.0)
140+
141+ (gimp-context-set-brush " HexGrid Temp Stroke Circle Brush" ) ; was brushTemp variable
142+ (gimp-context-set-paint-mode LAYER-MODE-NORMAL)
143+ (gimp-context-set-brush-size inStroke)
144+ (gimp-context-set-brush-spacing 0.2 )
145+ (gimp-context-set-dynamics " Dynamics Off" )
146+ )
147+ )
133148
134149 (gimp-edit-stroke-vectors inLayer varPath)
135150
136151
137152
138153 ; (gimp-image-remove-vectors img varPath)
139- (gimp-brush-delete brushTemp)
140- (gimp-brushes-refresh)
154+ (if (= inBrushtoUse 0 )
155+ (begin
156+ (gimp-brush-delete brushTemp)
157+ )
158+ )
159+ ; (gimp-brushes-refresh)
141160
142161 ; done
143162 (gimp-image-undo-group-end img)
149168
150169(script-fu-register " script-fu-hex-grid"
151170 " <Toolbox>/Script-Fu/Render/Pattern/Hex Grid"
152- " Draw a hex grid on the image. Less advanced version.\n hexgrid.scm"
171+ " Draw a hex grid on the image. Less advanced version. Creates a brush in the background. \n hexgrid.scm"
153172 " karlhof26"
154173 " karlhof26"
155174 " March 2020"
160179 SF-ADJUSTMENT " Length of Element" ' (70 2 400 1 10 0 SF-SPINNER)
161180 SF-OPTION " Hex Orientation" ' (" Horizontal" " Vertical" )
162181 SF-ADJUSTMENT " Line Width (px)" ' (2 1 400 1 10 0 SF-SPINNER)
163- SF-ADJUSTMENT " Horizontal Offset" ' (0 0 399 0.5 10 1 SF-SPINNER)
164- SF-ADJUSTMENT " Vertical Offset" ' (0 0 399 0.5 10 1 SF-SPINNER)
182+ SF-ADJUSTMENT " Horizontal Offset (px) " ' (0 0 399 0.5 10 0 SF-SPINNER)
183+ SF-ADJUSTMENT " Vertical Offset (px) " ' (0 0 399 0.5 10 0 SF-SPINNER)
165184 SF-COLOR " Color" " black"
185+ SF-OPTION " Brush to use" ' (" Default" " Current Brush settings" )
186+
166187)
167188
168189; end of script
0 commit comments