[gimp] Bug 795958 - Effect (like "old photo") does not group undo information properly



commit 9c547e7d71047307a033f34b05f388c21cb31807
Author: Thomas Manni <thomas manni free fr>
Date:   Tue May 15 11:29:30 2018 +0200

    Bug 795958 - Effect (like "old photo") does not group undo information properly
    
    When working on the current image, enclose the script actions in an undo group.
    
    When working with a copy of the image, disable the undo stack of the new image
    at the beginning of the script and reenable it at the end.

 plug-ins/script-fu/scripts/old-photo.scm |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/plug-ins/script-fu/scripts/old-photo.scm b/plug-ins/script-fu/scripts/old-photo.scm
index 183f14d..eeb284c 100644
--- a/plug-ins/script-fu/scripts/old-photo.scm
+++ b/plug-ins/script-fu/scripts/old-photo.scm
@@ -25,18 +25,18 @@
 
 (define (script-fu-old-photo inImage inLayer inDefocus inBorderSize inSepia inMottle inCopy)
   (let (
-       (theImage 0)
+       (theImage (if (= inCopy TRUE) (car (gimp-image-duplicate inImage)) inImage))
        (theLayer 0)
        (theWidth 0)
        (theHeight 0)
        )
-  (gimp-image-undo-group-start inImage)
-  (gimp-selection-all inImage)
-  (set! theImage (if (= inCopy TRUE)
-                     (car (gimp-image-duplicate inImage))
-                     inImage)
+  (if (= inCopy TRUE)
+     (gimp-image-undo-disable theImage)
+     (gimp-image-undo-group-start theImage)
   )
 
+  (gimp-selection-all theImage)
+
   (set! theLayer (car (gimp-image-flatten theImage)))
   (if (= inDefocus TRUE)
       (plug-in-gauss-rle RUN-NONINTERACTIVE theImage theLayer 1.5 TRUE TRUE)
@@ -71,16 +71,16 @@
              (set! theLayer (car (gimp-image-flatten theImage)))
       )
   )
-
-
+  (gimp-selection-none theImage)
 
   (if (= inCopy TRUE)
       (begin  (gimp-image-clean-all theImage)
               (gimp-display-new theImage)
+              (gimp-image-undo-enable theImage)
       )
+      (gimp-image-undo-group-end theImage)
   )
-  (gimp-selection-none inImage)
-  (gimp-image-undo-group-end inImage)
+
   (gimp-displays-flush theImage)
   )
 )


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