使用Python FBX SDK将.fbx转换为.obj

时间:2016-10-19 14:49:21

标签: python blender maya .obj fbx

我有一个动物行走的十帧.fbx文件。此文件包含带纹理的装配模型,但我只对每帧的模型网格感兴趣。

如何使用Python FBX SDK或Python Blender SDK将fbx文件的每一帧导出到obj文件中?

我接近这个错误的方式吗?我是否应该首先尝试在Maya / Blender中手动执行此操作?

1 个答案:

答案 0 :(得分:4)

它是fbx到obj的一个例子     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.fbx"

# 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.obj"

# Specify the path and name of the file to be imported                                                                            
exportstat = exporter.Initialize(save_path, -1)

exportstat = exporter.Export(scene)