Posts

Showing posts from April, 2012

Creating a new photoshop doc with Python, Part Two

Just a quick update on my previous post  about adding a new document to photoshop with python. It seems that Cs2 uses pixels as it's default assumed unit. Due to this, my script previously did not bother to define a unit type for the document and it all worked fine. I am running some tests of the script on Cs5 and coming up with some unexpected results- namely really massive documents, which are no fun. This is because the document is being made in CM by default rather than pixels.  To fix this, I added in this wee bit o'code: psApp.Preferences.RulerUnits = 1 Which defines the ruler units as pixels. The lesson... assume nothing! If it needs it, define it.

Learn Python the Hard Way

For anyone who is interested, I've found this book really helpful in picking up the python language. Learn Python The Hard Way contains a heap of useful programming advice delivered in a clear and very readable way. It progresses from very simple examples to more complex concepts with a learning curve that will always challenge, but doesn't ever put you in water too deep to fathom. Highly recommended to anyone aspiring to learn the basics of Python.

Python- Updating alpha from a group

I've tied the alpha updating to an action inside photoshop, and the results are pretty pleasing. Within the script there is a bit of juggling between active layers and active channels in order to get the action working properly. I also like to leave the user off in a place that makes sense- in this case, the alpha group, since its the one being updated.   The basics of this script: Checks for an 'alpha' group in the active PSD file. If present, copies it's merged contents to the alpha channel. ############################################################################## # # Photoshop alpha updater # (C) Pete Hanshaw, 2012 # http://peterhanshawart.blogspot.com.au/ # ############################################################################## # # Checks for an 'alpha' group in the active PSD file. If present, copies it's # contents to the alpha channel. # # Requires the Win32 Extensions: # http://python.net/crew/mhammond/win32/ # ########################...

Exporting texture Alpha from a group

While looking for a good Maya PitsNPeaks alternative, I have been tinkering with further scripts to improve artist texture workflow. One of the things I am working on is a neat little script that allows an artist to work on an image's alpha in a group named 'alpha' in the source PSD document, which is automatically copied over to the output file's alpha channel when it is exported, provided it is a texture that requires it (eg, an 'a' or 't' texture). The intention is that an artist will be able to edit and update the alpha channel as fluidly as any other texture map a material requires.

Creating a new photoshop doc with Python

Image
In the spirit of saving time (and also because I think its cool) I wrote a quick little script to create a new Photoshop document, set up with groups and layers. It ties quite nicely in with Texture monkey, as it uses the same group names etc when it creates the doc, and it just saves a lot of clicking. When you run the script, which only takes a couple of seconds, you end up with a neat little document ready to edit: I added a part at the end of the script to make sure the diffuse layer was active. It's a little touch, but makes it nice to know the script leaves off somewhere useful rather than some random layer. The script is pretty straightforward, but has a couple of interesting little bits, like how it moves groups. I had to trawl around for a while to get that one working. I'm also becoming a big fan of minimizing console feedback. As long as it's all working I don't think it should spit too many "I'm doing this!" messages out at you. It's annoyi...