0
私はPhotoshopスクリプトで非常に単純なタスクで問題が発生していますが、これはWeb上の他の場所には記載されていません。Photoshopスクリプトでレイヤーを切り抜く方法
既存の選択内容を反転し、現在のレイヤーの内容を削除してから、選択範囲を元に戻したいだけです。
もちろん、これはもっと大きなプログラムの一部です。興味があれば、私はすべての詳細を提供することができます。アップ
は私が作っています知っている:それは単にです... 私は答えを自分で見つけ// Get current document and current layer
var doc = app.activeDocument;
var activeLay = doc.activeLayer;
var a=0
// find the current layer and assign its code to the variable a
for(i=doc.layers.length-1; i >=0;)
{
if(doc.layers[i]==activeLay)
{
a=i;
alert("a"+a);
break;
}
else{ i--; }
alert ("i"+i);
}
// Now cycle remaining layer under the exsiting one, and jump the selection
// and delete the outer area of selection for each layer
for(i=a-1; i >=0;)
{
// make layer i active
doc.activeLayer=doc.layers[i];
alert ("active layer"+i);
// where is my selection in regards to the active layer?
var s = app.activeDocument.selection.bounds;
var xSo=s[0];
var ySo=s[1];
var xLo = activeLay.bounds[0].value;
var yLo = activeLay.bounds[1].value;
// I have to go from actual selection poisition to the NEXT layer... which i just made active...
DeltaX=xLo-s[0];
DeltaY=ySo-s[1];
doc.selection.translateBoundary(DeltaX,DeltaY);
//Now invert selection and delete
doc.selection.invert
doc.selection.fill (fillType, mode, 0, preserveTransparency) // ??? here what i cannot do?
doc.selection.invert
i--;
}
注: 'for'ループでグローバル変数を作成しています。 – gcampbell
ありがとうございますが、大きな問題ではないと思います... –