PDA

View Full Version : Batch Preview


taniamc
09-05-2007, 04:00 AM
I think its been discussed before, but searching through I wasn't able to find an answer. I'm writing a script that will open up all the max files in a particular directory, preview each of them, and save them in a particular location. I'm trying to do the previews like this:
(this is part of a larger section of code which I left out)


viewport.setType #view_camera
preview_name = "c:/quickpreview" + iString + ".avi"
view_size = getViewSize()
gw.setPos 0 0 800 600
anim_bmp = bitmap 800 600 filename:preview_name
for t = animationrange.start to animationrange.end do
(
sliderTime = t
dib = gw.getViewportDib()
copy dib anim_bmp
save anim_bmp
gc()
)
close anim_bmp


I've also tried setting the preview to the viewport size. The code works, but the problems are these:

The files end up being huge. Compression is terrible. I need to figure out how to properly set the resolution and be able to use a decent compression. Ideally, I need to do exactly what Make Preview does, and save it somewhere. I did see that you can use createPreview () but I haven't tried it yet because I have no idea how you would save the file. I'm not looking for excellent quality, just something decent that doesn't end up being a gig each.

Thanks

Tania

Kramsurfer
09-05-2007, 09:18 PM
The createPreview() command makes a preview with the current settings in the create preview dialog. To my knowledge there is no MaxScript access to these vars.
I did something similar, but wrote the frames out to a local temp dir. Then launched a doscommand "cscript" to have quicktime compress the series of frames.

Here's the quicktime script and a bat file to show how it's used.. The first time it runs it'll ask for the compression settings and save them to a .xml file. Delete that .xml and it'll allow you to change the output settings.

Good luck..

taniamc
09-05-2007, 09:27 PM
I'm sorry, I don't see the files?

I was going to use createPreview() but I wasn't sure how to save the files from there.

Kramsurfer
09-05-2007, 10:04 PM
sorry, uploaded now in a zip.

taniamc
09-06-2007, 01:34 AM
Sorry, maybe I'm just missing this...

did you use the same method I used to output these files, and then use that to compress it?
Or are you using createPreview()?

Ideally I would need to be able to do this mainly through Max, because I can't rely on Quicktime being on the system that is running the script. I realize how ridiculous that sounds...lol

Tania

taniamc
09-06-2007, 03:08 AM
I did find a way to do everything I needed to do, although it *is* messy since Max isn't wanting to let me access all the parameters I need.


I am basically using the UI to force previews to do what I need them too. The code is working but messy...

I'm going to shine it up a bit and post it here when I'm done.

shibumenon
09-06-2007, 10:27 AM
you could use createPreview() and then use any of the external file methods to copy _scene.avi to the desired folder. Though, as Keith mentioned, there doesn't seem to be a way to set range



createPreview()

MaxDefaultPreviewFile = ((getdir #preview) + "\\_scene.avi" )
TargetFolder = "C:\\delete\\"
TargetPreviewFileName = ((getFilenameFile maxfileName) + ".avi" )

copyFile MaxDefaultPreviewFile (TargetFolder + TargetPreviewFileName)


shibu

taniamc
09-06-2007, 01:43 PM
Thanks, that's exactly what I did last night... but using DOSCommand rather than the Max Commands.

Pretty sad when your brain defaults back to DOS, eh? I think I'll switch back over to the external file manipulations in MAX rather than DOS.

One thing that I couldn't find an option for...
Whenever you complete a preview Max launches Windows Media Player to preview it. I can't seem to find somewhere to disable that, so I just wrote a kill process into the script to close that window out. Easy Peesy.

Kramsurfer
09-06-2007, 04:41 PM
How are you setting the preview configuration on the systems? Is there maxScript access to that now? Are you copying the preview.cfg to the box to render it?

Have a small "group" in backburner that can produce previews. With a postopen that executes sets the scene, previews out to frames, doscommands the QT ( which holds the max server open till complete), and clears the scene to render a blank frame so it returns a completed job to backburner. Maybe not the simplest, but it works well and gives me all QT codec options at VBR, 2 pass qaulity. Easy Peesy... as they say in Texas(?)

taniamc
09-06-2007, 04:49 PM
How are you setting the preview configuration on the systems? Is there maxScript access to that now? Are you copying the preview.cfg to the box to render it?

Have a small "group" in backburner that can produce previews. With a postopen that executes sets the scene, previews out to frames, doscommands the QT ( which holds the max server open till complete), and clears the scene to render a blank frame so it returns a completed job to backburner. Maybe not the simplest, but it works well and gives me all QT codec options at VBR, 2 pass qaulity. Easy Peesy... as they say in Texas(?)

I don't think I completely understood what you're doing with backburner, but it sounds like a good alternative. I'm not very familiar with it (maya girl). I am just using whatever the preview settings in the file are set at. Its a compromise, but its better than the grainy huge file mess I was getting with my earlier code.

( Oh and I'm not sure that anyone else in the world would be caught saying Easy Peesy, lol. But hey, I like to dork it up. It's how I roll.)

CGTalk Moderation
09-06-2007, 04:49 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.