动作批量导出fbx插件

 描述:3D角色做完把模型给动作,然后动作做完需要导出fbx到unity,当有大量的动作需要导出的时候,对动作来说是非常痛苦的,所以根据动作max文件的储存路劲与max的命名,做了一个批量导出工具。这里将导出类型分成NPC,body,face,head,可以根据自己的项目进行更改。工具截图如下:

 

代码如下

macroscript 批量导出category:"批量导出"
toolTip:""
(
	rollout Export "动作批量导出插件" width:215 height:296
	(
		edittext importPath "导入路径" pos:[7,31] width:197 height:19
		label Label01 "动作批量导出插件" pos:[60,4] width:107 height:20
		button ExportSkin "导出蒙皮" pos:[33,225] width:66 height:34
		edittext exportPath "导出路径" pos:[10,130] width:192 height:20
		checkbox body "body" pos:[20,62] width:56 height:16 enabled:true checked:false
		checkbox head "head" pos:[81,61] width:43 height:15 enabled:true
		checkbox NPC "NPC" pos:[21,89] width:60 height:18
		
		
		
		
		checkbox face "face" pos:[139,61] width:41 height:16
		
		
		
		button ExportAni "导出动作" pos:[120,226] width:66 height:34
		on ExportSkin pressed do
		(
			body_int=0
			head_int =0
			face_int=0
			NPC_int=0
			if importPath.text.count != 0 and exportPath.text.count!=0 and (head.state!=false or body.state!=false or NPC.state!=false or face.state !=false) then
			(
				importFiles = getFiles(importPath.text+"\\*"+".max")
				savefilepath = ()
		--如果设置了导出身体
				if body.state == true then
				(
					for f in importFiles do
					(
						loadMaxFile f quiet:true
						arrayExportbody = #()
						for i in $*body do 
						(
							if (i.isHidden == false) then			
							append arrayExportbody i       --将以body结尾的所有物体加入数组
						)
						if arrayExportbody.count != 0 then
						(
							body_int+=1
							for i in geometry do i.isHidden = true --隐藏所有的物体
						
							for i in arrayExportbody do
							(
								i.isHidden =false   -- 先将第一个身体显示,此时应该只有第一个身体还有骨骼 没其他任何物件
								max select all
								filename = i.name
								savefilepath = exportPath.text
								exfile = savefilepath +"\\"+ filename
								FbxExporterSetParam"Animation" false
								FbxExporterSetParam "BakeAnimation"false
						
								Exportfile exfile  #noPrompt  using:exporterPlugin.classes[8]
								i.isHidden =true
							)
							shellLaunch savefilepath""
						)
				
					)	
				)
		--如果设置了导出头部
				else if head.state== true  then
				(
					for f in importFiles do
					(
						loadMaxFile f quiet:true
						arrayExporthead = #()
						for i in $*head do 
						(
							if (i.isHidden == false) then
							append arrayExporthead i       --将以body结尾的所有物体加入数组
						)
						if arrayExporthead.count != 0 then
						(
							head_int+=1
							for i in geometry do i.isHidden = true --隐藏所有的物体
						
							for i in arrayExporthead do
							(
								i.isHidden =false   -- 先将第一个身体显
  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值