Mobile app version of vmapp.org
Login or Join
Ann6370331

: Automatically load obj to Maya I would like to batch render 1000 models using Maya. I have set up a Maya scene and I need to render these models one-by-one with the same scene I am thinking

@Ann6370331

Posted in: #BatchProcessing #Maya

I would like to batch render 1000 models using Maya. I have set up a Maya scene and I need to render these models one-by-one with the same scene

I am thinking of writing a MEL script that does the following thing:
(1) Load a model obj
(2) Render it
(3) Replace the current obj by the next obj, render it and repeat

Can someone give me some hint how to do it? I am not familiar with MEL. Thanks!

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Ann6370331

1 Comments

Sorted by latest first Latest Oldest Best

 

@Gail6891361

Yes you can do this. What you do is you turn echo on and open the script editor then do this once and copy the instructions to the code line below and replace with variables.

Anyway a simple example (caveat emptor, I wouldn't use this for several reasons well beyond the scope of this post might work fine for you):

$folder = "P:/ath/to/data/";
$files = `getFileList -filespec "*.obj"
-folder $folder`;

for ($filename in $files){
file -import -type "OBJ" -ra true
-namespace "IMP" -options "mo=1"
-pr -loadReferenceDepth "all"
($folder+$filename);
setAttr "defaultRenderGlobals.imageFilePrefix"
-type "string" $filename;
RenderIntoNewWindow;
delete "IMP:*";
namespace -rm IMP;

print ($filename+" processing. n");
}


Images should now be in /images/tmp  folder. There are several things you could do better or nicer but this is just a very quick example. EDIT: The code can get confused, in multi view layouts if the focus is not set properly it would be better to explicitly name renderable cameras.

For example instead you could just run this form your OS's command line with render command and a script loop. This has some benefits for real sustained production.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme