简体   繁体   中英

How can I convert layer to smart object in Photoshop?

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM