问题
This script converts the active layer into a smart object:
createSmartObject(app.activeDocument.activeLayer);
function createSmartObject(layer)
{
var idnewPlacedLayer = stringIDToTypeID( 'newPlacedLayer' );
executeAction(idnewPlacedLayer, undefined, DialogModes.NO);
}
My question: Is there a shorter way to code this?
回答1:
createSmartObject();
function createSmartObject() {
var idnewPlacedLayer = stringIDToTypeID( 'newPlacedLayer' );
executeAction(idnewPlacedLayer, undefined, DialogModes.NO);
}
You don't need to pass the layer into the function--it acts upon whatever the current active layer happens to be.
来源:https://stackoverflow.com/questions/40617888/how-can-i-convert-layer-to-smart-object-in-photoshop