部分情况下,osgb导出的fbx模型进入unity后,会出现破面问题。此时,将模型导入3dmax再导出,可解决这一问题。为了适应大量模型的自动处理,制作了以下的ms插件。
FBXImporterSetParam "Animation" false -- 动画
FBXImporterSetParam "Cameras" false -- 摄像机
FBXImporterSetParam "Lights" false -- 灯光
FBXImporterSetParam "Mode" #create -- 导入设置(仅添加)
--设置FBX导出对话框参数
FBXExporterSetParam "Animation" False -- 关闭动画
FBXExporterSetParam "Cameras" False -- 关闭摄像机
FBXExporterSetParam "EmbedTextures" True -- 嵌入纹理
FBXExporterSetParam "Lights" False -- 关闭灯光
-----------------------------------------------------------------------------------------------------------------------actionMan.executeAction 0 "40472"rollout form "FBX文件自动处理"
(label lbl "点击导入fbx路径按钮,自动导入并导出fbx文件到本身所在文件夹" width:280 height:60 align:#left -- 标记名称button 'btnImport' "导入fbx路径" pos:[203,85] width:90 height:35 align:#left -- 按钮名称 on btnImport pressed do(floderPath = "C:\Users\31191\Desktop\Test"dir_array = GetDirectories (floderPath + "/*")for d in dir_array do(fs = getfiles(d + "*.fbx")for f in fs do(Global obj_FileName = getFilenameFile fGlobal exportPath = getFilenamePath f +"\\"+ obj_FileName; -- 对文件路径与名称赋值print exportPathimportFile f #noPrompt using:Fbximporter -- 用fbx导入器导入文件Scene_Converter.show() -- 打开场景转换器SceneConverter.ConvertScene () -- Autodesk材质转化为物理材质SceneConverter.visible = false -- 关闭场景转换器-- 导出FBXmax select all; exportFile exportPath #noPrompt selectedOnly:true using:FBXEXP -- 将选择对象导出到FBXprint "导出完成: " + exportPath-- 重置max resetMaxFile #noPrompt )))
)
createdialog form 300 130 style:#(#style_titlebar, #style_border, #style_sysmenu, #style_minimizebox)