Hey everyone, I toyed around with and learned a bit about java scripting for photoshop in the past couple of days in an attempt to automate some of my workflow here at work, especially when tweaking diffuse, spec, and normal maps all day ><
I think they are in a state where I can post them now. Rhinokey is hosting since my site is acting funny atm.
These are a set of photoshop scripts that will export the selected layer set into separate TGA files. The accompanying actions are set to hot keys to further automate the process. I also added a sample file you can try out the scripts on.
There are 3 scripts:
LayerSetExporter will export all of the photoshop layer sets into separate 24 bit TGA files. (Photoshop Action default is F9)
LayerSet_SINGLE_Exporter.js will export the selected photoshop layer set into a separate 24 bit TGA file. (Photoshop Action default is F8)
LayerSet_SINGLE_32BIT_Exporter.js will export the selected photoshop layer set into a separate 32 bit TGA file with an alpha. (Photoshop Action default is F7)
RLE compression is turned off on all scripts to avoid engine import errors.
The TGA files will be created in the same directory that the PSD file is in (so save your PSD file before you run these scripts).
To install the scripts, copy the script (.js) files into your Program Files\Adobe\ Photoshop vX \Presets\Scripts directory
Then copy the action scripts (.atn) into the Program Files\Adobe\ Photoshop vX \Presets\Photoshop Actions directory
(You can also just extract the folder into the Program Files\Adobe\ Photoshop vX \Presets folder)
I havent yet figured out how to get the filename for the newly created TGA files from the PSD filename itself so in order to have a file export correctly with the name and suffix you want, you will have to name the layer sets.
So for starters, you will need to name your layer set as SuperDiffuse01_D
When you run any of the scripts the file will come out as SuperDiffuse01_D.TGA
Some additional notes:
For layer LayerSetExporter, you will need to select the topmost layer set before you run the script. Otherwise the script will begin the export process from the current set and work its way down.
You can also have multiple layer sets and layers within the root layer set. The scripts will flatten out the entire layer set when it exports. Just make sure to select the root before running the appropriate script.
There might also be a problem when saving single files out while having the file applied to a material in max. Its no biggie, but it will give the cannot write to file when the file is in use or some other jazz and the script will appear to stop, but it will save the file out, it just wont close the duplicated photoshop file afterwards.
Hope these help
layer set export scripts
Replies
What versions of Photoshop have these been tested on? Do they work in PS7?
Does the 32bit alpha come from a layer set's accumulated transparency? Or from the first alpha channel?
i havent tried it with 7 but they work with cs/cs2
7's layer sets are called groups so that may pose a problem. i know thats a problem with action scripts being used in cs