max各种相机导出到ue4匹配镜头的工具集

总览

 rollout export_UE4Cam_v2 "导出UE4Cam_v2:半自动" width:200 height:120(HyperLink  explain "在打开的max文件中使用" pos:[25,12] width:200 height:15 color:(color 255 155 0)	 GroupBox grp1 "要导出的相机名" pos:[5,28] width:179 height:40pickbutton OutCam "拾取相机" pos:[20,40] width:150 height:20GroupBox grp2 "要导出的fbx文件名" pos:[5,70] width:179 height:50button	 bt_create	"Create UE4 Camera" pos:[20,85] width:150 height:32 enabled:true-----逐行写入文本------------
fn format_txt FilePath filetext1 filetext2=
(	if doesFileExist FilePath == truethen(fin = openfile FilePath mode:"r+"seek fin #eoftxt = filetext1+RenderWidth as string+"\n"+filetext2+RenderHeight as string+"\n"format txt to:finclose fin)else(newfile = createFile FilePath writeBOM:trueclose newfileformat_txt FilePath filetext1 filetext2)
)
-----end逐行写入文本-----------------on OutCam picked obj do(OutCam.text = obj.name)on bt_create pressed do(		Freecamera fov:45 targetDistance:314.512 nearclip:1 farclip:1000 nearrange:0 farrange:1000 mpassEnabled:off mpassRenderPerPass:off pos:[0,0,0] isSelected:onmycam = OutCam.text$.name = mycamUE4CAM =$MAXCAM =getnodebyname mycamUE4CAM.Position=MAXCAM.positionUE4CAM.FOV=MAXCAM.FOV--位置约束UE4CAM.Position.controller= Position_Constraint ()A = UE4CAM.Position.controllerA.appendTarget MAXCAM 100--方向约束UE4CAM.rotation.controller= Orientation_Constraint ()B = UE4CAM.rotation.controllerB.appendTarget MAXCAM 100--开始塌陷local forceUpdate = keyboard.shiftPressed -- if SHIFT is pressed when the macro is called, a viewport redraw is enforced for each timestep to ensure a full update of all controllersif forceUpdate then format "MB Collapse: Enforcing full viewport update. This might be slow but will ensure proper updating of all controllers\n"local p = undefinedlocal old_prs_ctrl = copy UE4CAM.transform.controller		-- store old controller for catch()with undo on (if not forceUpdate then disableSceneRedraw();	-- not using redraw context for max4 compatibility-- disableSceneRedraw is problematic as not all scripted controllers are updated!try (p = Point()			-- create temp point object-- copy global transform of source object into temp objectfor i = animationRange.start to animationRange.end do (if forceUpdate then sliderTime = i	-- set slider time to force a global update of all animation dataat time i (with animate on p.transform = UE4CAM.transform))-- kill old transform controller and assign new, clean oneUE4CAM.transform.controller = transform_script()	UE4CAM.transform.controller = prs()	if not (isGroupMember UE4CAM) then UE4CAM.parent = undefined	-- unlink if not in a group-- copy temp object animation back into source objectfor i = animationRange.start to animationRange.end do (at time i (with animate on	UE4CAM.transform = p.transform))delete p			-- delete temp point objp = undefinedif not forceUpdate then enableSceneRedraw())--trycatch(format "coder zsz:QQ  : Fatal error - exiting\n"if p!=undefined then delete pUE4CAM.transform.controller = old_prs_ctrlif not forceUpdate then enableSceneRedraw())-- catch				)--with undo--塌陷结束-----导出fbx文件------ 使用一个.net文件windows窗口—导出fbx文件browse_dialog = dotNetObject "System.Windows.Forms.SaveFileDialog" --建立一个打开文件对话框DotNetFile = DotNetClass "System.IO.File"--创建.net文件browse_dialog.title = "保存文件" --设置标题browse_dialog.Filter = "fbx Files (*.fbx)|*.fbx|All Files (*.*)|*.*" --确认这个文件过滤browse_dialog.fileName = trimright maxfilename ".max"browse_dialog.FilterIndex = 2 --设置文件过滤下拉菜单长度result = browse_dialog.showDialog() --显示对话框,得到的结果进变量if (result.Equals result.OK) then(if ( not (DotNetFile.Exists browse_dialog.FileName)) then(select UE4CAMif selection.count !=0 then(	AA=browse_dialog.fileName+".fbx"exportFile AA  #noPrompt selectedOnly:true using:fbxexpBB=browse_dialog.fileName+".TXT"format_txt BB "renderWidth=" "renderHight=")))			--删除相机 	delete UE4CAMfree(filepath)					))rollout exportFBX "导出fbx模:半自动" width:200 height:100(HyperLink explain "在打开的max文件中使用" pos:[25,0] width:200 height:15 color:(color 255 155 0)	 GroupBox grp1 "要导出的角色根骨骼" pos:[5,15] width:179 height:80pickbutton PickRoot "拾取根骨骼" pos:[20,30] width:150 height:20button	 bt_OutFBX	"输出fbx模型" pos:[20,55] width:150 height:30 enabled:trueon PickRoot picked obj do( PickRoot.text = obj.name)		on bt_OutFBX pressed do( ChrBone=getnodebyname PickRoot.textselect ChrBone--根据根选择此层级所有物体if selection.count !=0 then(fn getTheChildren obj:selection[1] includeParent:false = (execute ("$'" + (obj.name)+"'/"+(if includeParent then "" else "*/")+".../*"))select (getTheChildren includeParent:true)select (getTheChildren())getTheChildren includeParent:true as arraygetTheChildren() as array)mysel=selection as array -----对齐帧处理-----debb = 10000finn=-10000 for a in selection do(if  (classof a == BoneGeometry) then(if (numKeys a.position.controller > 0)then(sortKeys a.controllernum_keys = numkeys a.position.controllerstarttime = getkeytime a.position.controller 1endtime = starttimefor O = 1 to num_keys do (key_time = getkeytime a.position.controller Oif key_time > endtime thenendtime = key_time)if starttime < debb then debb = starttimeif endtime > finn then finn = endtime))if (classof a == Biped_Object) then(if (numKeys a.transform.controller > 0)then(sortKeys a.controllernum_keys = numkeys a.transform.controllerstarttime = getkeytime a.transform.controller 1endtime = starttimefor O = 1 to num_keys do (key_time = getkeytime a.transform.controller Oif key_time > endtime thenendtime = key_time)if starttime < debb then debb = starttimeif endtime > finn then finn = endtime)))animationRange = interval debb finn	-----end对齐帧处理-----------------查找蒙皮中具有bip字样的模型并一起选择---------------if selection.count !=0 then(actionMan.executeAction 0 "283"  -- Tools: Unfreeze Allmax unfreeze all	  allTheSkin = for obj in objects where (classof obj==PolyMeshObject)  collect objfor f in allTheSkin do(skinMods = getclassinstances Skin target:f max modify modemodPanel.setCurrentObject f.modifiers[#Skin]skinOps.getnumberbones skinMods[1]bonename =skinOps.getBoneName skinMods[1] 1 0bonename =skinOps.getBoneName skinMods[1] 2 0	if findString bonename "Bip" ==1 then (join mysel f)else(deselect f)selectmore mysel))-----使用一个.net文件windows窗口—导出fbx文件------browse_dialog = dotNetObject "System.Windows.Forms.SaveFileDialog" --建立一个打开文件对话框DotNetFile = DotNetClass "System.IO.File"--创建.net文件browse_dialog.title = "保存文件" --设置标题browse_dialog.Filter = "fbx Files (*.fbx)|*.fbx|All Files (*.*)|*.*" --确认这个文件过滤browse_dialog.fileName = trimright maxfilename ".max"browse_dialog.FilterIndex = 2 --设置文件过滤下拉菜单长度result = browse_dialog.showDialog() --显示对话框,得到的结果进变量if (result.Equals result.OK) then(if ( not (DotNetFile.Exists browse_dialog.FileName)) then(if selection.count !=0 then(	AA=browse_dialog.fileName+"."+"model"+".fbx"exportFile AA #noPrompt selectedOnly:true using:fbxexp)))))rollout exportFBX_ue4cam_v1 "批出fbx模&UEcam_V1:自动" width:200 height:120(
HyperLink explain "指定目录即可,不需要打开文件" pos:[25,0] width:200 height:15  color:(color 255 155 0)
edittext selfile "" pos:[10,20] width:140 height:19 text:"...请选择目录"
button btn_browse "..."  pos:[160,20] width:30 height:19 
checkBox ignore "忽略backup文件" pos:[60,40] width:100 height:19
-- radioButtons rdo1 "" pos:[30,40] width:168 height:16 labels:#("输出相机", "输出模型") default:1 columns:2	 
button	 bt_create	"批量输出fbx" pos:[20,60] width:150 height:32 enabled:true-------逐行写入文本------------
fn format_txt filepath filetext1 filetext2=
(	if doesFileExist filepath == truethen(fin = openfile filepath mode:"r+"seek fin #eoftxt = filetext1+RenderWidth as string+"\n"+filetext2+RenderHeight as string+"\n"format txt to:finclose fin)else(newfile = createFile filepath writeBOM:trueclose newfileformat_txt filepath filetext1 filetext2)
)  -- 逐行写入文本	 on btn_browse pressed do( 		global DIR = getSavePath caption:"选择max目录"if (DIR != undefined) then ( selfile.text = dir ))		on bt_create pressed do( files =DIR+"\*.max"OldFiles=getfiles files	GetFile= getFiles files	 if (ignore.checked) then(---排除掉backup文件--UndoFiles=getfiles (DIR+"\*backup*.max")for j = 1 to UndoFiles.count do	while (index = (findItem GetFile UndoFiles[j])) != 0 do (deleteItem GetFile index)---排除掉backup文件end--	 )	Maxfiles=GetFilefor f in Maxfiles do (--打开max文件--- loadMaxfile f missingExtFilesAction:#logmsg---切割文本内容mydir=trimRight f ".max"global filename=trimLeft mydir DIRglobal filepath=(DIR+"/"+filename+".txt") as string		 --------start 输出model.fbx-------	---------只输出bip模型--------------选择所有bip物体select $'*bip*' mysel= selection as array--根据bip选择根for f in mysel do(fn getRoot node = if isvalidnode node do (while node.parent != undefined do node = node.parent; node)aaa=getRoot fselect aaa)--根据根选择此层级所有物体if (selection.count !=0) then(fn getTheChildren obj:selection[1] includeParent:false = (execute ("$'" + (obj.name)+"'/"+(if includeParent then "" else "*/")+".../*"))select (getTheChildren includeParent:true)select (getTheChildren())getTheChildren includeParent:true as arraygetTheChildren() as array)if (selection.count !=0) do(-----对齐帧处理-----debb = 10000finn=-10000 for a in selection do(if  (classof a == BoneGeometry) then(if (numKeys a.position.controller > 0)then(sortKeys a.controllernum_keys = numkeys a.position.controllerstarttime = getkeytime a.position.controller 1endtime = starttimefor O = 1 to num_keys do (key_time = getkeytime a.position.controller Oif key_time > endtime thenendtime = key_time)if starttime < debb then debb = starttimeif endtime > finn then finn = endtime))else if (classof a == Biped_Object) then(if (numKeys a.transform.controller > 0)then(sortKeys a.controllernum_keys = numkeys a.transform.controllerstarttime = getkeytime a.transform.controller 1endtime = starttimefor O = 1 to num_keys do (key_time = getkeytime a.transform.controller Oif key_time > endtime thenendtime = key_time)if starttime < debb then debb = starttimeif endtime > finn then finn = endtime)))animationRange = interval debb finn	-----end对齐帧处理-----)------------查找蒙皮中具有bip字样的模型并一起选择---------------if selection.count !=0 then(actionMan.executeAction 0 "283"  -- Tools: Unfreeze Allmax unfreeze all	  allTheSkin = for obj in objects where (classof obj==PolyMeshObject)  collect objfor f in allTheSkin do(skinMods = getclassinstances Skin target:f max modify modemodPanel.setCurrentObject f.modifiers[#Skin]skinOps.getnumberbones skinMods[1]bonename =skinOps.getBoneName skinMods[1] 1 0bonename =skinOps.getBoneName skinMods[1] 2 0	if findString bonename "Bip" ==1 then (join mysel f)else(deselect f)selectmore mysel))---------只输出bip模型------------if selection.count !=0 then(AA=Dir+"/"+filename+"."+"model"+".fbx"	exportFile  AA #noPrompt selectedOnly:true using:fbxexpdeselect $	)----end 输出model.fbx-----选择相机(包括隐藏的)跳过目标物体camsARr = for o in cameras where classof o != targetobject collect oselect camsARr  filter:FilterCameras showHidden:trueMaxCamSelSet = selection as array	------start输出cam.fbx------for i in MaxCamSelSet do(MAXCAM= iFreecamera fov:45 targetDistance:314.512 nearclip:1 farclip:1000 nearrange:0 farrange:1000 mpassEnabled:off mpassRenderPerPass:off pos:[0,0,0] isSelected:onhide $$.name =FileName+"."+i.name --设置相机名称UE4CAM =$UE4CAM.Position=MAXCAM.positionUE4CAM.FOV=MAXCAM.FOV--位置约束UE4CAM.Position.controller= Position_Constraint ()A = UE4CAM.Position.controllerA.appendTarget MAXCAM 100--方向约束UE4CAM.rotation.controller= Orientation_Constraint ()B = UE4CAM.rotation.controllerB.appendTarget MAXCAM 100--开始塌陷local forceUpdate = keyboard.shiftPressed -- if SHIFT is pressed when the macro is called, a viewport redraw is enforced for each timestep to ensure a full update of all controllersif forceUpdate then format "MB Collapse: Enforcing full viewport update. This might be slow but will ensure proper updating of all controllers\n"local p = undefinedlocal old_prs_ctrl = copy UE4CAM.transform.controller		-- store old controller for catch()with undo on (if not forceUpdate then disableSceneRedraw();	-- not using redraw context for max4 compatibility-- disableSceneRedraw is problematic as not all scripted controllers are updated!try (p = Point()			-- create temp point object-- copy global transform of source object into temp objectfor i = animationRange.start to animationRange.end do (if forceUpdate then sliderTime = i	-- set slider time to force a global update of all animation dataat time i (with animate on p.transform = UE4CAM.transform))-- kill old transform controller and assign new, clean oneUE4CAM.transform.controller = transform_script()	UE4CAM.transform.controller = prs()	if not (isGroupMember UE4CAM) then UE4CAM.parent = undefined	-- unlink if not in a group-- copy temp object animation back into source objectfor i = animationRange.start to animationRange.end do (at time i (with animate on	UE4CAM.transform = p.transform))delete p			-- delete temp point objp = undefinedif not forceUpdate then enableSceneRedraw())--trycatch(format "coder zsz:QQ  : Fatal error - exiting\n"if p!=undefined then delete pUE4CAM.transform.controller = old_prs_ctrlif not forceUpdate then enableSceneRedraw())-- catch				)--with undo--塌陷结束----对齐相机的关键帧到动画范围---debb = 10000finn=-10000 for a in selection do(if (numKeys a.position.controller > 0)then(sortKeys a.controllernum_keys = numkeys a.position.controllerstarttime = getkeytime a.position.controller 1endtime = starttimefor O = 1 to num_keys do (key_time = getkeytime a.position.controller Oif key_time > endtime thenendtime = key_time)if starttime < debb then debb = starttimeif endtime > finn then finn = endtime)else(starttime = 1endtime = 100				if starttime < debb then debb = starttimeif endtime > finn then finn = endtime				))animationRange = interval debb finn	----对齐相机的关键帧到动画范围end---	--------导出fbx文件-------CAM=MAXCAM.nameBB=DIR+"/"+filename+"."+CAM+".fbx"exportFile  BB #noPrompt selectedOnly:true using:fbxexp	)	------end输出cam.fbx-------- 		------输出cam.txt------if MaxCamSelSet.count !=0 then(		format_txt filepath "renderWidth=" "renderHight=")
-- 		------end输出cam.txt------	------重置max场景-------		resetMaxFile #noPrompt)----删除导入机制生产的备份文件------排除掉新产生的backup文件--NewFiles=getfiles (DIR+"\*.max")for j = 1 to OldFiles.count do	while (index = (findItem NewFiles OldFiles[j])) != 0 do (deleteItem NewFiles index)WillDelFiles=NewFiles---排除掉新产生的backup文件end--for a in WillDelFiles do(			deletefile a) ----删除导入机制生产的备份文件-------释放全局变量DIR	free(DIR)))rollout exportFBX_ue4cam_v2 "批出fb模&UEcam_V2:模式自选" width:200 height:100(
HyperLink explain "指定目录即可,不需要打开文件" pos:[25,0] width:200 height:15 color:(color 255 155 0)
edittext selfile "" pos:[10,15] width:140 height:19 text:"...请选择目录"
button btn_browse "..."  pos:[160,15] width:30 height:19
checkBox ignore "忽略backup文件" pos:[60,35] width:100 height:19
label explain1 "输出相机是打开模式,输出模型是导入模式" pos:[0,64] width:200 height:15 
radioButtons rdo1 "" pos:[30,50] width:168 height:16 labels:#("输出相机", "输出模型") default:1 columns:2	 
button	 bt_create	"批量输出fbx" pos:[20,80] width:150 height:32 enabled:true---函数部分--fn LoadOrMergeFile f = (if rdo1.state ==1 then (loadMaxfile f missingExtFilesAction:#logmsg)if rdo1.state ==2 then (mergeMaxfile f ))  ---------逐行写入文本------------
fn format_txt FilePath filetext1 filetext2=
(	if doesFileExist FilePath == truethen(fin = openfile FilePath mode:"r+"seek fin #eoftxt = filetext1+RenderWidth as string+"\n"+filetext2+RenderHeight as string+"\n"format txt to:finclose fin)else(newfile = createFile FilePath writeBOM:trueclose newfileformat_txt FilePath filetext1 filetext2)
)
-- 逐行写入文本---///end函数部分--on btn_browse pressed do( global DIR = getSavePath caption:"选择max目录"if (DIR != undefined) do ( selfile.text = DIR )	)	on bt_create pressed do( files =DIR+"/"+"*.max"OldFiles=getfiles files	GetFile= getFiles filesif (ignore.checked)then(		---排除掉backup文件--WillDelFiles=getfiles (DIR+"\*backup*.max")for j = 1 to WillDelFiles.count do	while (index = (findItem GetFile WillDelFiles[j])) != 0 do (deleteItem GetFile index)---排除掉backup文件end-- )Maxfiles=GetFile for f in Maxfiles do (---切割文本内容mydir=trimRight f ".max"global FileName=trimLeft mydir DIRglobal FilePath=(DIR+"/"+FileName+".txt") as string	--导入max文件--- LoadOrMergeFile f	 ----输出model.fbx ---		 -- 		ExportModel,见 rdo1的写在那里面if rdo1.state ==1 then (---选择相机(包括隐藏的)跳过目标物体camsArr = for o in cameras where classof o != targetobject collect oselect camsArr  filter:FilterCameras showHidden:trueMaxCamSelSet = selection as array	------start输出cam.fbx------for i in MaxCamSelSet do(MAXCAM= iFreecamera fov:45 targetDistance:314.512 nearclip:1 farclip:1000 nearrange:0 farrange:1000 mpassEnabled:off mpassRenderPerPass:off pos:[0,0,0] isSelected:onhide $$.name =FileName+"."+i.name --设置相机名称UE4CAM =$UE4CAM.Position=MAXCAM.positionUE4CAM.FOV=MAXCAM.FOV--位置约束UE4CAM.Position.controller= Position_Constraint ()A = UE4CAM.Position.controllerA.appendTarget MAXCAM 100--方向约束UE4CAM.rotation.controller= Orientation_Constraint ()B = UE4CAM.rotation.controllerB.appendTarget MAXCAM 100--开始塌陷local forceUpdate = keyboard.shiftPressed -- if SHIFT is pressed when the macro is called, a viewport redraw is enforced for each timestep to ensure a full update of all controllersif forceUpdate then format "MB Collapse: Enforcing full viewport update. This might be slow but will ensure proper updating of all controllers\n"local p = undefinedlocal old_prs_ctrl = copy UE4CAM.transform.controller		-- store old controller for catch()with undo on (if not forceUpdate then disableSceneRedraw();	-- not using redraw context for max4 compatibility-- disableSceneRedraw is problematic as not all scripted controllers are updated!try (p = Point()								-- create temp point object-- copy global transform of source object into temp objectfor i = animationRange.start to animationRange.end do (if forceUpdate then sliderTime = i	-- set slider time to force a global update of all animation dataat time i (with animate on p.transform = UE4CAM.transform))-- kill old transform controller and assign new, clean oneUE4CAM.transform.controller = transform_script()	UE4CAM.transform.controller = prs()	if not (isGroupMember UE4CAM) then UE4CAM.parent = undefined	-- unlink if not in a group-- copy temp object animation back into source objectfor i = animationRange.start to animationRange.end do (at time i (with animate on	UE4CAM.transform = p.transform))delete p			-- delete temp point objp = undefinedif not forceUpdate then enableSceneRedraw())--trycatch(format "coder zsz:QQ  : Fatal error - exiting\n"if p!=undefined then delete pUE4CAM.transform.controller = old_prs_ctrlif not forceUpdate then enableSceneRedraw())-- catch				)--with undo--塌陷结束----对齐相机的关键帧到动画范围---debb = 10000finn=-10000 for a in selection do(if (numKeys a.position.controller > 0)then(sortKeys a.controllernum_keys = numkeys a.position.controllerstarttime = getkeytime a.position.controller 1endtime = starttimefor O = 1 to num_keys do (key_time = getkeytime a.position.controller Oif key_time > endtime thenendtime = key_time)if starttime < debb then debb = starttimeif endtime > finn then finn = endtime)else(starttime = 1endtime = 100				if starttime < debb then debb = starttimeif endtime > finn then finn = endtime				))animationRange = interval debb finn	----对齐相机的关键帧到动画范围end---	--------导出fbx文件-------CAM=MAXCAM.nameFBXFileName=DIR+"/"+FileName+"."+CAM+".fbx"exportFile FBXFileName #noPrompt selectedOnly:true using:fbxexpp	)	------end输出cam.fbx------------输出cam.txt------if MaxCamSelSet.count !=0 then(				format_txt FilePath "renderWidth=" "renderHight=")------end输出cam.txt------)if rdo1.state ==2 then (---------只输出bip模型--------------选择所有bip物体select $'*bip*' mysel= selection as array--根据bip选择根for f in mysel do(fn getRoot node = if isvalidnode node do (while node.parent != undefined do node = node.parent; node)aaa=getRoot fselect aaa)--根据根选择此层级所有物体if selection.count !=0 then(fn getTheChildren obj:selection[1] includeParent:false = (execute ("$'" + (obj.name)+"'/"+(if includeParent then "" else "*/")+".../*"))select (getTheChildren includeParent:true)select (getTheChildren())getTheChildren includeParent:true as arraygetTheChildren() as array)-----对齐帧处理-----debb = 10000finn=-10000 for a in selection do(if  (classof a == BoneGeometry) then(if (numKeys a.position.controller > 0)then(sortKeys a.controllernum_keys = numkeys a.position.controllerstarttime = getkeytime a.position.controller 1endtime = starttimefor O = 1 to num_keys do (key_time = getkeytime a.position.controller Oif key_time > endtime thenendtime = key_time)if starttime < debb then debb = starttimeif endtime > finn then finn = endtime))if (classof a == Biped_Object) then(if (numKeys a.transform.controller > 0)then(sortKeys a.controllernum_keys = numkeys a.transform.controllerstarttime = getkeytime a.transform.controller 1endtime = starttimefor O = 1 to num_keys do (key_time = getkeytime a.transform.controller Oif key_time > endtime thenendtime = key_time)if starttime < debb then debb = starttimeif endtime > finn then finn = endtime)))animationRange = interval debb finn	-----end对齐帧处理-----------------查找蒙皮中具有bip字样的模型并一起选择---------------if selection.count !=0 then(		  actionMan.executeAction 0 "283"  -- Tools: Unfreeze Allmax unfreeze allallTheSkin = for obj in objects where (classof obj==PolyMeshObject)  collect objfor f in allTheSkin do(skinMods = getclassinstances Skin target:f max modify modemodPanel.setCurrentObject f.modifiers[#Skin]skinOps.getnumberbones skinMods[1]bonename =skinOps.getBoneName skinMods[1] 1 0bonename =skinOps.getBoneName skinMods[1] 2 0	if findString bonename "Bip" ==1 then (join mysel f)else(deselect f)selectmore mysel))---------只输出bip模型----------------start 输出model.fbx---	if selection.count !=0 then(		AA=Dir+"/"+FileName+"."+"model"+".fbx"	exportFile  AA #noPrompt selectedOnly:true using:fbxexp)----end 输出model.fbx---) ------重置max场景-------resetMaxFile #noPrompt	)----删除导入机制生产的备份文件------排除掉新产生的backup文件--NewFiles=getfiles (DIR+"\*.max")for j = 1 to OldFiles.count do	while (index = (findItem NewFiles OldFiles[j])) != 0 do (deleteItem NewFiles index)WillDelFiles=NewFiles---排除掉新产生的backup文件end--for a in WillDelFiles do(			deletefile a) ----删除导入机制生产的备份文件-------释放全局变量DIR	free(DIR)))-------------------------------------------------------------	
globalrollout = newrolloutfloater "导ue4模型和相机工具集" 200 535
addRollout export_UE4Cam_v2 globalrollout
addRollout exportFBX globalrollout
addRollout exportFBX_ue4cam_v1 globalrollout
addRollout exportFBX_ue4cam_v2 globalrollout 
-------------------------------------------------------------------------

------分部件代码展示:-----

 rollout export_UE4Cam_v2 "导出UE4Cam_v2:半自动" width:200 height:120(HyperLink  explain "在打开的max文件中使用" pos:[25,12] width:200 height:15 color:(color 255 155 0)	 GroupBox grp1 "要导出的相机名" pos:[5,28] width:179 height:40pickbutton OutCam "拾取相机" pos:[20,40] width:150 height:20GroupBox grp2 "要导出的fbx文件名" pos:[5,70] width:179 height:50button	 bt_create	"Create UE4 Camera" pos:[20,85] width:150 height:32 enabled:true-----逐行写入文本------------
fn format_txt FilePath filetext1 filetext2=
(	if doesFileExist FilePath == truethen(fin = openfile FilePath mode:"r+"seek fin #eoftxt = filetext1+RenderWidth as string+"\n"+filetext2+RenderHeight as string+"\n"format txt to:finclose fin)else(newfile = createFile FilePath writeBOM:trueclose newfileformat_txt FilePath filetext1 filetext2)
)
-----end逐行写入文本-----------------on OutCam picked obj do(OutCam.text = obj.name)on bt_create pressed do(		Freecamera fov:45 targetDistance:314.512 nearclip:1 farclip:1000 nearrange:0 farrange:1000 mpassEnabled:off mpassRenderPerPass:off pos:[0,0,0] isSelected:onmycam = OutCam.text$.name = mycamUE4CAM =$MAXCAM =getnodebyname mycamUE4CAM.Position=MAXCAM.positionUE4CAM.FOV=MAXCAM.FOV--位置约束UE4CAM.Position.controller= Position_Constraint ()A = UE4CAM.Position.controllerA.appendTarget MAXCAM 100--方向约束UE4CAM.rotation.controller= Orientation_Constraint ()B = UE4CAM.rotation.controllerB.appendTarget MAXCAM 100--开始塌陷local forceUpdate = keyboard.shiftPressed -- if SHIFT is pressed when the macro is called, a viewport redraw is enforced for each timestep to ensure a full update of all controllersif forceUpdate then format "MB Collapse: Enforcing full viewport update. This might be slow but will ensure proper updating of all controllers\n"local p = undefinedlocal old_prs_ctrl = copy UE4CAM.transform.controller		-- store old controller for catch()with undo on (if not forceUpdate then disableSceneRedraw();	-- not using redraw context for max4 compatibility-- disableSceneRedraw is problematic as not all scripted controllers are updated!try (p = Point()			-- create temp point object-- copy global transform of source object into temp objectfor i = animationRange.start to animationRange.end do (if forceUpdate then sliderTime = i	-- set slider time to force a global update of all animation dataat time i (with animate on p.transform = UE4CAM.transform))-- kill old transform controller and assign new, clean oneUE4CAM.transform.controller = transform_script()	UE4CAM.transform.controller = prs()	if not (isGroupMember UE4CAM) then UE4CAM.parent = undefined	-- unlink if not in a group-- copy temp object animation back into source objectfor i = animationRange.start to animationRange.end do (at time i (with animate on	UE4CAM.transform = p.transform))delete p			-- delete temp point objp = undefinedif not forceUpdate then enableSceneRedraw())--trycatch(format "coder zsz:QQ  : Fatal error - exiting\n"if p!=undefined then delete pUE4CAM.transform.controller = old_prs_ctrlif not forceUpdate then enableSceneRedraw())-- catch				)--with undo--塌陷结束-----导出fbx文件------ 使用一个.net文件windows窗口—导出fbx文件browse_dialog = dotNetObject "System.Windows.Forms.SaveFileDialog" --建立一个打开文件对话框DotNetFile = DotNetClass "System.IO.File"--创建.net文件browse_dialog.title = "保存文件" --设置标题browse_dialog.Filter = "fbx Files (*.fbx)|*.fbx|All Files (*.*)|*.*" --确认这个文件过滤browse_dialog.fileName = trimright maxfilename ".max"browse_dialog.FilterIndex = 2 --设置文件过滤下拉菜单长度result = browse_dialog.showDialog() --显示对话框,得到的结果进变量if (result.Equals result.OK) then(if ( not (DotNetFile.Exists browse_dialog.FileName)) then(select UE4CAMif selection.count !=0 then(	AA=browse_dialog.fileName+".fbx"exportFile AA  #noPrompt selectedOnly:true using:fbxexpBB=browse_dialog.fileName+".TXT"format_txt BB "renderWidth=" "renderHight=")))			--删除相机 	delete UE4CAMfree(filepath)					))

rollout exportFBX "导出fbx模:半自动" width:200 height:100(HyperLink explain "在打开的max文件中使用" pos:[25,0] width:200 height:15 color:(color 255 155 0)	 GroupBox grp1 "要导出的角色根骨骼" pos:[5,15] width:179 height:80pickbutton PickRoot "拾取根骨骼" pos:[20,30] width:150 height:20button	 bt_OutFBX	"输出fbx模型" pos:[20,55] width:150 height:30 enabled:trueon PickRoot picked obj do( PickRoot.text = obj.name)		on bt_OutFBX pressed do( ChrBone=getnodebyname PickRoot.textselect ChrBone--根据根选择此层级所有物体if selection.count !=0 then(fn getTheChildren obj:selection[1] includeParent:false = (execute ("$'" + (obj.name)+"'/"+(if includeParent then "" else "*/")+".../*"))select (getTheChildren includeParent:true)select (getTheChildren())getTheChildren includeParent:true as arraygetTheChildren() as array)mysel=selection as array -----对齐帧处理-----debb = 10000finn=-10000 for a in selection do(if  (classof a == BoneGeometry) then(if (numKeys a.position.controller > 0)then(sortKeys a.controllernum_keys = numkeys a.position.controllerstarttime = getkeytime a.position.controller 1endtime = starttimefor O = 1 to num_keys do (key_time = getkeytime a.position.controller Oif key_time > endtime thenendtime = key_time)if starttime < debb then debb = starttimeif endtime > finn then finn = endtime))if (classof a == Biped_Object) then(if (numKeys a.transform.controller > 0)then(sortKeys a.controllernum_keys = numkeys a.transform.controllerstarttime = getkeytime a.transform.controller 1endtime = starttimefor O = 1 to num_keys do (key_time = getkeytime a.transform.controller Oif key_time > endtime thenendtime = key_time)if starttime < debb then debb = starttimeif endtime > finn then finn = endtime)))animationRange = interval debb finn	-----end对齐帧处理-----------------查找蒙皮中具有bip字样的模型并一起选择---------------if selection.count !=0 then(actionMan.executeAction 0 "283"  -- Tools: Unfreeze Allmax unfreeze all	  allTheSkin = for obj in objects where (classof obj==PolyMeshObject)  collect objfor f in allTheSkin do(skinMods = getclassinstances Skin target:f max modify modemodPanel.setCurrentObject f.modifiers[#Skin]skinOps.getnumberbones skinMods[1]bonename =skinOps.getBoneName skinMods[1] 1 0bonename =skinOps.getBoneName skinMods[1] 2 0	if findString bonename "Bip" ==1 then (join mysel f)else(deselect f)selectmore mysel))-----使用一个.net文件windows窗口—导出fbx文件------browse_dialog = dotNetObject "System.Windows.Forms.SaveFileDialog" --建立一个打开文件对话框DotNetFile = DotNetClass "System.IO.File"--创建.net文件browse_dialog.title = "保存文件" --设置标题browse_dialog.Filter = "fbx Files (*.fbx)|*.fbx|All Files (*.*)|*.*" --确认这个文件过滤browse_dialog.fileName = trimright maxfilename ".max"browse_dialog.FilterIndex = 2 --设置文件过滤下拉菜单长度result = browse_dialog.showDialog() --显示对话框,得到的结果进变量if (result.Equals result.OK) then(if ( not (DotNetFile.Exists browse_dialog.FileName)) then(if selection.count !=0 then(	AA=browse_dialog.fileName+"."+"model"+".fbx"exportFile AA #noPrompt selectedOnly:true using:fbxexp)))))

 rollout exportFBX_ue4cam_v1 "批出fbx模&UEcam_V1:自动" width:200 height:120(
HyperLink explain "指定目录即可,不需要打开文件" pos:[25,0] width:200 height:15  color:(color 255 155 0)
edittext selfile "" pos:[10,20] width:140 height:19 text:"...请选择目录"
button btn_browse "..."  pos:[160,20] width:30 height:19 
checkBox ignore "忽略backup文件" pos:[60,40] width:100 height:19
-- radioButtons rdo1 "" pos:[30,40] width:168 height:16 labels:#("输出相机", "输出模型") default:1 columns:2	 
button	 bt_create	"批量输出fbx" pos:[20,60] width:150 height:32 enabled:true-------逐行写入文本------------
fn format_txt filepath filetext1 filetext2=
(	if doesFileExist filepath == truethen(fin = openfile filepath mode:"r+"seek fin #eoftxt = filetext1+RenderWidth as string+"\n"+filetext2+RenderHeight as string+"\n"format txt to:finclose fin)else(newfile = createFile filepath writeBOM:trueclose newfileformat_txt filepath filetext1 filetext2)
)  -- 逐行写入文本	 on btn_browse pressed do( 		global DIR = getSavePath caption:"选择max目录"if (DIR != undefined) then ( selfile.text = dir ))		on bt_create pressed do( files =DIR+"\*.max"OldFiles=getfiles files	GetFile= getFiles files	 if (ignore.checked) then(---排除掉backup文件--UndoFiles=getfiles (DIR+"\*backup*.max")for j = 1 to UndoFiles.count do	while (index = (findItem GetFile UndoFiles[j])) != 0 do (deleteItem GetFile index)---排除掉backup文件end--	 )	Maxfiles=GetFilefor f in Maxfiles do (--打开max文件--- loadMaxfile f missingExtFilesAction:#logmsg---切割文本内容mydir=trimRight f ".max"global filename=trimLeft mydir DIRglobal filepath=(DIR+"/"+filename+".txt") as string		 --------start 输出model.fbx-------	---------只输出bip模型--------------选择所有bip物体select $'*bip*' mysel= selection as array--根据bip选择根for f in mysel do(fn getRoot node = if isvalidnode node do (while node.parent != undefined do node = node.parent; node)aaa=getRoot fselect aaa)--根据根选择此层级所有物体if (selection.count !=0) then(fn getTheChildren obj:selection[1] includeParent:false = (execute ("$'" + (obj.name)+"'/"+(if includeParent then "" else "*/")+".../*"))select (getTheChildren includeParent:true)select (getTheChildren())getTheChildren includeParent:true as arraygetTheChildren() as array)if (selection.count !=0) do(-----对齐帧处理-----debb = 10000finn=-10000 for a in selection do(if  (classof a == BoneGeometry) then(if (numKeys a.position.controller > 0)then(sortKeys a.controllernum_keys = numkeys a.position.controllerstarttime = getkeytime a.position.controller 1endtime = starttimefor O = 1 to num_keys do (key_time = getkeytime a.position.controller Oif key_time > endtime thenendtime = key_time)if starttime < debb then debb = starttimeif endtime > finn then finn = endtime))else if (classof a == Biped_Object) then(if (numKeys a.transform.controller > 0)then(sortKeys a.controllernum_keys = numkeys a.transform.controllerstarttime = getkeytime a.transform.controller 1endtime = starttimefor O = 1 to num_keys do (key_time = getkeytime a.transform.controller Oif key_time > endtime thenendtime = key_time)if starttime < debb then debb = starttimeif endtime > finn then finn = endtime)))animationRange = interval debb finn	-----end对齐帧处理-----)------------查找蒙皮中具有bip字样的模型并一起选择---------------if selection.count !=0 then(actionMan.executeAction 0 "283"  -- Tools: Unfreeze Allmax unfreeze all	  allTheSkin = for obj in objects where (classof obj==PolyMeshObject)  collect objfor f in allTheSkin do(skinMods = getclassinstances Skin target:f max modify modemodPanel.setCurrentObject f.modifiers[#Skin]skinOps.getnumberbones skinMods[1]bonename =skinOps.getBoneName skinMods[1] 1 0bonename =skinOps.getBoneName skinMods[1] 2 0	if findString bonename "Bip" ==1 then (join mysel f)else(deselect f)selectmore mysel))---------只输出bip模型------------if selection.count !=0 then(AA=Dir+"/"+filename+"."+"model"+".fbx"	exportFile  AA #noPrompt selectedOnly:true using:fbxexpdeselect $	)----end 输出model.fbx-----选择相机(包括隐藏的)跳过目标物体camsARr = for o in cameras where classof o != targetobject collect oselect camsARr  filter:FilterCameras showHidden:trueMaxCamSelSet = selection as array	------start输出cam.fbx------for i in MaxCamSelSet do(MAXCAM= iFreecamera fov:45 targetDistance:314.512 nearclip:1 farclip:1000 nearrange:0 farrange:1000 mpassEnabled:off mpassRenderPerPass:off pos:[0,0,0] isSelected:onhide $$.name =FileName+"."+i.name --设置相机名称UE4CAM =$UE4CAM.Position=MAXCAM.positionUE4CAM.FOV=MAXCAM.FOV--位置约束UE4CAM.Position.controller= Position_Constraint ()A = UE4CAM.Position.controllerA.appendTarget MAXCAM 100--方向约束UE4CAM.rotation.controller= Orientation_Constraint ()B = UE4CAM.rotation.controllerB.appendTarget MAXCAM 100--开始塌陷local forceUpdate = keyboard.shiftPressed -- if SHIFT is pressed when the macro is called, a viewport redraw is enforced for each timestep to ensure a full update of all controllersif forceUpdate then format "MB Collapse: Enforcing full viewport update. This might be slow but will ensure proper updating of all controllers\n"local p = undefinedlocal old_prs_ctrl = copy UE4CAM.transform.controller		-- store old controller for catch()with undo on (if not forceUpdate then disableSceneRedraw();	-- not using redraw context for max4 compatibility-- disableSceneRedraw is problematic as not all scripted controllers are updated!try (p = Point()			-- create temp point object-- copy global transform of source object into temp objectfor i = animationRange.start to animationRange.end do (if forceUpdate then sliderTime = i	-- set slider time to force a global update of all animation dataat time i (with animate on p.transform = UE4CAM.transform))-- kill old transform controller and assign new, clean oneUE4CAM.transform.controller = transform_script()	UE4CAM.transform.controller = prs()	if not (isGroupMember UE4CAM) then UE4CAM.parent = undefined	-- unlink if not in a group-- copy temp object animation back into source objectfor i = animationRange.start to animationRange.end do (at time i (with animate on	UE4CAM.transform = p.transform))delete p			-- delete temp point objp = undefinedif not forceUpdate then enableSceneRedraw())--trycatch(format "coder zsz:QQ  : Fatal error - exiting\n"if p!=undefined then delete pUE4CAM.transform.controller = old_prs_ctrlif not forceUpdate then enableSceneRedraw())-- catch				)--with undo--塌陷结束----对齐相机的关键帧到动画范围---debb = 10000finn=-10000 for a in selection do(if (numKeys a.position.controller > 0)then(sortKeys a.controllernum_keys = numkeys a.position.controllerstarttime = getkeytime a.position.controller 1endtime = starttimefor O = 1 to num_keys do (key_time = getkeytime a.position.controller Oif key_time > endtime thenendtime = key_time)if starttime < debb then debb = starttimeif endtime > finn then finn = endtime)else(starttime = 1endtime = 100				if starttime < debb then debb = starttimeif endtime > finn then finn = endtime				))animationRange = interval debb finn	----对齐相机的关键帧到动画范围end---	--------导出fbx文件-------CAM=MAXCAM.nameBB=DIR+"/"+filename+"."+CAM+".fbx"exportFile  BB #noPrompt selectedOnly:true using:fbxexp	)	------end输出cam.fbx-------- 		------输出cam.txt------if MaxCamSelSet.count !=0 then(		format_txt filepath "renderWidth=" "renderHight=")
-- 		------end输出cam.txt------	------重置max场景-------		resetMaxFile #noPrompt)----删除导入机制生产的备份文件------排除掉新产生的backup文件--NewFiles=getfiles (DIR+"\*.max")for j = 1 to OldFiles.count do	while (index = (findItem NewFiles OldFiles[j])) != 0 do (deleteItem NewFiles index)WillDelFiles=NewFiles---排除掉新产生的backup文件end--for a in WillDelFiles do(			deletefile a) ----删除导入机制生产的备份文件-------释放全局变量DIR	free(DIR)))

 rollout exportFBX_ue4cam_v2 "批出fb模&UEcam_V2:模式自选" width:200 height:100(
HyperLink explain "指定目录即可,不需要打开文件" pos:[25,0] width:200 height:15 color:(color 255 155 0)
edittext selfile "" pos:[10,15] width:140 height:19 text:"...请选择目录"
button btn_browse "..."  pos:[160,15] width:30 height:19
checkBox ignore "忽略backup文件" pos:[60,35] width:100 height:19
label explain1 "输出相机是打开模式,输出模型是导入模式" pos:[0,64] width:200 height:15 
radioButtons rdo1 "" pos:[30,50] width:168 height:16 labels:#("输出相机", "输出模型") default:1 columns:2	 
button	 bt_create	"批量输出fbx" pos:[20,80] width:150 height:32 enabled:true---函数部分--fn LoadOrMergeFile f = (if rdo1.state ==1 then (loadMaxfile f missingExtFilesAction:#logmsg)if rdo1.state ==2 then (mergeMaxfile f ))  ---------逐行写入文本------------
fn format_txt FilePath filetext1 filetext2=
(	if doesFileExist FilePath == truethen(fin = openfile FilePath mode:"r+"seek fin #eoftxt = filetext1+RenderWidth as string+"\n"+filetext2+RenderHeight as string+"\n"format txt to:finclose fin)else(newfile = createFile FilePath writeBOM:trueclose newfileformat_txt FilePath filetext1 filetext2)
)
-- 逐行写入文本---///end函数部分--on btn_browse pressed do( global DIR = getSavePath caption:"选择max目录"if (DIR != undefined) do ( selfile.text = DIR )	)	on bt_create pressed do( files =DIR+"/"+"*.max"OldFiles=getfiles files	GetFile= getFiles filesif (ignore.checked)then(		---排除掉backup文件--WillDelFiles=getfiles (DIR+"\*backup*.max")for j = 1 to WillDelFiles.count do	while (index = (findItem GetFile WillDelFiles[j])) != 0 do (deleteItem GetFile index)---排除掉backup文件end-- )Maxfiles=GetFile for f in Maxfiles do (---切割文本内容mydir=trimRight f ".max"global FileName=trimLeft mydir DIRglobal FilePath=(DIR+"/"+FileName+".txt") as string	--导入max文件--- LoadOrMergeFile f	 ----输出model.fbx ---		 -- 		ExportModel,见 rdo1的写在那里面if rdo1.state ==1 then (---选择相机(包括隐藏的)跳过目标物体camsArr = for o in cameras where classof o != targetobject collect oselect camsArr  filter:FilterCameras showHidden:trueMaxCamSelSet = selection as array	------start输出cam.fbx------for i in MaxCamSelSet do(MAXCAM= iFreecamera fov:45 targetDistance:314.512 nearclip:1 farclip:1000 nearrange:0 farrange:1000 mpassEnabled:off mpassRenderPerPass:off pos:[0,0,0] isSelected:onhide $$.name =FileName+"."+i.name --设置相机名称UE4CAM =$UE4CAM.Position=MAXCAM.positionUE4CAM.FOV=MAXCAM.FOV--位置约束UE4CAM.Position.controller= Position_Constraint ()A = UE4CAM.Position.controllerA.appendTarget MAXCAM 100--方向约束UE4CAM.rotation.controller= Orientation_Constraint ()B = UE4CAM.rotation.controllerB.appendTarget MAXCAM 100--开始塌陷local forceUpdate = keyboard.shiftPressed -- if SHIFT is pressed when the macro is called, a viewport redraw is enforced for each timestep to ensure a full update of all controllersif forceUpdate then format "MB Collapse: Enforcing full viewport update. This might be slow but will ensure proper updating of all controllers\n"local p = undefinedlocal old_prs_ctrl = copy UE4CAM.transform.controller		-- store old controller for catch()with undo on (if not forceUpdate then disableSceneRedraw();	-- not using redraw context for max4 compatibility-- disableSceneRedraw is problematic as not all scripted controllers are updated!try (p = Point()								-- create temp point object-- copy global transform of source object into temp objectfor i = animationRange.start to animationRange.end do (if forceUpdate then sliderTime = i	-- set slider time to force a global update of all animation dataat time i (with animate on p.transform = UE4CAM.transform))-- kill old transform controller and assign new, clean oneUE4CAM.transform.controller = transform_script()	UE4CAM.transform.controller = prs()	if not (isGroupMember UE4CAM) then UE4CAM.parent = undefined	-- unlink if not in a group-- copy temp object animation back into source objectfor i = animationRange.start to animationRange.end do (at time i (with animate on	UE4CAM.transform = p.transform))delete p			-- delete temp point objp = undefinedif not forceUpdate then enableSceneRedraw())--trycatch(format "coder zsz:QQ  : Fatal error - exiting\n"if p!=undefined then delete pUE4CAM.transform.controller = old_prs_ctrlif not forceUpdate then enableSceneRedraw())-- catch				)--with undo--塌陷结束----对齐相机的关键帧到动画范围---debb = 10000finn=-10000 for a in selection do(if (numKeys a.position.controller > 0)then(sortKeys a.controllernum_keys = numkeys a.position.controllerstarttime = getkeytime a.position.controller 1endtime = starttimefor O = 1 to num_keys do (key_time = getkeytime a.position.controller Oif key_time > endtime thenendtime = key_time)if starttime < debb then debb = starttimeif endtime > finn then finn = endtime)else(starttime = 1endtime = 100				if starttime < debb then debb = starttimeif endtime > finn then finn = endtime				))animationRange = interval debb finn	----对齐相机的关键帧到动画范围end---	--------导出fbx文件-------CAM=MAXCAM.nameFBXFileName=DIR+"/"+FileName+"."+CAM+".fbx"exportFile FBXFileName #noPrompt selectedOnly:true using:fbxexpp	)	------end输出cam.fbx------------输出cam.txt------if MaxCamSelSet.count !=0 then(				format_txt FilePath "renderWidth=" "renderHight=")------end输出cam.txt------)if rdo1.state ==2 then (---------只输出bip模型--------------选择所有bip物体select $'*bip*' mysel= selection as array--根据bip选择根for f in mysel do(fn getRoot node = if isvalidnode node do (while node.parent != undefined do node = node.parent; node)aaa=getRoot fselect aaa)--根据根选择此层级所有物体if selection.count !=0 then(fn getTheChildren obj:selection[1] includeParent:false = (execute ("$'" + (obj.name)+"'/"+(if includeParent then "" else "*/")+".../*"))select (getTheChildren includeParent:true)select (getTheChildren())getTheChildren includeParent:true as arraygetTheChildren() as array)-----对齐帧处理-----debb = 10000finn=-10000 for a in selection do(if  (classof a == BoneGeometry) then(if (numKeys a.position.controller > 0)then(sortKeys a.controllernum_keys = numkeys a.position.controllerstarttime = getkeytime a.position.controller 1endtime = starttimefor O = 1 to num_keys do (key_time = getkeytime a.position.controller Oif key_time > endtime thenendtime = key_time)if starttime < debb then debb = starttimeif endtime > finn then finn = endtime))if (classof a == Biped_Object) then(if (numKeys a.transform.controller > 0)then(sortKeys a.controllernum_keys = numkeys a.transform.controllerstarttime = getkeytime a.transform.controller 1endtime = starttimefor O = 1 to num_keys do (key_time = getkeytime a.transform.controller Oif key_time > endtime thenendtime = key_time)if starttime < debb then debb = starttimeif endtime > finn then finn = endtime)))animationRange = interval debb finn	-----end对齐帧处理-----------------查找蒙皮中具有bip字样的模型并一起选择---------------if selection.count !=0 then(		  actionMan.executeAction 0 "283"  -- Tools: Unfreeze Allmax unfreeze allallTheSkin = for obj in objects where (classof obj==PolyMeshObject)  collect objfor f in allTheSkin do(skinMods = getclassinstances Skin target:f max modify modemodPanel.setCurrentObject f.modifiers[#Skin]skinOps.getnumberbones skinMods[1]bonename =skinOps.getBoneName skinMods[1] 1 0bonename =skinOps.getBoneName skinMods[1] 2 0	if findString bonename "Bip" ==1 then (join mysel f)else(deselect f)selectmore mysel))---------只输出bip模型----------------start 输出model.fbx---	if selection.count !=0 then(		AA=Dir+"/"+FileName+"."+"model"+".fbx"	exportFile  AA #noPrompt selectedOnly:true using:fbxexp)----end 输出model.fbx---) ------重置max场景-------resetMaxFile #noPrompt	)----删除导入机制生产的备份文件------排除掉新产生的backup文件--NewFiles=getfiles (DIR+"\*.max")for j = 1 to OldFiles.count do	while (index = (findItem NewFiles OldFiles[j])) != 0 do (deleteItem NewFiles index)WillDelFiles=NewFiles---排除掉新产生的backup文件end--for a in WillDelFiles do(			deletefile a) ----删除导入机制生产的备份文件-------释放全局变量DIR	free(DIR)))

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/diannao/5396.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

一个单例模式中使用std::unique_ptr引起的莫名其妙的COFF损坏的问题(未解决)

使用static std::unique_ptr和static std::shared_ptr都不行struct IElementAgendaEvents {//! Called to allow listeners to modify the agenda by adding/removing entries before applying tool operation. Return true if entries added or invalidated.virtual bool …

【Vue 2.x】学习vue之一基础部分

文章目录 Vue 一基础部分第一章1、git两个分支主分支子分支 使用方法方式1&#xff1a;采用命令的方式操作分支方式2&#xff1a;在idea中使用git的分支 向git远程仓库提交时忽略文件使用git时的一些冲突注意事项 2、Vue问题1&#xff1a;什么是Vue&#xff1f;问题2&#xff1…

Activiti7 开发快速入门【2024版】

记录开发最核心的部分&#xff0c;理论结合业务实操减少废话&#xff0c;从未接触工作流快速带入开发。假设你是后端的同学学过JAVA和流程图&#xff0c;则可以继续向后看&#xff0c;否则先把基础课程书准备好先翻翻。 为什么要工作流 比起直接使用状态字段&#xff0c;工作…

dvwa kali SQL注入

high: 1.txt的来源 1.txt的内容 手动添加&#xff1a; id1&SubmitSubmit 执行&#xff1a; sqlmap -r /root/1.txt -p id --second-url "http://192.168.159.128:20000/vulnerabilities/sqli_blind/" --batch medium&#xff1a; 换链接&#xff0c;换cook…

【JS篇之】异常

前言&#xff1a;在代码编写过程中&#xff0c;最常遇到的就是程序异常。其实异常并非坏事&#xff0c;它可以让开发人员及时发现、定位到错误&#xff0c;提醒我们做正确的事情&#xff0c;甚至在某些时候&#xff0c;我们还会手动抛出异常。 1.异常的分类 在JS中&#xff0…

LinkedList与链表

文章目录 ArrayList的缺陷链表链表的概念及结构链表的实现 LinkedList的使用什么是LinkedListLinkedList具体使用 ArrayList和LinkedList的区别 ArrayList的缺陷 通过源码知道&#xff0c;ArrayList底层使用数组来存储元素 由于其底层是一段连续空间&#xff0c;当在ArrayList任…

uniApp+Vue3+vite+Element UI或者Element Plus开发学习,使用vite构建管理项目,HBuilderX做为开发者工具

我们通常给小程序或者app开发后台时&#xff0c;不可避免的要用到可视化的数据管理后台&#xff0c;而vue和Element是我们目前比较主流的开发管理后台的主流搭配。所以今天石头哥就带大家来一起学习下vue3和Element plus的开发。 准备工作 1&#xff0c;下载HBuilderX 开发者…

【webrtc】MessageHandler 8: 基于线程的消息处理:处理音频输入输出断开

m98代码,看起来m114 去掉了MessageHandler :音频的录制和播放 都使用了on message,但只是用来通知并处理流的断开的。AAudioRecorder AAudioRecorder 处理流断开 OnErrorCallback :有可能 错误回调是别处来的,是其他线程, 但是这个错误的处理要再自己的线程执行: 音频播…

Go中为什么不建议用锁?

Go语言中是不建议用锁&#xff0c;而是用通道Channel来代替(不要通过共享内存来通信&#xff0c;而通过通信来共享内存)&#xff0c;当然锁也是可以用&#xff0c;锁是防止同一时刻多个goroutine操作同一个资源&#xff1b; GO语言中&#xff0c;要传递某个数据给另一个gorout…

JavaScript原型链深度剖析

目录 前言 一、原型链 1.原型链的主要组成 原型&#xff08;Prototype&#xff09; 构造函数&#xff08;Constructor&#xff09; 实例&#xff08;Instance&#xff09; 2.原型链的工作原理 前言 在JavaScript的世界中&#xff0c;原型链&#xff08;Prototype Chain&…

R语言的学习——day1

将数据框中某一列数据改成行名 代码 结果

.net core ef 连表查询

Information和TypeInfo连表查询 类似&#xff1a; select st.Title1,si.* from [Star_Information] si left join Star_TypeInfo st on si.typeId2st.id 先在EfCoreDbContext.cs配置 protected override void OnModelCreating(ModelBuilder builder){base.OnModelCreating(b…

基于SSM的文物管理系统(含源码+sql+视频导入教程+文档+PPT)

&#x1f449;文末查看项目功能视频演示获取源码sql脚本视频导入教程视频 1 、功能描述 基于SSM的文物管理系统拥有俩种角色 管理员&#xff1a;个人信息管理、用户管理、分类管理、文物信息管理、文物外借管理、文物维修管理、留言板管理等 用户&#xff1a;登录注册、分类…

[华为OD] C卷 服务器cpu交换 现有两组服务器QA和B,每组有多个算力不同的CPU 100

题目&#xff1a; 现有两组服务器QA和B,每组有多个算力不同的CPU,其中A[i]是A组第i个CPU的运算能 力&#xff0c;B[i]是B组第i个CPU的运算能力。一组服务器的总算力是各CPU的算力之和。 为了让两组服务器的算力相等&#xff0c;允许从每组各选出一个CPU进行一次交换。 求两…

Linux 权限的简单讲解

1、前言 当我们分别使用 touch、mkdir 命令创建一名为 test1 的文件和名为 test2 的目录&#xff0c;发现其中有些参数不一样&#xff0c;本文就来给大家来剖析一下。 2、 参数讲解 我们可以通过切片分为下面几个区域&#xff0c;本文就只简单讲解文件类型、权限、所属用户、所…

CGAL 网格热力图

文章目录 一、简介二、实现代码三、实现效果参考资料一、简介 这里实现一个很有趣的功能,生成网格热力图,思路其实很简单:通过指定一个点,计算网格其他点到指定点的测地线距离,以此来为每个网格顶点进行赋色即可。 二、实现代码 //CGAL #include <CGAL/Simple_cartesi…

用HTML5实现播放gif文件

用HTML5实现播放gif文件 在HTML5中&#xff0c;你可以使用<img>标签来播放GIF文件。GIF文件本质上是一种图像格式&#xff0c;它支持动画效果&#xff0c;因此当在网页上加载时&#xff0c;它会自动播放动画。先看一个简单的示例&#xff1a; <!DOCTYPE html> &l…

Elasticsearch:探索 11 种流行的机器学习算法

作者&#xff1a;来自 Elastic Elastic Platform Team 过去几年中&#xff0c;机器学习&#xff08;ML&#xff09;已经悄然成为我们日常生活中不可或缺的一部分。它影响着从购物网站和流媒体网站上的个性化推荐&#xff0c;到保护我们的收件箱免受我们每天收到的大量垃圾邮件的…

2024年第二十六届“华东杯”(B题)大学生数学建模挑战赛|数学建模完整代码+建模过程全解全析

当大家面临着复杂的数学建模问题时&#xff0c;你是否曾经感到茫然无措&#xff1f;作为2022年美国大学生数学建模比赛的O奖得主&#xff0c;我为大家提供了一套优秀的解题思路&#xff0c;让你轻松应对各种难题。 让我们来看看华东杯 (B题&#xff09;&#xff01; 第一个问题…

神经网络与深度学习(四)--自然语言处理NLP

这里写目录标题 1.序列模型2.数据预处理2.1特征编码2.2文本处理 3.文本预处理与词嵌入3.1文本预处理3.2文本嵌入 3.RNN模型3.1RNN概要3.2RNN误差反传 4.门控循环单元&#xff08;GRU&#xff09;4.1GRU基本结构 5.长短期记忆网络 (LSTM) 1.序列模型 分类问题与预测问题 图像分…