I'm finally up and running with a basic skeleton of code. I've counted the number of layers (using keyNumberLayers) in a document, etc.
Now I'm stuck again-- I'm trying to count the number of Layer Comps. I thought this would be something easily available in classDocument, but I don't see any such thing.
How would someone go about doing this?
Counting Layer Comps
Using javascript, this can be done with:
val = app.activeDocument.layerComps.length
Is there a way to get to this app global when making an automation plugin?
Counting Layer Comps
See the Getter automation plug-in example. This shows you all the information you can 'get' from Photoshop. There is also the properties suite but for layer comps you want to look at Getter.
Tom,
Could you elaborate on the Properties suite you mentioned?
I need to get rather basic info from all layers in a given document - like it's name, but I find iterating through a document with about 50 layers seems to take about 5 seconds, and I'm probably going to need to handle documents with hundreds of layers.
I use the following code in a loop to get the info I need:
PIUGetInfoByIndexIndex(layerIndex, docIndex, classLayer, classDocument, keyName, name, %26amp;nameLen);
Is there a faster way or some lighter weight routine which I can use? I adapted my code from the Getter example.
The only reference to the properties suite I found was the SPProperties Suite which seemed to deal with Plugin properties, not document properties.
On a related note, I also need a list of selected layers - the only way I know is to
1) save layer visibility state
2) make all layers invisible
3) make selected layers visible (since this can be done through an API call)
4) loop through layers, the visible layers are the selected layers
5) restore layer visibility
This is a technique used in one of xbytor's scripts.
Is there a faster way? I'm anticipating a massive delay here - as I'm actually going to have to ask PS to change layer visibility *two* times in addition to obtaining layer information, which already takes too long.
Any assistance or suggestions appreciated,
Brian.
P.S I apologize for not starting a new topic, I found my questions complimentary to this thread; if inappropriate, I can post again.
Subscribe to:
Post Comments
(Atom)
No comments:
Post a Comment