Copiar link para a área de transferência
Copiado
Does anyone have, or know if it's possible to remove all layer effects with a script? (On every layer in the document)
Here is the example
This PSD is converted from SVG by affinity designer, unfortunately all layer have hidden effects. Currently I delete this effect one by one, it would be great if there is a script that can delete all layer effect on document at once.
Copiar link para a área de transferência
Copiado
Ah my bad, Jarda Bereza have the script. Thank you Magic scripts for Photoshop
Copiar link para a área de transferência
Copiado
i have a stupid idea
try{
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var applicationDesc = executeActionGet(ref);
var theNumber = applicationDesc.getInteger(stringIDToTypeID("numberOfLayers"));
for (var m = 0; m <= theNumber; m++)
{
var ref = new ActionReference();
ref.putIndex( charIDToTypeID( "Lyr " ), m);
var layerDesc = executeActionGet(ref);
var isBackground = layerDesc.getBoolean(stringIDToTypeID("background"));
var theName = layerDesc.getString(stringIDToTypeID('name'));
SelectLayer(theName,m);
if ( isBackground != true && haslayerEffects())
{
disableLayerStyle();
}
}
}catch(e){alert(e)}
function haslayerEffects()
{
try {
var d = new ActionDescriptor();
var r = new ActionReference();
r.putEnumerated(stringIDToTypeID("layer"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
var options = executeActionGet(r);
return options.hasKey(stringIDToTypeID("layerEffects"))
}
catch (e) {alert(e) }
}
function disableLayerStyle()
{
try {
var d = new ActionDescriptor();
var r = new ActionReference();
r.putEnumerated(stringIDToTypeID("layer"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
d.putReference(stringIDToTypeID("null"), r);
executeAction(stringIDToTypeID("disableLayerStyle"), d, DialogModes.NO);
}
catch (e) {alert(e) }
}
function SelectLayer(Layername,ID)
{
try{
var r = new ActionReference();
var l = new ActionList();
var d = new ActionDescriptor();
r.putName(charIDToTypeID("Lyr "),Layername);
d.putReference( charIDToTypeID( "null" ), r );
l.putInteger(ID);
d.putList( charIDToTypeID( "LyrI" ), l );
executeAction( charIDToTypeID( "slct" ), d, DialogModes.NO );
}
catch(e){ alert(e); }
}
Copiar link para a área de transferência
Copiado
Make an adjustment
try{
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var applicationDesc = executeActionGet(ref);
var theNumber = applicationDesc.getInteger(stringIDToTypeID("numberOfLayers"));
for (var m = 0; m <= theNumber; m++)
{
var ref = new ActionReference();
ref.putIndex( charIDToTypeID( "Lyr " ), m);
var layerDesc = executeActionGet(ref);
var isBackground = layerDesc.getBoolean(stringIDToTypeID("background"));
var ID = layerDesc.getInteger(stringIDToTypeID('layerID'));
SelectLayer(ID);
if ( isBackground != true && haslayerEffects())
{
disableLayerStyle();
}
}
}catch(e){alert(e)}
function haslayerEffects()
{
try {
var d = new ActionDescriptor();
var r = new ActionReference();
r.putEnumerated(stringIDToTypeID("layer"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
var options = executeActionGet(r);
return options.hasKey(stringIDToTypeID("layerEffects"))
}
catch (e) {alert(e) }
}
function disableLayerStyle()
{
try {
var d = new ActionDescriptor();
var r = new ActionReference();
r.putEnumerated(stringIDToTypeID("layer"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
d.putReference(stringIDToTypeID("null"), r);
executeAction(stringIDToTypeID("disableLayerStyle"), d, DialogModes.NO);
}
catch (e) {alert(e) }
}
function SelectLayer(ID)
{
try{
var r = new ActionReference();
var d = new ActionDescriptor();
// r.putName(stringIDToTypeID("layer"), "图层 2");
r.putIdentifier(stringIDToTypeID("layer"), ID);
// r.putIndex(stringIDToTypeID("layer"), "0");
d.putReference(stringIDToTypeID("null"), r);
executeAction( charIDToTypeID( "slct" ), d, DialogModes.NO );
}
catch(e){ alert(e); }
}
Copiar link para a área de transferência
Copiado
It is better to use "disableLayerFX" instead "disableLayerStyle"
to not change layer blending mode and opacity.
Copiar link para a área de transferência
Copiado
This will apply all effects (if you need it of course)
runMenuItem(stringIDToTypeID("selectAllLayers"));
var d = new ActionDescriptor();
var r = new ActionReference();
r.putEnumerated(stringIDToTypeID("layer"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
d.putReference(stringIDToTypeID("null"), r);
d.putEnumerated(stringIDToTypeID("what"), stringIDToTypeID("rasterizeItem"), stringIDToTypeID("layerStyle"));
executeAction(stringIDToTypeID("rasterizeLayer"), d, DialogModes.NO);
runMenuItem(stringIDToTypeID("selectNoLayers"));
upd.
var d = new ActionDescriptor();
var r = new ActionReference();
r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("layerFXVisible"));
r.putEnumerated(stringIDToTypeID("document"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
d.putReference(stringIDToTypeID("null"), r);
var d1 = new ActionDescriptor();
d1.putBoolean(stringIDToTypeID("layerFXVisible"), false);
d.putObject(stringIDToTypeID("to"), stringIDToTypeID("layerFXVisible"), d1);
executeAction(stringIDToTypeID("set"), d, DialogModes.NO);
Copiar link para a área de transferência
Copiado
we made a Photoshop plug-in that can do this. The unlimited version is 12$.
Full Version (12$):
https://exchange.adobe.com/apps/cc/c36e02fb/swift
Trial Version (Limited to 5 Actions):
https://exchange.adobe.com/apps/cc/412c1dcd/swift-trial-version
Its also a big help with getting the layers selected.
Encontre mais inspiração, eventos e recursos na nova comunidade da Adobe
Explore agora