gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-28 22:40:02 24 4
gpt4 key购买 nike

我试图找到一些 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())

关于python - 使用 Python FBX SDK 将 *.obj 转换为 *.fbx,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34132474/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com