Blender 可以根据文本文件生成场景吗?
我用 Python 编写了一个程序,它生成一个 10,000 个图块坐标平面,每个图块都具有纹理、温度、海拔等特征。我正在为一个项目执行此操作,并认为显示项目的这一部分的更好方法是展示它的 3D 渲染,我所知道的最好的程序是 Blender。我知道可以用 Python 为 Blender 编写脚本,但我不确定 Blender 如何根据我的 Python 程序写入的文本文件生成内容。如果有人知道 Blender 是否以及如何从文本文件生成内容或以任何其他方式将我的 Python 程序写入 Blender 将非常好!
〜谢谢
I have written a program in Python that generates a 10,000 tile coordinate plane with each tile having characteristics such as texture, temperature, elevation etc. I am doing this for a project and thought a much better way to show this part of the project would be to show a 3d rendering of it and the best program i know for that is Blender. I know scripts can be written in Python for Blender but I'm not sure how blender can generate things based off of a text file that my Python program writes to. If anyone knows if and how Blender can generate things from a text file or any other way i could have my Python program write to Blender would be excellent!
~ Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须为此编写一个 Python 脚本 - 它将读取您的文本文件并在内部使用 Blender API 来创建图块和场景。 Blender 只能渲染文件,如果它有程序(插件)可以做到这一点。实际上,大多数文件格式都可以被 Blender 读取,因为程序附带了用 Python 实现的插件。
或者,您可以调整生成场景的程序,除了生成文本文件之外,还可以使用其 API 在搅拌机内绘制场景。这种方法可能比编写单独的逻辑来解析您自己的文件更容易。
如果您的脚本是 Python2.x,则必须使用 Blender 2.49 - 因为 Blender 2.5 和更新版本使用 Python 3 进行脚本编写。
You will have to make a Python script for that - that would read your text file and use blender API internally to create the tiles and the scene. Blender can only render files if it does have programs (plug-ins) that do that. Actually most file-formats can be read by blender just due to plug-ins implemented in Python that are shipped with the program.
Alternatively, you can adapt your program that generates the scene to be able to, beyond generating the text file, to draw it inside blender using its API instead. This approach might be easier than writing a separate logic to parse your own file.
If your script is Python2.x you will have to use blender 2.49 - as Blender 2.5 and newer versions use Python 3 for scripting.