python - 您如何从在 blender 外部运行的 python 脚本在 blender 中编写命令?

标签 python terminal subprocess blender bpy

我正试图找到一个在子进程中添加病毒的方法。Popen 使用打开它的脚本打开 blender ,将 bpy 代码写入 blender 进程。如果这不可能,是否有办法让 blender python 接收(通过 blender 中运行的脚本)来自终端中运行的 python 脚本的消息(我正在使用 fedora)

提前致谢

最佳答案

的确 - 你自己已经想好了一半的答案 - blender 模块将无法从外部 blender 获得,但是 你可以在 blender 中有一个脚本来接收来自外部的数据。

最简单的方法是使用 XMLRPC - 使用一个脚本 使用 Blender 加载,并启动 Python XMLRPC 服务器 - 那么您将能够从以下位置向该脚本发送命令 外面。

这比听起来容易 - 查看 Python 文档 对于 XMLRPC(它甚至可以让你拥有 python 2.7 脚本 与 Python 3 通信的外部搅拌器 在 blender 内运行)-

http://docs.python.org/3.3/library/xmlrpc.server.html#module-xmlrpc.server

关于python - 您如何从在 blender 外部运行的 python 脚本在 blender 中编写命令?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20809099/

相关文章:

python - 可以在一个文件中存储多个数据结构以进行保存和加载(python)吗?

javascript - Node.js 中的固定位置命令提示符

ruby-on-rails - 无法运行 Rails 服务器 : `require' : cannot load such file -- net/ssh (LoadError)

python - subprocess.call 在 PyCharm (linux) 中不工作

python - 在 python 中运行 shell 脚本

python - 在不安装模块的情况下从 Python 2.4 运行 MySQL 查询 (MySQLdb)

python - 带有西里尔符号的 pytest 3.0.5

python - 文本聚类/NLP

python - Pandas 中位数的奇怪行为

text - linux中根据名称对文本文件进行分组