From 4d4639b8f369c5b1cd2ec11cb5a7fcfc3d52818d Mon Sep 17 00:00:00 2001 From: bootchk Date: Sat, 9 Dec 2023 11:02:10 -0500 Subject: [PATCH] Fix scripts calling obsolete gimp-brush-delete Now use gimp-resource-delete Drive-by fix of bad call to gimp-context-set-pattern. Fixes other calls to gimp-font-delete, etc. in a test script. Partly fixes 9867. --- plug-ins/script-fu/scripts/carve-it.scm | 22 ++++++++-------- plug-ins/script-fu/scripts/chrome-it.scm | 25 ++++++++++--------- .../test/resource-class/resource-class.scm | 7 +++--- 3 files changed, 28 insertions(+), 26 deletions(-) diff --git a/plug-ins/script-fu/scripts/carve-it.scm b/plug-ins/script-fu/scripts/carve-it.scm index 8f57d0f1a7..bcc8922eab 100644 --- a/plug-ins/script-fu/scripts/carve-it.scm +++ b/plug-ins/script-fu/scripts/carve-it.scm @@ -53,7 +53,7 @@ (offy (carve-scale size 0.25)) (feather (carve-scale size 0.3)) (brush-size (carve-scale size 0.3)) - (brush-name (car (gimp-brush-new "Carve It"))) + (brush (car (gimp-brush-new "Carve It"))) (mask (car (gimp-channel-new img width height "Engraving Mask" 50 '(0 0 0)))) (inset-gamma (calculate-inset-gamma (car (gimp-item-get-image bg-layer)) bg-layer)) (mask-fat 0) @@ -103,15 +103,15 @@ (gimp-image-insert-channel img mask-fat -1 0) (gimp-image-select-item img CHANNEL-OP-REPLACE mask-fat) - (gimp-brush-set-shape brush-name BRUSH-GENERATED-CIRCLE) - (gimp-brush-set-spikes brush-name 2) - (gimp-brush-set-hardness brush-name 1.0) - (gimp-brush-set-spacing brush-name 25) - (gimp-brush-set-aspect-ratio brush-name 1) - (gimp-brush-set-angle brush-name 0) - (cond (<= brush-size 17) (gimp-brush-set-radius brush-name (\ brush-size 2)) - (else gimp-brush-set-radius brush-name (\ 19 2))) - (gimp-context-set-brush brush-name) + (gimp-brush-set-shape brush BRUSH-GENERATED-CIRCLE) + (gimp-brush-set-spikes brush 2) + (gimp-brush-set-hardness brush 1.0) + (gimp-brush-set-spacing brush 25) + (gimp-brush-set-aspect-ratio brush 1) + (gimp-brush-set-angle brush 0) + (cond (<= brush-size 17) (gimp-brush-set-radius brush (\ brush-size 2)) + (else gimp-brush-set-radius brush (\ 19 2))) + (gimp-context-set-brush brush) (gimp-context-set-foreground '(255 255 255)) (gimp-drawable-edit-stroke-selection mask-fat) @@ -208,7 +208,7 @@ (gimp-item-set-name cast-shadow-layer _"Cast Shadow") (gimp-item-set-name inset-layer _"Inset") - (gimp-brush-delete brush-name) + (gimp-resource-delete brush) (gimp-display-new img) (gimp-image-undo-enable img) diff --git a/plug-ins/script-fu/scripts/chrome-it.scm b/plug-ins/script-fu/scripts/chrome-it.scm index 6e0d174701..6acd89386d 100644 --- a/plug-ins/script-fu/scripts/chrome-it.scm +++ b/plug-ins/script-fu/scripts/chrome-it.scm @@ -90,7 +90,7 @@ (offy2 (sota-scale size (- 0.25) chrome-factor)) (feather (sota-scale size 0.5 chrome-factor)) (brush-size (sota-scale size 0.5 chrome-factor)) - (brush-name (car (gimp-brush-new "Chrome It"))) + (brush (car (gimp-brush-new "Chrome It"))) (mask (car (gimp-channel-new img width height "Chrome Stencil" 50 '(0 0 0)))) (bg-layer (car (gimp-layer-new img width height GRAY-IMAGE _"Background" 100 LAYER-MODE-NORMAL))) (layer1 (car (gimp-layer-new img banding-width banding-height banding-type _"Layer 1" 100 LAYER-MODE-NORMAL))) @@ -98,6 +98,7 @@ (layer3 (car (gimp-layer-new img width height GRAYA-IMAGE _"Layer 3" 100 LAYER-MODE-NORMAL))) (shadow (car (gimp-layer-new img width height GRAYA-IMAGE _"Drop Shadow" 100 LAYER-MODE-NORMAL))) (layer-mask 0) + (marble-pattern (car (gimp-pattern-get-by-name "Marble #1"))) ) (gimp-context-push) @@ -164,15 +165,15 @@ (set! layer2 (car (gimp-layer-copy layer1 TRUE))) (gimp-image-insert-layer img layer2 0 0) - (gimp-brush-set-shape brush-name BRUSH-GENERATED-CIRCLE) - (gimp-brush-set-spikes brush-name 2) - (gimp-brush-set-hardness brush-name 1.0) - (gimp-brush-set-spacing brush-name 25) - (gimp-brush-set-aspect-ratio brush-name 1) - (gimp-brush-set-angle brush-name 0) - (cond (<= brush-size 17) (gimp-brush-set-radius brush-name (\ brush-size 2)) - (else gimp-brush-set-radius brush-name (\ 19 2))) - (gimp-context-set-brush brush-name) + (gimp-brush-set-shape brush BRUSH-GENERATED-CIRCLE) + (gimp-brush-set-spikes brush 2) + (gimp-brush-set-hardness brush 1.0) + (gimp-brush-set-spacing brush 25) + (gimp-brush-set-aspect-ratio brush 1) + (gimp-brush-set-angle brush 0) + (cond (<= brush-size 17) (gimp-brush-set-radius brush (\ brush-size 2)) + (else gimp-brush-set-radius brush (\ 19 2))) + (gimp-context-set-brush brush) (gimp-context-set-foreground '(255 255 255)) (gimp-drawable-edit-stroke-selection layer-mask) @@ -183,7 +184,7 @@ (gimp-drawable-edit-fill shadow FILL-BACKGROUND) (gimp-selection-all img) - (gimp-context-set-pattern "Marble #1") + (gimp-context-set-pattern marble-pattern) (gimp-drawable-edit-fill bg-layer FILL-PATTERN) (gimp-selection-none img) @@ -228,7 +229,7 @@ (gimp-image-remove-channel img mask) - (gimp-brush-delete brush-name) + (gimp-resource-delete brush) (gimp-display-new img) (gimp-image-undo-enable img) diff --git a/plug-ins/script-fu/scripts/test/resource-class/resource-class.scm b/plug-ins/script-fu/scripts/test/resource-class/resource-class.scm index cbd3b721c8..19b6efac58 100644 --- a/plug-ins/script-fu/scripts/test/resource-class/resource-class.scm +++ b/plug-ins/script-fu/scripts/test/resource-class/resource-class.scm @@ -134,9 +134,10 @@ (gimp-context-set-pattern pattern) (gimp-message "Expect delete methods work without error") - (gimp-brush-delete brushnew) - (gimp-gradient-delete gradientnew) - (gimp-palette-delete palettenew) + ; call superclass method + (gimp-resource-delete brushnew) + (gimp-resource-delete gradientnew) + (gimp-resource-delete palettenew) (gimp-message "Expect var holding deleted resource is still defined, but is invalid reference") ; Returns (0), not #f