Home Technical Talk

Help with max script please

polycounter lvl 19
Offline / Send Message
TorQue[MoD] polycounter lvl 19
Ok, I'm not even sure that you need max script to do what I want to achieve so I'll start by explaining that.

Basically, I want to render out several max files as avi with pre-set render options such as compression etc.

The idea is that I can set up all the scenes perfectly, and then run the script or whatever program when I go to bed and not have to wait for all of the scenes to render, manually load the next one and continue add nauseum. There are more than 20 scenes I need to render.

I looked online for Batch rendering tutorials or freeware software and couldn't find any, so I looked to max scripts.

I found a script for rendering files to jpeg, and thought maybe I could adjust it for avi, but I've never used max script before. This is the code I am currently using <font class="small">Code:</font><hr /><pre>file=getfiles "$scenes\Brutal\Trailer\*.max"
for f in file do (
LoadMaxfile f
outPath = getFilenamePath f -- can be "F:\\Brutal\\Trailer\\"
render f framerange:#active outputFile:(f+".avi")
)</pre><hr />

The problem with this code is that its grabbing the max files and rendering them out, but when it finishes rendering, I'm left with a file called "filenamehere.max.avi" and neither windows media player or VLC will recgonize this as a proper avi file so all I get is a blank screen.

If anyone could help with this it would be greatly appreciated.

Replies

  • monster
    Options
    Offline / Send Message
    monster polycounter
    When you add f+".avi" you are adding ".avi" to the end of the complete filename and extention. Also, I don't think it was working because you have an extra f after the word render. I also added a check to make sure the max file loaded properly.

    This seems to work for me.

    <font class="small">Code:</font><hr /><pre>file=getfiles "$scenes\Brutal\Trailer\*.max"
    for f in file do
    (
    if (LoadMaxfile f quiet:true) do
    (
    outPath = (maxfilepath + getfilenameFile maxfilename + ".avi")
    render framerange:#active outputFile:outPath
    )
    )
    </pre><hr />
  • TorQue[MoD]
    Options
    Offline / Send Message
    TorQue[MoD] polycounter lvl 19
    Yay! It finally works!!!

    I setup the file with the proper codec settings in max's render options first and then rendered it out with my new code and it works!

    Its a pretty handy script for anyone wanting to batch render files to any type really. Just set up the options in the normal render settings in max, then make sure you save the file with the view you want selected (perspective in my case) and then run the script with whatever file extension you want appended (.jpg, avi, whatever) and it should work fine!

    New Code:
    <font class="small">Code:</font><hr /><pre>file=getfiles "$scenes\Brutal\Trailer\*.max"
    for f in file do (
    LoadMaxfile f
    outPath = getFilenamePath "F:\\Brutal\\Trailer\\"
    render f framerange:#active outputFile:(outPath + (getFilenameFile f) + ".jpg")
    )
    </pre><hr />
Sign In or Register to comment.