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

3

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

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

我是不是走错了方法?我应该先尝试在Maya/Blender中手动完成这个任务吗?

1个回答

8
这是一个将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)

非常感谢你,@Ari。我稍后会测试一下,看看这个对我是否有效。非常感谢你的快速回复。 - pcpetepete
欢迎,我觉得你可能需要在这里和那里进行重构,但它应该能正常工作。 - Ari Gold
它运行得相当不错。然而,它为十个帧生成了一个输出文件。另外,@Ari,你有文档的链接吗? - pcpetepete
当然,您可以在这里找到所有所需的信息:http://download.autodesk.com/us/fbx/20112/FBX_SDK_HELP/index.html?url=WS73099cc142f48755-751de9951262947c01c-6dc7.htm,topicNumber=d0e8430 - Ari Gold

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接