3dsmax获取文件相关属性


/*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获取文件相关属性

猜你喜欢

转载自blog.csdn.net/weixin_41767230/article/details/106134513