I realised today that there are a few modifications and things that I've made to my Maya, that plenty of others might find useful. Most of them are related to Mental Ray or shading in general, hence I'm posting in this section.
First up is a shelf button (or marking menu or hotkey if you prefer) that lets you change the Environment Color of the camera you're looking through, because I hate having to open up the Camera Attribute Editor all the time, I change that setting a lot it seems. Here's the MEL to put into your button/hotkey/marking menu:
string $camName = `lookThru -q`;
string $camShape = `listRelatives -s $camName`;
string $currentCamera = ($camShape + ".backgroundColor");
$previousColour = `getAttr $currentCamera`;
colorEditor -rgb $previousColour $previousColour $previousColour;
if (`colorEditor -q -result` > 0)
$chosenEnvColour = `colorEditor -q -rgb`;
setAttr $currentCamera -type double3 $chosenEnvColour $chosenEnvColour $chosenEnvColour;
print "Colour was changed";
print "Colour was cancelled";
It remembers the last used colour etc and I find it really useful. I use it heaps.
Next is another shelf button I have that does a few things at once:
window -e -vis 0 unifiedRenderGlobalsWindow;
connectAttr -f miDefaultOptions.contrastR miDefaultOptions.contrastG;
connectAttr -f miDefaultOptions.contrastR miDefaultOptions.contrastB;
setAttr "perspShape.backgroundColor" -type double3 0.621 0.730657 1;
Ok, I press this whenever I start Maya. The first line opens the Render Globals (soley for the purpose of creating the miDefaultOptions node), the second line promptly closes it again as I actually don't need it open, hehe. The third line loads a Render Globals preset that I created just by setting up good starting values for Mental Ray, then saving them as a preset. The fourth and fifth lines connect the Sampling Contrast values to each other, so that I only have to change the Contrast R setting and it changes the B and G settings to match, I leave the Contrast Alpha setting unconnected though. The last line just changes the Environment Color of my Perspective camera to a sky blue colour.
<Boring techy things>
Now, currently I have to press this button every time I start Maya up, which is tonnes faster than changing all those things manually, but it would be super nice if Maya just did all this automatically. I've tried putting it into the userSetup.mel file, even using the evalDeffered command with it, but it still runs these commands too early in the startup process, I just get errors. I thought about using a ScriptJob (though I've never used one before) but a quick look at the events you can choose from didn't really grab me with an answer.
</Boring techy things>
Anyway, back to stuff people actually care about, hehe.
My latest creations are modifications of two internal Maya scripts. They both affect the way the "right-click > Materials > Assign New Material" menu work. I use that menu for basically all my initial shader creation. One script changes it so that using that menu applies the material to all the selected objects, not just the last selected one.
The second script actually changes the menus. Normally you have 'Assign New Material' and 'Assign Existing Material'. However, now that I have so many Mental Ray shaders installed, my 'Assign New Material' menu is taller than the screen! Which is really annoying. So what my modification does is give you 'Assign New Maya Material' which only lists standard Maya shaders, then a new 'Assign New MR Material' menu which only lists Mental Ray shaders! It works fine and makes it a lot easier when I only want to assign a Lambert, I don't have to go way up to the top past all my MR shaders.
To use either (or both) of those modifications, download the attached zip file and copy the required scripts into your user scripts folder. The 'createAndAssignShader' script is what modifies the menu behaviour to apply the material to all selected objects. The 'buildShaderMenus' script is what separates the Maya shaders from the MR shaders with the new menu. I've added notes inside the scripts on what I've done. Just look for "JOZVEX" throughout the scripts to read about stuff.
Am I rattling on about stuff no-one cares about?? Haha, tell me what you think.