MEL Commands

RfM Quick Reference Guide


MEL Commands


RenderMan for Maya includes a number of useful MEL scripts that can be used in various ways. These scripts can affect Render Settings, attributes on nodes, your workspace, and even specific passes.


NOTE: parameters offset by asterisks are optional, e.g. rman getversion *nm*.
rman Commands
rman genrib
Generates the RIB files for the scene, but does not render the scene. rman genrib respects the same options as the render command, below.
rman render
The rman render command is equivalent to rendering Maya-style from the command line, i.e. Render -r rman.
rman stringinterpolate|subst str
Substitutes variables in the string str. rman subst allows for Tcl command substitution; rman stringinterpolate does not. Example:
rman stringinterpolate "The current frame number is $F4";
// Result: The current frame number is 0005 //
rman subst "1 + 1 = [expr 1+1]";
// Result: 1+1 = 2 //
rman getPref nm
Returns the value of the pref nm. Example:
rman getPref LicenseServer;
// Result: [file join [RATGetDir installdir] rmantree etc pixar.license] //
rman getPrefNames pat
Returns a list of all RenderMan for Maya prefs that match the pattern pat. Example:
rman getPrefNames "Job*"
// Result: JobPhaseTree //
rman setPref nm val
Sets the value of the pref nm to val. Example:
rman setPref BatchCompileMode lazy;
rman getvar nm
Query for the value of the RfM scripting variable named nm. Example:
rman getvar STAGE;
// Result: untitled //
rman getvar RIBPATH;
// Result: renderman/untitled/rib //
rman setvar nm val
Set an RfM variable named nm with value val to be used in scripting. Example:
rman setvar MYSHADERPATH "/path/to/my/shaders"
rman slim start
rman slim stop
rman slim message msg
These are used to communicate with Slim (RenderMan Studio only). rman slim start and rman slim stop are used to start and stop Slim respectively. rman slim message msg is used to tell Slim a message. Example:
rman slim message "plt1 CreateInstance -template pixar,Blinn#2";
rman loadShader nodename slofile
Causes the RenderMan shader slofile to be loaded on the RenderMan Shader Node node. Example:
rman loadShader RenderManShader1 "/path/to/shaders/plastic.slo";
rman getMayaAttrName nm
rman getRmanAttrName nm
Convert the Maya attribute name nm to the RenderMan equivalent or vice-versa. Example:
rman getMayaAttrName ShadingRate
// Result: rman__riattr___ShadingRate // 
rman getRmanAttrName rman__riattr___ShadingRate
// Result: ShadingRate //
rman regsub *-all* pattern argument subspec
Match the regular expression pattern against the string argument and replace with subspec. Then, return the substituted string. The optional parameter -all will replace all occurrences. Example:
rman regsub "5" "My 5a55y girl" "s";
// Result: My sa55y girl //
rman regsub -all "5" "My 5a55y girl" "s";
// Result: My sassy girl //
rman regexp *-stringArray|-sa|-matchOnly|-mo* pattern argument
Matches the regular expression pattern against the string argument and will return all matches. If -matchOnly or -mo is passed as an argument, the command will return 1 if there are any matches and 0 otherwise. If -stringArray or -sa is passed as an argument, the command will return the matches in a string array. Example:
rman regexp -matchOnly "-v" "file-v234.ma";
// Result: 1 //
rman regexp -mo "_v" "file-v234.ma";
// Result: 0 //
rman debug msglevel
Changes the current debug message level to msglevel. msglevel can be either: DEBUG, INFO, NOTICE, WARNING, ERROR.
rman date
Returns the current date.
rman getversion *nm*
Query for the version number of RenderMan for Maya. You can also query for the version number of other components by passing in a name for the third argument nm, where nm can be one of the following: about, mayaAPI, prman, platform, os, osVersion. The result will be printed to the Maya Script Editor window, e.g. (note the semi-colon is printed in the result, but is not used in the query):
rman getversion;
// 5.0 (@1145269 Feb  8 2013) // 

rman getversion about;
// Result: RfM 5.0 (@1145269 Feb  8 2013)
RMS 4.0
Copyright (c) 1996-2012 Pixar Animation Studios.  All rights reserved.
 // 
 
rman getversion prman;
// Result: prman 17.0 @1145269 // 

MEL Procedures
rmanGetAttrName nm
Convert the RenderMan attribute named nm to the corresponding Maya attribute name. The attribute names can then be added to the user's objects with rmanAddAttr. Example:
rmanGetAttrName "ShadingRate";
// Result: rman__riattr___ShadingRate //
rmanGetAttrName "trace:maxspeculardepth";
// Result: rman__riattr__trace_maxspeculardepth //
rmanAddAttr node attr val
Add the RenderMan attribute attr with value val to the node node. Example:
rmanAddAttr nurbsSphereShape1 rman__riattr___ShadingRate "";
You can combine rmanAddAttr with the rmanGetAttrName procedure (see above). Example:
rmanAddAttr nurbsSphereShape1 `rmanGetAttrName ShadingRate` "";
rmanSetAttr node attr val
Sets the value of attribute attr on the node node to val. This can be more advantageous than using Maya's setAttr as the data type of the attribute does not need to be known, and the value can be supplied as a string. Example:
rmanSetAttr nurbsSphereShape1 rman__riattr___ShadingRate 5;
setAttr nurbsSphereShape1.rman__riattr___ShadingRate 1;
rmanExecAEMenuCmd
Can be used to execute the equivalent selection sensitive menus which appear in the Attribute Editor under the Attributes->RenderMan menu. It may be more desirable to use this procedure as these menus usually add more than one attribute. A list of the menu entries can be seen in the rfm_gui.rman file. Example:
rmanExecAEMenuCmd blinn1 "Add Subsurface Scattering";
rmanExecAEMenuCmd spotLightShape1 "Add Custom Light Shader";
rmanCreateGlobals
Use this command to create the render globals nodes. They're typically created when the Render Settings window is raised. Example:
rmanCreateGlobals;
rmanCreateEnvLight
Adds the RenderMan Environment Light to your scene. Example:
rmanCreateEnvLight;