From: Gary Jaeger <gary@(email surpressed)>
Subject: Re: file paths for .mi files
   Date: Wed, 31 Jan 2007 18:48:18 -0500
Msg# 1469
View Complete Thread (7 articles) | All Threads
Last Next
thanks greg.

In that newsgroup item there's a reference to "This can go in a startup file and reset paths:" I assume that's Maya.env?

Regarding sumbit-mray, does it always make a copy in the local tmp dir? I'm submitting .mi files. Are your lines between the "snips" something I can put in my submit-mray anywhere?

On Jan 31, 2007, at 3:14 PM, Greg Ercolano wrote:

[posted to rush.general]

(or if anybody knows a way to force maya to write them the way I want in the first place. I haven't been able to find any way to do that)

This newsgroup item from last summer might help you:

When I make .mi files on the mac using absolute paths for textures, etc they always end up starting wtih /Volumes/foo. I've gotten used to using BBedit to batch replace /Volumes/ with //corefileserver/ so that the pc's can render the files, but is there any way in rush to say
for this .mi file, use //corefileserver/ instead of /Volumes/ wherever it appears?

Yes, you can do all that in perl, if the above newsgroup article
on the 'dirmap' MEL command doesn't help you.

In fact, the current submit-mray.pl script does a search/replace
on the entire MI file to jam the output directory into
incremental mi files, because ray's stinky -file_name flag
only applies the change to the first frame in the incremental mi file,
and doesn't apply to the rest of the frames.

So the submit script makes a copy of the MI file in the rush tmp directory
($ENV{RUSH_TMPDIR}) applying a regex replace to all lines in the file
as it creates the copy.

See the ModifyMIOutputDir() function in submit-mray.pl.

You can just make a copy of that function, and just change
the function name, and the bit of code inside the while() loop
to apply the regex you need.

Here's how I'd do it:

---- snip
# CHANGE ALL INSTANCES OF /Volume/ -> //corefileserver/
#    $1 - src mi file
#    $2 - dst mi file
#
sub FixMIFile($$)
{
    my ($src,$dst) = @_;
    unless ( open(SRC_MI, "<$src") ) { print STDERR "--- FAILED: open $src for read: $!\n"; exit(1); }
    unless ( open(DST_MI, ">$dst") ) { print STDERR "--- FAILED: open $dst for write: $!\n"; exit(1); }

    # BIN MODE (FOR WINDOWS)
    binmode(SRC_MI);
    binmode(DST_MI);

    while (<SRC_MI>)
    {
        s%/Volumes/%//corefileserver/%g; # /Volumes/foo -> //corefileserver/foo..
        print DST_MI $_;
    }
    unless(close(SRC_MI)) { print STDERR "--- FAILED: close($src): $!\n"; exit(1); }
    unless(close(DST_MI)) { print STDERR "--- FAILED: close($dst): $!\n"; exit(1); }
}
---- snip

This makes a big assumption that all instances of the word
'/Volumes/' can be globally replaced with '//coreserver/' to make
things work. (This might be bad if one of the user's pathnames has
a subdirectory somewhere in the middle of the pathname called '/Volumes',
but hopefully you can avoid that)

So in the code, instead of rendering the original MI file with eg:

system("ray $miflags $mifile");

..you might change that to read:

# FIX MI FILE FIRST, MAKING LOCAL COPY, *THEN* RENDER THE COPY
FixMIFile($mifile, "$ENV{RUSH_TMPDIR}/foo.mi");
system("ray $miflags $ENV{RUSH_TMPDIR}/foo.mi");

..don't worry about removing the copy, rush will do that for you
automatically when the frame finishes, as rush blows the entire
$ENV{RUSH_TMPDIR} when the frame finishes or is dumped/requeued.


-- 
Rush Render Queue, http://seriss.com/rush/
Tel: 626-795-5922
Fax: 626-795-5947
Cel: 310-266-8906




. . . . . . . . . . . .
Gary Jaeger // Core Studio
86 Graham Street, Suite 120
San Francisco, CA 94129
415 543 8140



Last Next