Here is a first cut at retrieving LayerStyle ActionDescriptors. It's now possible with a simple call.
Code: Select allvar desc = Styles.getLayerStyleActionDecriptor(doc, layer);
I have code written up that will also set the LayerStyle, which would be useful if you just wanted to change some specific values in the current layer style. However, there appears to be a yet another PS bug in the toStream/fromStream code that I have found but not yet found a workaround for. I'll work on it later.
Let me know if you find any bugs with this. I have only tested it with a few test cases so far and wouldn't be surprised if there are some cases that break it.
-X
Styles.js
Styles.js
Here's a new rev of Styles.js. This has Styles.setLayerStyleDescriptor working. The test code for this illustrates how easy it is to extract a layer style and set it.
We now 'officially' have read/write access to layer style attributes.
There may still be problems if the layer style has an embedded pattern or gradient or some other construct, but I think I've dealt with these appropriately.
One note: Styles.getLayerStyleDescriptor had a latent bug that would occur if the layer did not have a layer style. It now returns 'undefined' if there is no layer style.
-X
We now 'officially' have read/write access to layer style attributes.
There may still be problems if the layer style has an embedded pattern or gradient or some other construct, but I think I've dealt with these appropriately.
One note: Styles.getLayerStyleDescriptor had a latent bug that would occur if the layer did not have a layer style. It now returns 'undefined' if there is no layer style.
-X
Styles.js
Hi X,
Your post at the Abode fourn about how to determine current brush settings got me thinking about a releated topic.
I have been trying off and on to find a way to get information about a docs user slices. I can see the info by looking at the file with a hex editor. I can also get exiftool to extract the slices tag and save just that to a file.
Can you give me a rough outline of how I can determine if what I am seeing is the slices's descriptor?
I think that I will be able to read in the descriptor from the information you have in other posts. I'm just not clear on how to determine where a descriptor starts in a file.
Mike
Your post at the Abode fourn about how to determine current brush settings got me thinking about a releated topic.
I have been trying off and on to find a way to get information about a docs user slices. I can see the info by looking at the file with a hex editor. I can also get exiftool to extract the slices tag and save just that to a file.
Can you give me a rough outline of how I can determine if what I am seeing is the slices's descriptor?
I think that I will be able to read in the descriptor from the information you have in other posts. I'm just not clear on how to determine where a descriptor starts in a file.
Mike
Styles.js
Styles.js is the way to get it done, as near as I can remember
You should also get familiar with the code I've got for converting ActionDescriptors to XML. That's the easiest way to decode LayerStyles.
Beyond these things, I don't know if there's any help unless it's in the SDK.
-X
You should also get familiar with the code I've got for converting ActionDescriptors to XML. That's the easiest way to decode LayerStyles.
Beyond these things, I don't know if there's any help unless it's in the SDK.
-X
Styles.js
I am somewhat new to scripting, and I have run into the problem where I need to create/alter layer styles on the fly. This code is pretty much the ONLY thing I have found on the web to help me with this... but my head absolutely implodes on itself when I try to understand it and use it. Can anyone explain how I would use this to say, make a layer's outer glow visible (but keep invisible its other layer effects) and then change the glow's color? I just do not understand