From: Greg Ercolano <erco@(email surpressed)>
Subject: Re: Modifying maya submit script
   Date: Mon, 18 Apr 2005 23:52:22 -0700
Msg# 893
View Complete Thread (3 articles) | All Threads
Last Next
Dylan Penhale wrote:

> Hi Greg
>
> Thanks for your reply. I have added the sections that you added, but must have removed a bracket somewhere in my flailing. I would love to know what it is that I have missed.


Oops -- I had a quite a few typos in my example code.
I made the following mods, and attached the result after testing it..

    a) There's a missing closing brace on this line:

        unless ( open(MELOPTS, ">$meloptionsfile") )
            { print STDERR "Could not save mel options:\n$meloptionsfile: $!\n"; exit(1);
                                                                                         ^^^
       ..that last line should read:

            { print STDERR "Could not save mel options:\n$meloptionsfile: $!\n"; exit(1); }
                                                                                         ^^^
    b) I had the wrong variable name in the file save code; this line:

    print MELOPTS $meloptionsfile;
                  ^^^^^^^^^^^^^^^^

       ..should have read:

    print MELOPTS $meloptions;

    c) This line was changed:

        if ( -d $meloptionsfile ) { $meloptions = CatFile($meloptionsfile); }

       To instead read:

        if ( -e $meloptionsfile ) { $meloptions = CatFile($meloptionsfile); }
             ^^^

    d) I had to change around the $ENV{RUSH_LOGDIR} code to use $ENV{RUSH_LOGFILE}
       instead. So instead of:
...
    my $meloptionsfile = "$ENV{RUSH_LOGDIR}/user-meloptions.mel";
...

    ..it now reads:
...
    my $meloptionsfile = "$ENV{RUSH_LOGFILE}";    # /foo/bar/0001
       $meloptionsfile =~ s%[/\\][^/\\]*$%%;      # /foo/bar
       $meloptionsfile .= "/user-meloptions.mel"; # /foo/bar/user-meloptions.mel
...

    e) And finally, perl was complaining about the $meloptions not being defined
       at line 902, so I declared it here:

...
    if ( defined($ARGV[0]) && $ARGV[0] eq "-submit" )
    {
        # DEFAULTS
        my $project       = "-";
        my $command       = "";
        my $cpus          = "";
        my $nevercpus     = "";
        my $submitoptions = "";
        my $meloptions    = "";            ### <-- ADD THIS LINE
        my %in;
...

I made the above modifications, and ran some tests  and it seems to work..
when I entered the following text into the "Extra Mel Script:" prompt
of the submit form:

	// Hello
	string $foo = "XXXYYYZZZ";
	print ("THIS IS A TEST: " + $foo + "\n");

...here's what the log looked like, showing how the code was injected into
the mel script:

#################################################################################

--------------- Rush 102.42 --------------
--      Host: geneva
--       Pid: 1076
--     Title: TEST
--     Jobid: ontario.30
--     Frame: 0001
--     Tries: 4
--     Owner: erco (1000/100)
-- RunningAs: normal_user
--  Priority: 1
--      Nice: 10
--    Tmpdir: C:/TEMP/.RUSH_TMP.83
--   LogFile: //meade/net/tmp/scenes/test.ma.log/0001
--   Command: perl //meade//net/tmp/submit-maya-mel.pl -render 1 0 //meade/net/tmp/scenes/test.ma //meade/net/tmp - mentalray 5 0 - - - - off
--   Started: Mon Apr 18 23:40:36 2005
------------------------------------------
     MAYAFLAGS=''
     MRAYFLAGS=''
 MAYATOMRFLAGS=''
VECTORIZEFLAGS=''
         DEBUG='off'

MAPPING DRIVE LETTERS
--------------------------------------------
-- I: Not mapped -- Executing: net use I: \\100.100.100.3\indian /persistent:yes
-- P: Not mapped -- Executing: net use P: \\100.100.100.3\pacific /persistent:yes
-- T: Not mapped -- Executing: net use T: \\100.100.100.2\atlantic /persistent:yes
--------------------------------------------

*** MAYA MENTAL RAY ***
  SCENEPATH=//meade/net/tmp/scenes/test.ma
    PROJECT=//meade/net/tmp
   IMAGEDIR=-
   RENDERER=mentalray
  MAYAFLAGS=
BATCHFRAMES=1 (1-1)
 MAXLOGSIZE=0


//////////////////////////////////////////////////////// MRAY MEL SCRIPT: START

// Image dir specified? Use it.
if ( "-" != "-" )
{
    if ( chdir( "-" ) != 0 )
	{ error("chdir(-): failed\n"); }

    // Force Mayatomr to use our ImageDir. -erco 02/09/04
    setAttr "mentalrayGlobals.outp" -type "string" "-";
}

if ( !`pluginInfo -q -l "Mayatomr"` )
    { error("Make sure 'MAYA_PLUG_IN_PATH' set correctly."); }

// Scene file existence check
string $scene = `file -q -sn`;
if ( size( $scene ) == 0 )
    { error ("'"+$scene+"': scene file not found or not specified\n\n"); }

// Initialize Mayatomr globals
miCreateDefaultNodes();

// Init mray globals
setAttr "mentalrayGlobals.startFrame"     1;
setAttr "mentalrayGlobals.endFrame"       1;
setAttr "mentalrayGlobals.byFrame"        1;
setAttr "mentalrayGlobals.startExtension" 1;
setAttr "mentalrayGlobals.byExtension"    1;

/// FUEL DEPOT MODS: START

// insert user mel data
// Hello                                          <--
string $foo = "XXXYYYZZZ";                        <--
print ("THIS IS A TEST: " + $foo + "\n");         <--

/// FUEL DEPOT MODS: END

Mayatomr -render -v 5 ;

[..]

#################################################################################

Last Next