-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBatchRender.ms
60 lines (56 loc) · 1.79 KB
/
BatchRender.ms
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
fn getFilesRecursive root pattern = (
dir_array = GetDirectories (root+"*")
for d in dir_array do
join dir_array (GetDirectories (d+"\\*"))
my_files = #()
for f in dir_array do
join my_files (getFiles (f + pattern))
my_files
)
fn RenderObj fileName prefix = (
prefix = (if prefix == undefined then "" else prefix)
if not doesFileExist(fileName) do(
messageBox("File not exists: " + fileName)
return false
)
renderDir = getFilenamePath(fileName) + getFilenameFile(fileName)
if not doesFileExist(renderDir) do(
if not makeDir(renderDir) do(
messageBox("Could not create directory: " + renderDir)
return false
)
)
if not loadMaxFile(fileName) do(
messageBox("Could not open max file: " + fileName)
return false
)
dir = #("00","01","02","03","04","05","06","07")
setProperty autobackup "enabled" false
progressStart "start rendering"
try(
for d = 1 to 8 do(
td = d * 12
progressUpdate td
outfilename = (renderDir + "\\" + prefix + dir[d] + ".tga")
tempvfb = render outputfile:outfilename camera:$Camera01 fromframe:rendStart toframe:rendEnd nthframe:rendNThFrame outputwidth:renderwidth outputheight:renderheight renderer:#production
undisplay tempvfb
animate off(
try(rotate $µÆ¹â 45 [0,0,1])catch("No light!")
)
)
)
catch(messageBox(getCurrentException()))
progressEnd()
setProperty autobackup "enabled" true
)
fn main = (
path = getSavePath()
if path != undefined then(
maxFiles = getFilesRecursive path "*.max"
for maxFile in maxFiles do(
RenderObj maxFile ""
)
)
)
main()
quitMax #noPrompt