if you are using a lens shader for tonemapping (like if you're using physical sun) you need to individually gamma-correct all of your color textures and swatches in order to get accurate color in your render. this is really annoying.
this MEL tries to make that process easier. select shaders in your scene and run this script, and color-based textures and swatches will automatically be gamma corrected, making your life suck slightly less.
the script bases the correction on attributes that are looking for RGB values and not luminance values. this generally works really well with mental ray production shaders, but since maya's software shaders look for RGB values in weird places (like transparency), some channels might get gamma-corrected that you wouldn't normally expect. sorry.
this script doesn't play well with ramp shaders right now. or layered shaders, for that matter. i might add support for those later.
to run the script: put in your scripts folder, select the shaders you want to correct, then type "hfAutoGamma(0.455)" in your script editor. you can replace that number with any other number if you're trying to correct for a different color space.