PDA

View Full Version : Change render quality command?


BLK
03-10-2011, 07:22 PM
Does anyone know the command to change the Maya globals render quality? I want to change the render quality to "production quality" from a shelf button, and cant find the command...
Thanks in advance.

Nyro
03-12-2011, 11:41 AM
Dude, you hade me digging all the way through Maya's native scripts!

the file "createMentalRayQualityTab.mel" in \MayaXXX\scripts\others revealed the following solution:

optionMenuGrp -e -select 11 miRenderQualityMenu;
miRenderQualityMenuChanged;

To switch to a different Quality preset, you'll need to replace the number "11" above with something else.

Printing the global var $miRenderQualityList reveals this:

0 Draft
1 DraftMotionBlur
2 DraftRapidMotion
3 Preview
4 PreviewCaustics
5 PreviewFinalGather
6 PreviewGlobalIllum
7 PreviewMotionblur
8 PreviewRapidMotion
9 Production
10 ProductionMotionblur
11 ProductionRapidFur
12 ProductionRapidHair
13 ProductionRapidMotion
14 ProductionFineTrace

The mel code the programmers wrote use the list above, but it differs from the actual Menu list in the Quality tab in two respects:
- This one has a 0-based index, while the actual menu items (as defined via optionMenu command) have a 1-based index.
- This one doesn't include the item "Custom", which occupies the first index in the menu.

So, if you want to change the preset to something else rather than "productioN" with the code above, you'll need to check the index of the preset in the list I posted above and simply add "2", e.g. "Preview" would be "5" (3+2).

BLK
03-15-2011, 08:45 PM
Hey Thanks Nyro!

When I try this code, I get the following: Error: line 1: Object 'miRenderQualityMenu' not found.

Is miRenderQualityMenu a variable? If so how did you define it?

Thanks again man...

ginodauri
03-16-2011, 12:32 AM
This probably means that render settings ui is not created.

Open render setting and than run this code.

Nyro
03-16-2011, 01:18 AM
Yup, Ginodauri is right. The script assumes you have already set your Renderer to Mental Ray via the Render Settings window (it calls on the drop-down menu in the Mental Ray quality tab)

BLK
03-16-2011, 01:47 AM
Great- yeah that worked when I have the mental ray setting tab open, but that defeats the purpose of the script... I wanted to change the render settings from a shelf button... without having to open the render settings... Moreover, I am rendering in software :(... am I out of luck, or is there a command for this?

Thanks again in advance...

Nyro
03-16-2011, 01:33 PM
This isn't trivial stuff, I fear.

Basically, the Render Settings window has to be built before any of the controls can be accessed (obviously), the tabs must be switched, populated, etc.

There are various scripts involved here, "unifiedRenderGlobalsWindow.mel", "createMentalRayQualityTab.mel" amongst others.

Here's a script that should work as long as mentalRay (the plugin) is loaded.

if(`assertIsValidRenderer "mentalRay"`) {

setAttr defaultRenderGlobals.currentRenderer -type "string" "mentalRay";
updateRendererUI;

unifiedRenderGlobalsWindow;

tabLayout -e -sti 4 mentalRayTabLayout;
fillSelectedTabForTabLayout("mentalRayTabLayout");

optionMenuGrp -e -select 11 miRenderQualityMenu;
miRenderQualityMenuChanged;

window -e -vis 0 unifiedRenderGlobalsWindow;
}

This is more of a hack, it just sets the renderer to MR and then switches to tab 4, which HOPEFULLY is Quality. If not, you've got a problem (I couldn't get the tabLayout command to properly switch to the Tab with the label "Quality" for some reason).

Anyhow, this isn't bulletproof and more importantly, it bypasses lots and lots of other functions that normally get called when you interactively switch around in the Render Settings window, so its entirely possible that this will leave you with unpopulated tabs or perhaps tabs that don't update properly, etc. etc. Just try it out.

ceenick10
12-07-2011, 10:38 PM
BLK,

I recently ran into the problem of initializing MR through script. I think this might help. Its scripted in PyMel so you will have to convert it. However the info is there.

cmds.setAttr("defaultRenderGlobals.currentRenderer", "mentalRay",type="string")
mel.eval ('unifiedRenderGlobalsWindow;')
mel.eval ('tabLayout -e -selectTab "mentalRayQualityTab" unifiedRenderGlobalsWindow|rgMainForm|tabForm|mentalRayTabLayout;')
mel.eval ('fillSelectedTabForCurrentRenderer;')

CGTalk Moderation
12-07-2011, 10:38 PM
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.