/*numcontents = fileProperties.getNumProperties #contents --獲取contents裏所有屬性的數量
numsummary = fileProperties.getNumProperties #summary ---獲取summary裏所有屬性的數量
--summaryPropertiesNameList = for i=1 to numsummary collect fileProperties.getPropertyName #summary i --summary的屬性名 #("Identifier", "Created", "Creator", "Modified", "LastModifiedBy", "Revision", "Version")
summaryPropertiesValueList = for i=1 to numsummary collect fileProperties.getPropertyValue #summary i --summary的值 #("{EF9B280C-DD5B-4003-ADFF-18A39E3782D2}", "2019/8/30", "hxy", "2020/5/14", "Administrator", "9", "1.8")
--contentsPropertiesNameList = for i=1 to numcontents collect fileProperties.getPropertyName #contents i --#("Headers")
contentsPropertiesValueList = for i=1 to numcontents collect fileProperties.getPropertyValue #contents i --#(#("General", "Mesh Totals", "Scene Totals", "External Dependencies", "Objects", "Materials", "Used Plug-Ins", "Render Data"))
fileProperties.getItems "General" --#("3ds Max Version: 17.00", "Compressed", "Build: 17.0.630.0", "Saved As Version: 17.00")
fileProperties.getItems "Mesh Totals" --面數#("Vertices: 21446", "Faces: 29564")
fileProperties.getItems "Scene Totals" --場景信息#("Objects: 121", "Shapes: 0", "Lights: 0", "Cameras: 0", "Helpers: 1", "Space Warps: 0", "Total: 122")
fileProperties.getItems "External Dependencies" --貼圖信息 #("07.hdr", "33608799eeba68faeed0a751f3c2891e.jpg", "8aa7b4478215349dbe37a84a40c927d7.jpg", "e888bc7370b21f4645d78f490e03a4f5.jpg")
--fileProperties.getItems "Objects" --物體信息-名稱
fileProperties.getItems "Materials" --材質信息 #("YF_buyi", "YF_buyi_01", "YF_buyi_02", "YF_buyi_03", "YF_yaguangmucai", "YF_buyi_04", "YF_dalishi", "YF_moshajinshu", "YF_toumingboli", "YF_shufengmian", "YF_shufengmian_01", "YF_guahua", "YF_dalishi_01", "YF_dengzhaotouming", "YF_dengdai")
--fileProperties.getItems "Render Data"
*/
fn WriteToFile sfile =(
in_text = if not (doesFileExist sfile) then CreateFile sfile else OpenFile sfile
max hold
pages = #(#summary, #contents, #custom)
for pg in pages do
(--for pg 開始
format "---% ---\n" (pg as String) to:in_text
for i=1 to(fileProperties.getNumProperties pg)do
(--for i 開始
local pname =(fileProperties.getPropertyName pg i)
local pval =(fileProperties.getPropertyValue pg i)
format "\t%:" pname to:in_text
if(pname == "Headers")then
(--if 開始
format "\n" to:in_text
for hdr in pval do
(--for hdr 開始
if hdr != "Objects" then(
format "\t\t%\n" hdr to:in_text
local docs = fileProperties.getItems hdr
if docs != undefined then
for d in docs do format "\t\t\t%\n" d to:in_text
)--if 結束
)--for hdr 結束
)--if 結束
else format "%\n" pval to:in_text
)--for i 結束
)--for gp 結束
flush in_text
close in_text
)
fn SetFileStrList sfile str_array =
(
in_text = if not (doesFileExist sfile) then CreateFile sfile else OpenFile sfile
--in_text = CreateFile sfile
for d in str_array do
(
format "%\n" d to:in_text
)
flush in_text
close in_text
)
3dsmax獲取文件相關屬性