..
For example a list of attached smart filters (with indexes), and values?
How to Get SmartObject info?
Re: How to Get SmartObject info?
Looping through smart layers with filters in smart object and getting laeyrs and filters names should't be problem, but all those values inside filter had to be long way throughtout Action Manager objects and then what even harder great number of properties.
I hope this time excellent coders like xbytor or Paul Riggott finally come and show us the magic!
I hope this time excellent coders like xbytor or Paul Riggott finally come and show us the magic!
- DavideBarranca
- Posts: 16
- Joined: Tue Jul 26, 2016 2:12 pm
Re: How to Get SmartObject info?
As an example, I've created a flatten file with a single Background layer; converted to Smart Object, and applied Gaussian Blur and Solarize Smart Filters.
The following code:
Outputs in the console:
It might not work under all circumstances but should give you a head start.
Regards,
Davide Barranca
The following code:
Code: Select all
var ref = new ActionReference ();
ref.putProperty (stringIDToTypeID ("property"), stringIDToTypeID ("smartObject"));
ref.putEnumerated (stringIDToTypeID ("layer"), stringIDToTypeID ("ordinal"), stringIDToTypeID ("targetEnum"));
var smartObjectDesc = executeActionGet (ref).getObjectValue (stringIDToTypeID ("smartObject"));
var filtersList = smartObjectDesc.getList(stringIDToTypeID ("filterFX"))
for (var i = 0, _len = filtersList.count; i < _len; i++) {
var smartFilter = filtersList.getObjectValue(i)
var filterName = smartFilter.getString(stringIDToTypeID ("name"));
$.writeln("Filter: " + filterName)
try {
var filterDesc = smartFilter.getObjectValue (stringIDToTypeID("filter"));
// E.g. for Gaussian Blur:
var radius = filterDesc.getUnitDoubleValue(stringIDToTypeID("radius"))
$.writeln("Radius: " + radius)
} catch(e) {}
}
Code: Select all
Filter [0]: Gaussian Blur...
Radius: 5
Filter [1]: Solarize
Regards,
Davide Barranca
Re: How to Get SmartObject info?
Great! Thank you!
Say plz, can I find some property for identification smart-effects (like "id")? Becouse "name" is depends on the localization.
Say plz, can I find some property for identification smart-effects (like "id")? Becouse "name" is depends on the localization.
Re: How to Get SmartObject info?
Another question
Now I can get the value of the radius (thanks Davide), and how to get the opacity and blending mode in a Smart-Filter?
Please, help
Now I can get the value of the radius (thanks Davide), and how to get the opacity and blending mode in a Smart-Filter?
Please, help
