feat: AI套图分层方案 + Gemini集成 - 4种图案类型处理 + 正片叠底 + 宽高比 + 模型选择
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
51
PSMARK代码块/批量建立蒙蔽.jsx
Normal file
51
PSMARK代码块/批量建立蒙蔽.jsx
Normal file
@@ -0,0 +1,51 @@
|
||||
function 删除图层3()
|
||||
{
|
||||
app.activeDocument.suspendHistory("Establish a mask", "批量建立蒙版()");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function 批量建立蒙版(){
|
||||
|
||||
var doc = app.activeDocument; // 获取当前文档
|
||||
// 遍历所有图层
|
||||
for (var i = 0; i < doc.artLayers.length; i++) {
|
||||
var layer = doc.artLayers[i];
|
||||
// alert(layer.name); // 显示图层名称
|
||||
var layname=layer.name
|
||||
var 图层名称选择 = app.activeDocument.layers.getByName(layname);
|
||||
app.activeDocument.activeLayer = 图层名称选择;
|
||||
载入选区();
|
||||
添加图层蒙版();
|
||||
}
|
||||
|
||||
function 载入选区() //载入选区
|
||||
{
|
||||
var d = new ActionDescriptor();
|
||||
var r = new ActionReference();
|
||||
r.putProperty(stringIDToTypeID("channel"), stringIDToTypeID("selection"));
|
||||
d.putReference(stringIDToTypeID("null"), r);
|
||||
var r1 = new ActionReference();
|
||||
r1.putEnumerated(stringIDToTypeID("channel"), stringIDToTypeID("channel"), stringIDToTypeID("transparencyEnum"));
|
||||
d.putReference(stringIDToTypeID("to"), r1);
|
||||
executeAction(stringIDToTypeID("set"), d, DialogModes.NO);
|
||||
|
||||
}
|
||||
|
||||
|
||||
function 添加图层蒙版() //添加图层蒙版
|
||||
{
|
||||
|
||||
var d = new ActionDescriptor();
|
||||
d.putClass(stringIDToTypeID("new"), stringIDToTypeID("channel"));
|
||||
var r = new ActionReference();
|
||||
r.putEnumerated(stringIDToTypeID("channel"), stringIDToTypeID("channel"), stringIDToTypeID("mask"));
|
||||
d.putReference(stringIDToTypeID("at"), r);
|
||||
d.putEnumerated(stringIDToTypeID("using"), stringIDToTypeID("userMaskEnabled"), stringIDToTypeID("revealSelection"));
|
||||
executeAction(stringIDToTypeID("make"), d, DialogModes.NO);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user