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.
This commit is contained in:
Thomas Manni 2018-05-15 11:29:30 +02:00
parent fbcb43ef8b
commit 9c547e7d71
1 changed files with 10 additions and 10 deletions

View File

@ -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)
)
)