简体   繁体   English

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

[英]How do you write commands in blender from a python script run outside blender?

I am trying to find a wat to add virices in a subprocess.Popen opened blender using the script that opened it to write the bpy codes into the blender proces. 我正在尝试找到一个在子进程中添加Vit的容器.Popen使用打开脚本的脚本打开了搅拌器,将bpy代码写入搅拌器过程。 If this isn't possible, is there a wat to make the blender python receive (through a script run in blender) messages from the python script run in terminal (I am using fedora) 如果无法做到这一点,是否有办法让Blender Python从终端中运行的python脚本(通过Blender中运行的脚本)接收消息(我使用的是fedora)

Thanks in advance 提前致谢

Indeed - you have thought half the answer for yourself - The blender modules won't be available from outside blender, but you can have a script inside blender to receive data from outside. 确实-您已经为自己解决了一半的问题-外部搅拌器无法使用搅拌器模块,但是您可以在搅拌器内部使用脚本来从外部接收数据。

The easiest way would be to use XMLRPC - use a script that loads with Blender, and stars a Python XMLRPC server - then you will be able to send commands into that script from outside. 最简单的方法是使用XMLRPC-使用随Blender加载的脚本,并为Python XMLRPC服务器加注星标-然后您将能够从外部向该脚本发送命令。

It is easier than it sounds - check the Python documentation for XMLRPC (it will even allow you to have python 2.7 scripts outside blender communicating with the Python 3 that runs inside blender) - 这比听起来容易得多-检查XMLRPC的Python文档(它甚至允许您在Blender外部让python 2.7脚本与在Blender内运行的Python 3通信)-

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM