Copy link to clipboard
Copied
It's possibile to acces a layer style (ex. drop shadow) from a filter plugin?
Copy link to clipboard
Copied
Tom may correct me on this, but I don't think that there is a way to do that.
Layer Styles are something like layer blend modes -- applied to the pixel contents during blending, and not considered part of the layer content.
Copy link to clipboard
Copied
Can I still access the information of this Layer Styles?
Copy link to clipboard
Copied
Yes, from an automation plugin you can get the parameters to the layer styles. On the layer object (descriptor) there is a
keyLayerEffects, classLayerFXVisible object (descriptor). That has objects (descriptors) such as keyInnerGlow or keyInnerShadow. Build the Getter plug-in and install it. Make your file with your layer effects. Then run getter from the File > Automate > Getter menu and you will get a Getter.log file on your desktop that shows all the things available in your document. Remember that the Getter code is reusing the Listener code so there is a bit more work for using the Getter output. All the ->Put* routines need to be converted to ->Get* routines and you need to invert the order of the calls. Here is some code that I just did this exercise on, in JavaScript, but you should get the idea. This code gets all the brush toolPresets and sees if the Preset I'm looking for is present. You can find the 'keys' in the PITerminology.h and PISTringTerminology.h files in your SDK. 'capp' is classApplication for example. You would want 'Lyr ' for classLayer.
// find if the following brush is loaded
FindBrushPresetByName( "foo" ).toString() + " : " + FindBrushPresetByName( "Restore Brush - PA" ).toString();
 
function FindBrushPresetByName( brushPresetName ) {
var ref = new ActionReference();
var presetManagerStrID = stringIDToTypeID( 'presetManager');
ref.putProperty( charIDToTypeID( 'Prpr' ), presetManagerStrID );
ref.putEnumerated( charIDToTypeID( 'capp' ), charIDToTypeID( 'Ordn' ), charIDToTypeID( 'Trgt' ) );
var desc = executeActionGet( ref );
if ( desc.count > 0 && desc.hasKey( presetManagerStrID ) ) {
var list = desc.getList( presetManagerStrID );
var toolPresetClassID = stringIDToTypeID( 'toolPreset' );
for ( var i = 0; i < list.count; i++ ) {
var listType = list.getObjectType( i );
if ( listType == toolPresetClassID ) {
var toolDescObj = list.getObjectValue( i );
var keyName = charIDToTypeID( 'Nm ' );
if ( toolDescObj.count > 0 && toolDescObj.hasKey( keyName ) ) {
var toolNameList = toolDescObj.getList( keyName );
for ( var ii = 0; ii < toolNameList.count; ii++ ) {
var toolName = toolNameList.getString( ii );
if ( toolName == brushPresetName ) {
return true;
}
}
}
}
}
}
return false;
}
Copy link to clipboard
Copied
And to answer your question, Chris is correct. Not from a filter plugin. My code will only work from an automation plugin or script.