[gimp/wip/Jehan/layers-dockable-refresh: 65/105] plug-ins: fix select-to-brush script.




commit d90eb0fed256a691093124c47972f629efc80608
Author: Jehan <jehan girinstud io>
Date:   Sun Jun 20 12:22:32 2021 +0200

    plug-ins: fix select-to-brush script.
    
    The following calls needed to be updated:
    gimp-image-set-selected-layers, gimp-edit-copy, gimp-edit-paste and
    file-gbr-save.

 plug-ins/script-fu/scripts/select-to-brush.scm | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/plug-ins/script-fu/scripts/select-to-brush.scm b/plug-ins/script-fu/scripts/select-to-brush.scm
index c4ccf874be..8973ea547b 100644
--- a/plug-ins/script-fu/scripts/select-to-brush.scm
+++ b/plug-ins/script-fu/scripts/select-to-brush.scm
@@ -62,7 +62,7 @@
         )
     )
 
-    (gimp-edit-copy drawable)
+    (gimp-edit-copy 1 (make-vector 1 drawable))
 
     (set! brush-draw-type
           (if (= type GRAYA-IMAGE)
@@ -98,7 +98,11 @@
         (gimp-drawable-fill brush-draw FILL-TRANSPARENT)
     )
 
-    (let ((floating-sel (car (gimp-edit-paste brush-draw FALSE))))
+    (let* (
+           (pasted (gimp-edit-paste brush-draw FALSE))
+           (num-pasted (car pasted))
+           (floating-sel (aref (cadr pasted) (- num-pasted 1)))
+          )
       (gimp-floating-sel-anchor floating-sel)
     )
 
@@ -108,7 +112,7 @@
                                    (number->string image)
                                    ".gbr"))
 
-    (file-gbr-save 1 brush-image brush-draw filename2 "" spacing name)
+    (file-gbr-save 1 brush-image 1 (make-vector 1 brush-draw) filename2 spacing name)
 
     (if (= from-selection TRUE)
         (begin
@@ -118,7 +122,7 @@
     )
 
     (gimp-image-undo-enable image)
-    (gimp-image-set-active-layer image drawable)
+    (gimp-image-set-selected-layers image 1 (make-vector 1 drawable))
     (gimp-image-delete brush-image)
     (gimp-displays-flush)
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]