In order to illustrate my script writing process, I'll identify a need, come up with an idea, make a scriptlet, then write the proc. The example will be to help lighters make a matte render to use in Photoshop.
I do a lot of concept designs, so I tweak single images in Photoshop all the time. If you want mates for a sequence of frames, search for mental ray custom color pass.
Before we start writing anything, look before you leap Part 1 of the identification process
- Search is your friend - Look for similar code that might exist online. Use google, cg forums, whatever. Just start searching.
- Let Maya do the work - Most likely Maya has something that might do exactly what you want. Search Maya's docs also.
- The scriptEditor is your friend - Always keep the scriptEditor open. Poke around and try a few things. Look at the commands Maya spits out, they are incredibly helpful.
- Ask your colleges - People in your workplace are your greatest source of information. Collaborate often and you'll see your productivity go up.
- Write down your findings, bookmark pages of interest, copy ( legal ) source material, etc. You might think you can remember where you found that crucial tidbit of information, but if you're anything like me, then if it isn't written down somewhere, its going to take a while to find it once again. There is no such thing as too much reference.
- Who will use it? - Lighters will use it .
- What will it be used for? - To make a matte render, isolating pieces of geometry in a single image.
- Where will it be used? - In the lighting stage of the pipeline.
- When will it be used? - Once a lighter determines that they need an isolated piece of geometry.
- Why will it be used? - Mulit-colored matte renders are needed in Photoshop to quickly create masks.
- How will it be used? - User will supply a list of geo and we will make a shader, a switch node, a gamma node per object, assign the objects to the switch node and set a random value per channel on the gamma node.
If you are still stuck, then sleep on it, do something else. Take a break. When you come back you might have a new approach.
Narrow the scope. Part 3 of the identification process
Now that you've answered your 5Ws. Take a step back. Look objectively at what you are intending to do, and break it down into logical steps. Notice that we're not trying to make the matte pass, render it, send it to Photoshop and pull all the masks in one proc. Though that sounds like a time saver for a lighter, that's a tremendous amount of code to write. So go after it piece by piece. Narrow the scope to a single step - aka low level tools. Once you've written code to do the low level tools, then comes the time to write a high level tool that pulls all the pieces together.