/usr/share/gimp/2.0/scripts/bates-layers-attributes.scm is in gimp-plugin-registry 7.20140602ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | ;
; The GIMP -- an image manipulation program
; Copyright (C) 1995 Spencer Kimball and Peter Mattis
;
; Mass edit layers attributes script for GIMP 2.4
; Created by Daniel Bates
;
; Tags: public domain, layers, edit, attributes
;
; Author statement:
;
; Script designed to edit layer attributes for the specified layer range
; Layer name, mode, opacity, visible, linked and alpha lock can all be optionally set
;
; --------------------------------------------------------------------
; Distributed by Gimp FX Foundry project
; --------------------------------------------------------------------
; - Changelog -
;
; --------------------------------------------------------------------
;
; This script is released into the public domain.
; You may redistribute and/or modify this script or extract segments without prior consent.
; This script is distributed in the hope of being useful
; but without warranty, explicit or otherwise.
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Define Script
(define (script-fu-modify-layers-attributes theImage theDraw theLayer1 theLayer2 ENcheck theLayerName ELMcheck theLayerMode EOcheck theLayerOpacity EVcheck theLayerVisible ELcheck theLayerLink EMTcheck theLayerMT)
; Define Variables
(let*
(
(theNumber 0)
(theRepeat 0)
(theName 0)
(theLayerRef 0)
)
; If the end layer is set below the start layer create an error message and terminate
(if (> theLayer1 theLayer2)
(begin
(set! theLayerRef (car (gimp-message-get-handler)))
(gimp-message-set-handler 0)
(gimp-message "Error: End layer number must be set higher than start layer number!")
(gimp-message-set-handler theLayerRef))
(begin
; Begin an undo group
(gimp-image-undo-group-start theImage)
; Get the number of layers in an image and set to a variable
(set! theNumber (car (gimp-image-get-layers theImage)))
; If layer2 is set above total layers change layer2 value to the total number of layers
(if (> theLayer2 theNumber)
(set! theLayer2 theNumber))
; Set the repeat variable by subtracting the user input values from the total number of layers
(set! theRepeat (+ (- theLayer2 theLayer1) 1))
; Adjust the value received for layer mode for direct input
(if (> theLayerMode 1)
(set! theLayerMode (+ theLayerMode 1)))
; Adjust the value received for visible for direct input
(if (= theLayerVisible 0)
(set! theLayerVisible 1)
(set! theLayerVisible 0))
; Set up variable for setting active layers and attributes
(set! theLayerRef (cadr (gimp-image-get-layers theImage)))
; Alter theNumber for use in setting active layers and attributes
(set! theNumber (- theNumber (- theLayer1 1)))
; Begin loop and continue while repeat is higher than zero
(while (> theRepeat 0)
; Edit layer name if requested by the user
(if (= ENcheck TRUE)
(gimp-drawable-set-name (aref theLayerRef (- theNumber 1)) (string-append theLayerName "#1")))
; Edit layer mode if requested by the user
(if (= ELMcheck TRUE)
(gimp-layer-set-mode (aref theLayerRef (- theNumber 1)) theLayerMode))
; Edit opacity if requested by the user
(if (= EOcheck TRUE)
(gimp-layer-set-opacity (aref theLayerRef (- theNumber 1)) theLayerOpacity))
; Edit layer visible property if requested by the user
(if (= EVcheck TRUE)
(gimp-drawable-set-visible (aref theLayerRef (- theNumber 1)) theLayerVisible))
; Edit linked property if requested by the user
(if (= ELcheck TRUE)
(gimp-drawable-set-linked (aref theLayerRef (- theNumber 1)) theLayerLink))
; Edit maintain transparency property if requested by the user
(if (= EMTcheck TRUE)
(gimp-layer-set-lock-alpha (aref theLayerRef (- theNumber 1)) theLayerMT))
; Alter variables ready for checking for next layer and applying to next layer
; (set! theLayer (+ theLayer 1))
(set! theNumber (- theNumber 1))
(set! theRepeat (- theRepeat 1))
)
; Update visual display
(gimp-displays-flush)
; End undo group
(gimp-image-undo-group-end theImage)
))
))
; Register script
(script-fu-register "script-fu-modify-layers-attributes"
_"Edit Attributes of Layers..."
_"Edits layer attributes of the specified layer range"
"Daniel Bates"
"Daniel Bates"
"Dec 2007"
"*"
SF-IMAGE "SF-IMAGE" 0
SF-DRAWABLE "SF-DRAWABLE" 0
SF-ADJUSTMENT _"Start at which layer?" '(1 1 2000 1 5 0 1)
SF-ADJUSTMENT _"End at which layer?" '(2 1 2000 1 5 0 1)
SF-TOGGLE _"Edit Layer Name?" FALSE
SF-STRING "New Layer Name" "Layer"
SF-TOGGLE _"Edit layer modes?" TRUE
SF-OPTION _"New Layer Mode" '(_"Normal" _"Dissolve" _"Multiply" _"Screen" _"Overlay" _"Difference" _"Addition" _"Subtract" _"Darken Only" _"Lighten Only" _"Hue" _"Saturation" _"Color" _"Value" _"Divide" _"Dodge" _"Burn" _"Hard Light" _"Soft Light" _"Grain Extract" _"Grain Merge")
SF-TOGGLE _"Edit opacity?" TRUE
SF-ADJUSTMENT _"New Opacity" '(100 0 100 1 10 0 1)
SF-TOGGLE _"Edit visible property?" TRUE
SF-OPTION _"New Visible Property" '(_"Show Layers" _"Hide Layers")
SF-TOGGLE _"Edit linked property?" TRUE
SF-OPTION _"New Linked Property" '(_"Unlink Layers" _"Link Layers")
SF-TOGGLE _"Edit maintain transparency property?" TRUE
SF-OPTION _"Maintain Transparency?" '(_"No" _"Yes")
)
(script-fu-menu-register "script-fu-modify-layers-attributes"
"<Image>/FX-Foundry/Multi-Layer Tools")
|