It seems getNumberOfLayer() is quite slow when you have even a moderately complex document (another thing I just don't get).
It's that bad, actually. Doing it via Layers/LayerSets would be painfully slow in a doc with a large number of layers.
Also, instead of checking the layer name for the the end-of-layerset, I am now using the layer type:
Code: Select all//
// returns one of:
// sTID('layerSectionStart') Start of a layer set
// sTID('layerSectionEnd') End of a layer set
// sTID('layerSectionConent') A content layer
//
function getLayerType(doc, idx) {
var desc = getLayerDescriptorByIndex(doc, idx);
return desc.getEnumerationValue(sTID('layerSection'));
};
index of active layer
index of active layer
xbytor wrote:It's that bad, actually.
Did you mean to say it's not that bad? Or were you agreeing that, yes, it really is that bad.
I find it pretty unbearable. I use Photoshop to work with scientific data, and on a 4250x4250 pixel document with ~16 image layers organized in various layer sets, according to the ESTK profiler it takes over 30 seconds to execute the Dcmn/Ordn/Trgt executeActionGet step so you can do a getInteger on NmbL. I'm guessing that a lot of that time is wasted calculating the histogram array that is accessible for each layer via ActionManager since PS puts up a "Building Histograms" progress bar during that time.
BTW, thanks for the tip on layerSection.
Did you mean to say it's not that bad? Or were you agreeing that, yes, it really is that bad.
I find it pretty unbearable. I use Photoshop to work with scientific data, and on a 4250x4250 pixel document with ~16 image layers organized in various layer sets, according to the ESTK profiler it takes over 30 seconds to execute the Dcmn/Ordn/Trgt executeActionGet step so you can do a getInteger on NmbL. I'm guessing that a lot of that time is wasted calculating the histogram array that is accessible for each layer via ActionManager since PS puts up a "Building Histograms" progress bar during that time.
BTW, thanks for the tip on layerSection.
index of active layer
Is there any documentation that explains more on Event ID codes? The reference guide has an appendix that shares the 4 digit codes, but is there anything out there with more detail instead of just recording with 'ScriptListener'?
Thanks.
Jay
Thanks.
Jay
index of active layer
null wrote:Did you mean to say it's not that bad?
Yep. That's what I meant. My bad.
I'm guessing that a lot of that time is wasted calculating the histogram array that is accessible for each layer via ActionManager since PS puts up a "Building Histograms" progress bar during that time.
I hadn't considered that, but that's probably right. I'll take a look and see if there is a technique that will let us get an attribute from the descriptor without getting the entire descriptor.
It may be faster in this case to loop through and get layer descriptors until you get an exception. You would need to subtract out the layerSectionEnd-type layers, of course. If you try this technique out, be sure to let us know what the performance is like.
-X
Yep. That's what I meant. My bad.
I'm guessing that a lot of that time is wasted calculating the histogram array that is accessible for each layer via ActionManager since PS puts up a "Building Histograms" progress bar during that time.
I hadn't considered that, but that's probably right. I'll take a look and see if there is a technique that will let us get an attribute from the descriptor without getting the entire descriptor.
It may be faster in this case to loop through and get layer descriptors until you get an exception. You would need to subtract out the layerSectionEnd-type layers, of course. If you try this technique out, be sure to let us know what the performance is like.
-X
index of active layer
jay wrote:Is there any documentation that explains more on Event ID codes? The reference guide has an appendix that shares the 4 digit codes, but is there anything out there with more detail instead of just recording with 'ScriptListener'?
For the most part, those of us here and on the Adobe PS Scripting forums are the reference, with occasional help from the Adobe engineering staff. Reading code generated by SL is how we typically find out when an Id is used.
-X
For the most part, those of us here and on the Adobe PS Scripting forums are the reference, with occasional help from the Adobe engineering staff. Reading code generated by SL is how we typically find out when an Id is used.
-X