From: Greg Ercolano <erco@(email surpressed)>
Subject: Re: [Q+A] How to add a 'Rush' button into Maya's menu
   Date: Mon, 22 Oct 2007 18:05:06 -0400
Msg# 1633
View Complete Thread (10 articles) | All Threads
Last Next
Gary Jaeger wrote:
> that's cool. except for me, it does hang up the maya GUI while the  
> command is running. maya2008 OS X.


   Ahh, you're right. This small change to the RUSH_Start() function
   should fix that:

BEFORE:        $cmd += " &";
 AFTER:        $cmd += "</dev/null >/dev/null 2>&1 &"; putenv("SHELL", "/bin/sh");

   [NOTE: The above change has been applied to the previous article 
   to ensure no one pastes the wrong example. -Ed]

   Here's the whole thing again with that included:

---- snip

// 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 >/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


-- 
Greg Ercolano, erco@(email surpressed)
Rush Render Queue, http://seriss.com/rush/
Tel: (Tel# suppressed)
Fax: (Tel# suppressed)
Cel: (Tel# suppressed)

Last Next