Created
June 15, 2012 08:53
-
-
Save sacrifs/2935495 to your computer and use it in GitHub Desktop.
レイヤーセット(フォルダ)を消すJSX
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
/** | |
* レイヤーセット(フォルダ)を消すJSX | |
*/ | |
var _layers = []; | |
var _layerSets = []; | |
main(); | |
function main(){ | |
var document = activeDocument; | |
var layers = document.layers; | |
getLayer(layers); | |
var num = _layers.length; | |
var j = 0; | |
for(var i = 0; i < num; i++){ | |
var layer = _layers[i]; | |
layer.moveAfter(document.layers[j++]); | |
} | |
num = _layerSets.length; | |
for(j = 0; j < num; j++){ | |
_layerSets[j].remove(); | |
} | |
} | |
function getLayer(layers){ | |
var num = layers.length; | |
for(var i = 0; i < num; i++){ | |
var layer = layers[i]; | |
if(layer.typename == "LayerSet"){ | |
getLayer(layer.layers); | |
_layerSets.push(layer); | |
} | |
else{ | |
_layers.push(layer); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment