Permalink
Browse files

Delete all layers which have the "link" icon selected. Rather an abus…

…e of the link icon, but might come in handy for quick deletion.
  • Loading branch information...
unhammer committed Aug 8, 2012
1 parent 2ef2239 commit 111f85568756108881726eb96702c99edb0b5117
Showing with 39 additions and 0 deletions.
  1. +39 −0 delete-linked.scm
View
@@ -0,0 +1,39 @@
+; This program is free software; you can redistribute it and/or modify
+; it under the terms of the GNU General Public License as published by
+; the Free Software Foundation; either version 2 of the License, or
+; (at your option) any later version.
+;
+; This program is distributed in the hope that it will be useful,
+; but WITHOUT ANY WARRANTY; without even the implied warranty of
+; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+; GNU General Public License for more details.
+
+;; Delete all linked layers.
+;;
+;
+
+(define (delete-linked-layers image)
+ (gimp-image-undo-group-start image)
+ (map (lambda (layer)
+ (if (zero? (car (gimp-drawable-get-linked layer))) ; if linked, this function returns '(0). Dunno why.
+ '()
+ (gimp-image-remove-layer image layer)))
+ (vector->list (cadr (gimp-image-get-layers image))))
+ (gimp-displays-flush)
+ (gimp-image-undo-group-end image))
+
+
+(script-fu-register "delete-linked-layers"
+ "Delete linked layers"
+ "Delete all linked layers (ignoring visibility)"
+ "Kevin Brubeck Unhammer"
+ "Kevin Brubeck Unhammer"
+ "January 2011"
+ "*"
+ SF-IMAGE "Image" 0
+ )
+
+(script-fu-menu-register "delete-linked-layers"
+ "<Image>/Layer"
+ )
+

0 comments on commit 111f855

Please sign in to comment.