Digital humans the art of the digital double
Ever wanted to know how digital doubles are created in the movie industry? This course will give you an insight into how it's done.
# 1 15-04-2011 , 09:41 AM
Registered User
Join Date: Apr 2011
Posts: 2

Batch render multiple maya files using cmd

Does anyone have any idea about batch rendering a bunch of maya files kept in a folder using command prompt? I can render 1 file at a time using command prompt like this...

Render <options> <filename>

But i want to render all the files kept in a particular folder. Any idea?
I am using windows and i want to do it using command prompt.

Thanks
iiisam

# 2 15-04-2011 , 01:56 PM
LauriePriest's Avatar
Moderator
Join Date: May 2003
Location: London
Posts: 1,001
https://www.creativecrash.com/downloa...ript-generator

Something like that, thats just from a google search. It wouldnt be a hard script to make if you know a little pyhon, essentialy a for loop that goes through a list of maya scene files and cycles through them waiting render complete strings from the log.

I'm not sure if this listens properly to the log or if the batch renderer just echoes render complete in the command line for its functionality.


FX supervisor - double negative
# 3 15-04-2011 , 02:25 PM
David's Avatar
SM Tea Boy
Join Date: Apr 2002
Location: Prague
Posts: 3,228
This is a bit rough but it should do the trick you'll need to install active perl

Code:
use strict;
use File::Find;
my $dir = shift || die "directory name\n";


find( sub {$File::Find::name =~ s/\//\\/gi; exec("render <options> $File::Find::name$/ ") if (/\.ma$/)},$dir);
run perl filename.pl C:\directory_you_want_to_go_through

very rough but it should point you in the right direction you can also use WSH to do this or python or whatever your preference.

Dave


From a readers' Q and A column in TV GUIDE: "If we get involved in a nuclear war, would the electromagnetic pulses from exploding bombs damage my videotapes?"
# 4 15-04-2011 , 02:29 PM
Perfecto's Avatar
Registered User
Join Date: Mar 2007
Location: TN (USA)
Posts: 1,889
Been awhile since I've rendered out more than 1 file using the command line. But just in case the script doesn't work, try this.

Open up Notepad.
Type your renders on separate lines. For example
Render <options> <filename>
Render <options> <filename>
Render <options> <filename>
Render <options> <filename>

Save the file as a .bat file but save it in the same folder as the files you're wanting to render out.
Now you should be able to double click on the .bat file you just created and your computer will start executing all those commands. I have windows os. Not sure how it works for mac.

Edit: Also make sure your project is set as the current project or it won't be able to open and render the files. And don't save your .bat file as Render or anything like that. Try to use non command names for the .bat filename. You can use Ctrl-C (with Command Prompt open) to stop the render if needed.


Don't be satisfied with what you can do but rather strive to do the things you can't do!
Exceed Expectations!

Last edited by Perfecto; 15-04-2011 at 03:06 PM.
# 5 15-04-2011 , 04:29 PM
EduSciVis-er
Join Date: Dec 2005
Location: Toronto
Posts: 3,374
I like bash...

for a in mydir/*.mb; do render <options> $a; done

One reason to hate windows.

# 6 15-04-2011 , 04:43 PM
David's Avatar
SM Tea Boy
Join Date: Apr 2002
Location: Prague
Posts: 3,228
Windows Powershell

Get-Childitem "C:\" | Foreach { If ($_.extension -eq ".ma") { render <options> $_.fullname } }

that should work have not tested it user added image


From a readers' Q and A column in TV GUIDE: "If we get involved in a nuclear war, would the electromagnetic pulses from exploding bombs damage my videotapes?"
# 7 18-04-2011 , 12:40 PM
Registered User
Join Date: Apr 2011
Posts: 2
Thanks a lot for all these ideas user added image

Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads