BTW, the same mel script code works for all versions of Maya 8.5 and
up through 2012 and beyond.
Just add the code to the "scripts/startup/userSetup.mel" subdir
in whatever version of Maya you have, eg:
MAYA 2008:
OSX: /Applications/Autodesk/maya2008/Maya.app/Contents/scripts/startup/userSetup.mel
LINUX: /usr/autodesk/maya2008/scripts/startup/userSetup.mel
WINDOWS: C:\Program Files\Autodesk\Maya2008\scripts\startup\userSetup.mel
If the 'userSetup.mel' file doesn't exist, create it.
When you restart maya, it will be loaded automatically,
and 'Rush' will appear in the 'Rendering' menu bar.
The below mel script works on all platforms; OSX, Linux, Windows.
> [Maya 8.5]
> OSX: /Applications/Autodesk/maya8.5/Maya.app/Contents/scripts/startup/userSetup.mel
> LINUX: /usr/autodesk/maya8.5/scripts/startup/userSetup.mel
> WINDOWS: C:\Program Files\Autodesk\Maya8.5\scripts\startup\userSetup.mel
>
> If the file doesn't exist, just create it.
> If it does exist, just add the lines to the bottom.
>
> Be sure the directory you tweak is the same version of Maya
> as the one you're running. And be sure the file is 'readable'
> to all users.
>
> I just tested it on those three platforms.
> Let me know if that doesn't help.
---- snip: userSetup.mel
// OPEN RUSH SUBMIT SCRIPT
global proc RUSH_Submit()
{
// CUSTOMIZE THIS PATHNAME FOR YOUR ENVIRONMENT
// |
// \|/
// v
string $submit_maya = "//meade/net/rushscripts/submit-maya.pl";
string $sfrm = `getAttr defaultRenderGlobals.startFrame`; // get startframe
string $efrm = `getAttr defaultRenderGlobals.endFrame`; // get endframe
string $scene = `file -q -sn`; // get scene name
string $defren = `getAttr defaultRenderGlobals.currentRenderer`; // get default renderer
if ( $scene == "" ) { error("No scene file"); return; }
// Determine renderer
string $renderer = "maya(sw)";
if ( $defren == "mentalRay" ) { $renderer = "mentalray(mr)"; }
if ( $defren == "renderMan" ) { $renderer = "renderman(rman)"; }
// Invoke submit-maya with scene pathname and frame range
RUSH_Start("perl " + $submit_maya +
" -field ScenePath \"" + $scene + "\" " +
" -field Frames " + $sfrm + "-" + $efrm + " " +
" -field Renderer \"" + $renderer + "\" "
);
}
// TELL OS TO RUN A COMMAND IN THE BACKGROUND
// This ensures the command runs in the background to prevent
// hanging up the Maya interface while command is running.
// Also makes sure rush/bin is in the path.
//
global proc RUSH_Start(string $cmd)
{
if ( gmatch(getenv("OS"),"*Windows*") )
{ // WINDOWS
$cmd = "start " + $cmd;
if ( gmatch(getenv("PATH"), "*c:/rush/bin*") == 0 ) // Add rush to path only if not already
{ putenv("PATH", "c:/rush/bin;" + getenv("PATH")); }
}
else
{ // UNIX
$cmd += " > /dev/null 2>&1 &";
putenv("SHELL", "/bin/sh");
if ( gmatch(getenv("PATH"), "*/rush/bin*") == 0 ) // Add rush to path only if not already
{ putenv("PATH", "/usr/local/rush/bin:" + getenv("PATH")); }
}
print("Executing: " + $cmd);
system($cmd);
};
// ADD RUSH SUBMIT BUTTON TO MAYA'S MENUBAR
// These should be run only once
{
setParent "MayaWindow";
menu -label "Rush";
menuItem -label "Submit" - command "RUSH_Submit();";
menuItem -label "Irush" - command "RUSH_Start(\"irush\");";
menuItem -label "Rushtop" - command "RUSH_Start(\"rushtop\");";
};
---- snip
|