简体   繁体   中英

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. 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)

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.

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) -

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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