-
-
Save joonaspaakko/d3c8e4273271433bf2f90835bf65c172 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var doc = app.activeDocument; | |
doc.suspendHistory("Remove Normal Layers", "deletePixelLayers( doc )"); | |
function deletePixelLayers(target) | |
{ | |
try{ | |
var layers = target.layers; | |
for (var i = 0; i < layers.length; i++) | |
{ | |
var curLayer = layers[i]; | |
// Layer is a group | |
if ("LayerSet" == curLayer.typename) { | |
deletePixelLayers(curLayer); | |
} | |
// Layer is a NORMAL (Pixel) Layers | |
if (LayerKind.NORMAL == curLayer.kind | |
&& !curLayer.isBackgroundLayer) { | |
curLayer.remove(); // Delete the layer | |
--i; | |
}; | |
}; | |
}catch(e){ | |
; // do nothing | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment