使用 Python FBX SDK 将 *.obj 转换为 *.fbx
Convert *.obj to *.fbx with Python FBX SDK
我试图找到一些 Autodesk Python FBX SDK 的文档,但它似乎只适用于 C++ (http://help.autodesk.com/view/FBX/2015/ENU/?guid=__files_GUID_50489A8A_457C_4B54_80E1_5572A16F7F17_htm)。
有人知道如何使用 Python FBX SDK 将 *.obj 转换为 *.fbx 吗?
谢谢。
Python FBX SDK 缺少好的文档。以下是您可能如何让它发挥作用。
import fbx
# Create an SDK manager
manager = fbx.FbxManager.Create()
# Create a scene
scene = fbx.FbxScene.Create(manager, "")
# Create an importer object
importer = fbx.FbxImporter.Create(manager, "")
# Path to the .obj file
milfalcon = "samples/millenium-falcon/millenium-falcon.obj"
# Specify the path and name of the file to be imported
importstat = importer.Initialize(milfalcon, -1)
importstat = importer.Import(scene)
# Create an exporter object
exporter = fbx.FbxExporter.Create(manager, "")
save_path = "samples/millenium-falcon/millenium-falcon.fbx"
# Specify the path and name of the file to be imported
exportstat = exporter.Initialize(save_path, -1)
exportstat = exporter.Export(scene)
您可以选择设置导出(和导入)选项,即
ios = fbx.FbxIOSettings.Create(manager, fbx.IOSROOT)
manager.SetIOSettings(ios)
manager.GetIOSettings().SetBoolProp(fbx.EXP_FBX_SHAPE, False)
manager.GetIOSettings().SetBoolProp(fbx.EXP_FBX_GOBO, False)
exportstat = exporter.Initialize(save_path, -1, manager.GetIOSettings())
我试图找到一些 Autodesk Python FBX SDK 的文档,但它似乎只适用于 C++ (http://help.autodesk.com/view/FBX/2015/ENU/?guid=__files_GUID_50489A8A_457C_4B54_80E1_5572A16F7F17_htm)。
有人知道如何使用 Python FBX SDK 将 *.obj 转换为 *.fbx 吗?
谢谢。
Python FBX SDK 缺少好的文档。以下是您可能如何让它发挥作用。
import fbx
# Create an SDK manager
manager = fbx.FbxManager.Create()
# Create a scene
scene = fbx.FbxScene.Create(manager, "")
# Create an importer object
importer = fbx.FbxImporter.Create(manager, "")
# Path to the .obj file
milfalcon = "samples/millenium-falcon/millenium-falcon.obj"
# Specify the path and name of the file to be imported
importstat = importer.Initialize(milfalcon, -1)
importstat = importer.Import(scene)
# Create an exporter object
exporter = fbx.FbxExporter.Create(manager, "")
save_path = "samples/millenium-falcon/millenium-falcon.fbx"
# Specify the path and name of the file to be imported
exportstat = exporter.Initialize(save_path, -1)
exportstat = exporter.Export(scene)
您可以选择设置导出(和导入)选项,即
ios = fbx.FbxIOSettings.Create(manager, fbx.IOSROOT)
manager.SetIOSettings(ios)
manager.GetIOSettings().SetBoolProp(fbx.EXP_FBX_SHAPE, False)
manager.GetIOSettings().SetBoolProp(fbx.EXP_FBX_GOBO, False)
exportstat = exporter.Initialize(save_path, -1, manager.GetIOSettings())