Post Reply 

Script-fu (gimp-context-set-brush-size size) ain't working

Aug 8, 2012, 21:45
Post: #1
Script-fu (gimp-context-set-brush-size size) ain't working
I've written a simple script. The purpose is to make a single stroke in the center of the image. I've used the (gimp-context-set-brush-size size). After running the script, the brush size has changed in the "Tool Options" but the script ignored the tool options and made a brush stroke using the default size of the brush, which is 180 by 180.

Code:
(define (script-fu-acrylic-spot image drawable )

   (let*

       (
         (width (car (gimp-image-width image)))
         (height (car (gimp-image-height image)))
         (points (make-vector 2 'double))
         (x1 (* width 0.5))
         (y1 (* height 0.5))
         (brush-size-1 (* width 0.3))
         )

;undo
(gimp-image-undo-group-start image)
;undo

             (gimp-context-set-foreground '(0 0 0))
             (gimp-context-set-brush "Acrylic 01")
             (gimp-context-set-brush-size brush-size-1)
                
             (vector-set! points 0 x1)
             (vector-set! points 1 y1)
                  
             (gimp-paintbrush drawable 0 2 points PAINT-CONSTANT 0)
                          
;undo
(gimp-image-undo-group-end image)
(gimp-displays-flush)
;undo
   )  
    
)

(script-fu-register "script-fu-acrylic-spot"
            "<Image>/Filters/acrylic spot"
            "Testing Script"
            "PD"  
            "PD"  
            "2012"
            ""          
            SF-IMAGE "image" 0
            SF-DRAWABLE "drawable" 0"
)

I am totally confused, this seems like such a simple adjustment. Why would it ignore the (gimp-context-set-brush-size brush-size-1) and use the default image size? How am I to get the brush to stroke the size I want?

Any input is immensely appreciated.

Thank you.
Find all posts by this user
Quote this message in a reply
Aug 9, 2012, 00:37 (This post was last modified: Aug 9, 2012 06:55 by Phoenix999.)
Post: #2
RE: Script-fu (gimp-context-set-brush-size size) ain't working
It's in Gimp 2.8 Script-fu. I appreciate your code (it's python though) for creating a brush. I'll copy and paste for my future reference, but I want to use the brushes included in the 2.8 version. They provide specific textures that I want to use in my scripts and when I share my scripts, the 3rd party only requires the 2.8 version for the scripts to work.
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Run script on action rchav 2 554 Aug 13, 2018 14:57
Last Post: rchav
  Script Fu Errors Gimp 2.10.4 lightsaber jd3481 1 401 Aug 2, 2018 05:13
Last Post: paynekj
  Script-fu script to conversion pdf to image 4ever 12 8,756 Jul 17, 2018 16:01
Last Post: paynekj
  GIMP Resynthesizer Plugin not working Mikkel Andersen 1 544 Jun 26, 2018 16:36
Last Post: paynekj
  Tablet issues with GIMP 2.10 Phoenisca 1 652 May 30, 2018 14:30
Last Post: paynekj

Forum Jump:


GIMP ForumPortalArchiveContactTermsRSS