MEL How-To #65 | ||
| ||
How do I use MEL to get and set the Render Globals?Most of the settings are defined in the "defaultRenderGlobals" node in the scene. You can query this node for the settings used in the render. Of course, you'll need to know the name of the attribute corresponding to the setting for which you need, and you'll need to know what its value means. As a start, use the listAttr command to get a quick summary of all the attributes on this node. The following MEL will give you a sorted list: string $globals[] = `listAttr defaultRenderGlobals`; $globals = `sort $globals`; print $globals; The correlation between this node and the Render Globals window are managed by the MEL script: /AW/Maya3.0/scripts/others/renderGlobalsWindow.mel You can activate the Script Editor's "Echo All Commands" and then toggle settings in the Render Globals window to see which MEL procedures are called in response. Note that the "renderGlobalsWindow.mel" script uses the UI for obtaining the current settings, defeating the ability to simply call the functions within it to specify your own setting. Once you figure out what all the settings mean you can use the MEL commands getAttr and setAttr - targeting the "defaultRenderGlobals" node - to change the render settings as you see fit. Resolution The Render Globals derives its resolution from the "resolution" node connected
through its ‘ listConnections defaultRenderGlobals.resolution; // Result: defaultResolution // Knowing this, you can query the width and height from the connected "resolution" node: getAttr defaultResolution.width; // Result: 640 // getAttr defaultResolution.height; // Result: 480 // To find other potential resolutions: ls -type "resolution"; // Result: defaultResolution resolution1 // getAttr resolution1.width; // Result: 320 // getAttr resolution1.height; // Result: 240 // The following tip was generously provided by both Mark Adams (Pixar Animation Studios) and John Cassella (Red Paw FX). Originally posted on the Highend3D Maya forum, I've paraphrased the content for these pages. Reproduced with permission from the authors. Maya maintains its list of resolutions in the global variable /AW/Maya3.0/scripts/others/imageFormats.mel You could make a script that blanks this global variable and then add your own, each in the format: "<Preset Name> <width> <height> <aspect>" Maya supports user-defined resolutions as stored in " Renderable Cameras The renderable camera is not specified by the
"defaultRenderGlobals" node, but rather by the ‘ int $isRenderable = `getAttr perspShape.renderable`; Acknowledgements Mark Adams, Pixar Animation Studios John Cassella, Red Paw FX Wednesday, August 29, 2001 | ||
Copyright ©2005 by Bryan Ewert, maya@ewertb.com Maya is a Registered Trademark of Alias |