Dylan Penhale wrote:
I want to make a very simple addition to our otherwise standard
submit-maya.pl script by adding another box to the input program and
passing the user input to the temp mel file.
Since the user's input is multiline mel text, what I would
do is:
1) prompt for the mel script as you are doing now,
2) save this mel text into a temp file in the log directory,
3) slirp that file up from within the render script
4) inject their code into the temp mel script as needed
Regarding #2, you have the right code here to compile the
multiline data into the 'meloptions':
if ( $key eq "MelOptions" && $in{$key} ne "" )
{ $meloptions .= ($meloptions eq > "")?$in{$key}:"\n$in{$key}"; }
And then in the section just above where it submits the job,
write the "$meloptions" into the log directory:
..
# CONVERT SPACES TO DEL
# Do this so spaces pass across command lines correctly.
#
$in{MayaFlags} =~ s/ /\x7f/g;
$in{MayatomrFlags} =~ s/ /\x7f/g;
$in{VectorizeFlags} =~ s/ /\x7f/g;
$in{MrayFlags} =~ s/ /\x7f/g;
### FUEL DEPOT MODS: START
# SAVE MEL OPTIONS (IF ANY) TO A FILE IN THE LOG DIRECTORY
# The render portion of the script will then load
# and inject it into the mel script.
#
my $meloptionsfile = "$in{LogDir}/user-meloptions.mel";
unless ( open(MELOPTS, ">$meloptionsfile") )
{ print STDERR "Could not save mel options:\n$meloptionsfile: $!\n"; exit(1);
print MELOPTS $meloptionsfile;
close(MELOPTS);
### FUEL DEPOT MODS: END
my $submit = <<"EOF";
title $in{JobTitle}
ram $in{Ram}
..
and I have added it to the submit section:
..
$cpus ||= "# no cpus";
$nevercpus ||= "# no nevercpus";
$submitoptions ||= "# no submit options";
$meloptions ||= "# no mel script options";
$in{ImageDir} ||= "-";
$in{ImgCommand} ||= ($G::iswindows?"start /b wperl ":"perl ") .
"$G::self -imgcommand %04d";
..no, I wouldn't do that.
That's the section that's interpreting command line arguments,
and you don't want to pass the entire mel script the user typed in
as a single command line option.
Instead, find the section just above where the script's
temporary mel script is created, load the user's mel options
from the above saved file back into a variable, then inject
the script into the temporary mel:
..
sub CreateMrayMel($%)
{
my ( $melfile, %opt) = @_;
### FUEL DEPOT MODS: START
# LOAD THE USER'S MEL OPTIONS BACK INTO A VARIABLE
my $meloptions = "";
my $meloptionsfile = "$ENV{RUSH_LOGDIR}/user-meloptions.mel";
if ( -d $meloptionsfile ) { $meloptions = CatFile($meloptionsfile); }
### FUEL DEPOT MODS: END
unless ( open(MEL, ">$melfile") )
{ print STDERR "ERROR: $melfile: $!\n"; return(-1); }
print MEL <<"EOF";
..
mel script contents
..
setAttr "mentalrayGlobals.startExtension" $opt{sfrm};
setAttr "mentalrayGlobals.byExtension" 1;
/// FUEL DEPOT MODS: START
// insert user mel data
$meloptions;
/// FUEL DEPOT MODS: END
Mayatomr -render -v $opt{MayatomrVerbose} $opt{MayatomrFlags};
..
If you still have trouble, email me your script in its
current hacked incarnation, and I can help make these mods
for you.
--
Greg Ercolano, erco@(email surpressed)
Rush Render Queue, http://seriss.com/rush/
Tel: (Tel# suppressed)
Cel: (Tel# suppressed)
Fax: (Tel# suppressed)
|