PDA

View Full Version : Some workflow "enhancers"


Jozvex
08-19-2004, 07:48 AM
Hi guys,

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:


float $previousColour[];
string $camName = `lookThru -q`;
string $camShape[] = `listRelatives -s $camName`;
string $currentCamera = ($camShape[0] + ".backgroundColor");
$previousColour = `getAttr $currentCamera`;
colorEditor -rgb $previousColour[0] $previousColour[1] $previousColour[2];
if (`colorEditor -q -result` > 0)
{
$chosenEnvColour = `colorEditor -q -rgb`;
setAttr $currentCamera -type double3 $chosenEnvColour[0] $chosenEnvColour[1] $chosenEnvColour[2];
print "Colour was changed";
}
else
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:


unifiedRenderGlobalsWindow;
window -e -vis 0 unifiedRenderGlobalsWindow;
loadNodePresets "Maya6Good";
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.

:thumbsup:

sebast1an2
08-19-2004, 08:09 AM
:thumbsup: Hi, nice workflow. ecspecially the "contrast at once" option is very useful, but actually I just use a extra scene I precreated for my standart architectural work.. so I got some "ready to use" dgs-networks" and a ready RayType-network connected to the ibl-shape to handle all the different gi-leaks;)

Splin
08-19-2004, 10:49 AM
Hey Jozvex, very very cool. I were planning to do something similar myself too, setting up default mr settings is too dedious. And the Cam environment stuff is cool too, very handy. Directly to the bulls eye, you saved lot of time and boring test & try :p
Thank you alot :thumbsup:

Digidim
08-19-2004, 10:58 AM
thx Jozvex...:thumbsup:

Splin
08-19-2004, 11:09 AM
one very stupid question by me tho :blush:
How can I access miDefaultOptions node or whatever it is called. So that I could open mr options in attribute editor. Some time ago I bumped to it and really liked that workflow...much more convinient to change your mr settings in attribute editor than to run every time into render globals.
thx

sebast1an2
08-19-2004, 12:15 PM
one very stupid question by me tho :blush:
How can I access miDefaultOptions node or whatever it is called.
It's in the outliner if you remove the _/ from "DAG objects only."

..by the way, I just found out this morning (thx paolo bertos and his masterclass docs.') how to setup the FG min/max radius in pixel units.. just had to add a new boolean atribute with the name "finalGatherView" to miDefaultOptions and took the settings with "override FG settings" and activated "Final Gather View" per object..:thumbsup:

Jozvex
08-20-2004, 12:33 AM
Cool! I wish I could have attended those masterclasses. I'll definitely buy some on DVD if they are released though.

:love:

ceql
08-20-2004, 01:16 AM
thnx for the scripts Jozvex! :)

btw, about the startup issue, you can borrow this great advice from Brian Ewert;
http://www.ewertb.com/maya/mel/mel.php?howto=62

If you only want it to run at startup, you can just add a -runOnce true flag:
scriptJob -runOnce true -e NewSceneOpened defaultSceneUI;

:bounce:

Jozvex
08-20-2004, 01:27 AM
How could I forget Brian's site! Thanks a lot ceql!!

_____
EDIT:
_____

I can't get it to work! I followed his/your instructions and it still must do it too early because I get a few errors and then my Render Globals won't work. The shelf button doesn't cause any problems.

I'll try a few other Script Job events perhaps.

stallion151
08-20-2004, 05:50 AM
hey buffy,

just a q about the assign material windows, is it possible to have those windows tile. For example in the start menu there is an option to scroll the start menu programs, or to lay them out across the screen.
Is that possible with the assign material menu or other menu that get to big?
Hope you know what im getting at.

Jozvex
08-20-2004, 07:25 AM
Hi Neo, (wow, our avatars should be a hollywood couple)

I think the menus will automatically wrap around and start a new column if that's what you mean. My menu was like 1 shader away from touching the top, so I don't actually know! I'll probably find out one day though hehe. There don't seem to be any MEL flags for changing that.......function.

I saw your olympics ad too! Not too shabby hehe.

And did they let you out of the Ambience psych ward or something? Why the sudden burst of posts??

:p

stallion151
08-20-2004, 10:00 AM
i've had scene with about 70-100 materials and the list scrolls only so it would be faster and more visibly reassuring for me...it quicker for me to assign there rather than hypershader.
just preference.

Yeh the ad in the end looked too orange crunched and not as we handed it over, more white and marbly looking.

sudden burst...oh just learnt to speel good, so thought i\d tri et out.

got a new job now, working full time in the city.

Jozvex
08-20-2004, 10:36 AM
got a new job now, working full time in the city.

Well that was descriptive, NOT. Are you a lumberjack working for an ex con artist?? Details man details!!!

CGTalk Moderation
01-19-2006, 12:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.