MAXScript101_5.5 Export Folder, ThumbnailFolder - Processing Sets of Scene Files

MAXScript101_5.5 Export Folder, ThumbnailFolder - Processing Sets of Scene Files

 

实例一.

 

-- 函数解读: -- inFolder:指定.max文件所在的文件夹 -- outFolder:指定输出文件的文件夹,如果指定文件夹不存在,则该函数会生成这个指定文件夹 -- 函数功能:导入inFolder中的.max文件进行渲染,将渲染的图片保存到outFolder function exportFolder inFolder outFolder thumbType:".jpg" thumbSize:[320,240] = ( -- ensure output folder exists,if it does not exist, then create makeDir outFolder -- loop over *.max files in input folder local maxFilePattern = inFolder + "//*.max" for filePath in getFiles maxFilePattern do ( -- generate thumb file name for outFolder & -- current fileName & thumbnail extension local fileName = getFileNameFile filePath, -- 抓取max文件的文件名部分 thumbPath = outFolder + "//" + fileName + thumbType -- 指定输出文件的长文件名 -- load & render current file format "Rendering thumbnail for %/n" filePath loadMaxFile filePath render outputFile:thumbPath outputSize:thumbSize vfb:off ) resetMaxFile #noPrompt print "Done." ) -- usage exportFolder @"D:/Shemmy/temp_PracticeMaxscript/April20,2011" @"D:/Shemmy/temp_PracticeMaxscript/April20,2011/outputFolder"  

 

备注:

1. getFiles <wild_card_filename_string> :得到指定路径中的长文件名,指定路径包含通配符

 

2. 文件与文件名相关

 

 

file="g://subdir1//subdir2//myImage.jpg"

filenameFromPath file -- returns: "myImage.jpg"

getFilenamePath file -- returns: "g:/subdir1/subdir2/"

getFilenameFile file -- returns: "myImage"

getFilenameType file -- returns: ".jpg"

pathIsNetworkPath "c://temp//test.txt" --returns: false

pathIsNetworkPath "////someserver//temp//test.txt" --returns: true

 

 

实例二(实例一变体).

 

--函数功能:将inFolder中的.max文件类型,改变为exportType并且输出到outFolder -- run through a folder, exporting all scene files to 3DS function exportFolder inFolder outFolder exportType:".3DS" = ( -- ensure output folder exists makeDir outFolder -- loop over *.max files in input folder local maxFilePattern = inFolder + "//*.max" for filePath in getFiles maxFilePattern do ( -- generate export file name for outFolder & -- current fileName & export extension local fileName = getFileNameFile filePath, exportFilePath = outFolder + "//" + fileName + exportType -- load & export current file format "Exporting %/n" filePath loadMaxFile filePath exportFile exportFilePath #noPrompt ) resetMaxFile #noPrompt print "Done." )  

 

 

 

 

 

 

你可能感兴趣的:(c,String,File,input,processing,output)