【发布时间】:2020-08-16 13:48:12
【问题描述】:
我可以使用搅拌机通过控制台将模型导出为 .fbx 格式吗?
类似:blender.exe myModel.blend --output model.fbx
【问题讨论】:
标签: model command-line-interface blender fbx
我可以使用搅拌机通过控制台将模型导出为 .fbx 格式吗?
类似:blender.exe myModel.blend --output model.fbx
【问题讨论】:
标签: model command-line-interface blender fbx
对于 Blender 2.90 及更高版本,此脚本将为您将场景导出为 FBX 文件。
export_fbx.py:
import bpy
import sys
print("Blender export scene in FBX Format in file "+sys.argv[-1])
# Doc can be found here: https://docs.blender.org/api/current/bpy.ops.export_scene.html
bpy.ops.export_scene.fbx(filepath=sys.argv[-1])
要使用搅拌机调用它,您可以使用以下命令:
blender <your_scene>.blend --background --python export_fbx.py -- <your_scene>.fbx
python 脚本是导出场景的最低要求。您可以将很多参数传递给export_scene.fbx() 函数,它不处理多个输入和输出文件。
【讨论】:
答案是肯定的,你可以,但以非平凡的方式。我的意思是,正如 Python 选项 中所说的here,您可以从命令行执行 python 脚本(作为文件或作为传递的字符串)。示例:
blender --background --python myscript.py
您的脚本将在--background 模式下执行 - 这意味着甚至无需打开 Blender GUI。所以你可以使用 Blender 作为导入导出模块。基本上,您可以通过这种方式使用 bpy 模块中的任何内容。玩得开心!
编辑
类似:blender.exe myModel.blend --output model.fbx
我提供的链接还包含 Blender 的所有其他命令行选项。至少我还没有在这里找到直接进出口选项。所以我认为你无论如何都需要编写python脚本。
【讨论】:
bpy。它是 blender python 库,可让您在代码中与 blender 进行通信。要使用 blender 运行 python 脚本,在你的 cmd 中输入:<path to blender> --background --python myscript.py。您需要传递您的搅拌机 exe 所在的路径,而不是