此脚本将 Activity 层转换为智能对象:

createSmartObject(app.activeDocument.activeLayer);
function createSmartObject(layer)
{
    var idnewPlacedLayer = stringIDToTypeID( 'newPlacedLayer' );
    executeAction(idnewPlacedLayer, undefined, DialogModes.NO);
}

我的问题:是否有更短的代码编写方式?

最佳答案

createSmartObject();
function createSmartObject() {
    var idnewPlacedLayer = stringIDToTypeID( 'newPlacedLayer' );
    executeAction(idnewPlacedLayer, undefined, DialogModes.NO);
}

您无需将层传递给函数-它会作用于当前 Activity 层发生的任何变化。

08-24 16:27