[Bf-committers] blender command port - blender python server and client
Dietrich Bollmann
diresu at web.de
Wed Jun 27 05:57:19 CEST 2007
Hi,
The appended patch makes it possible to start Blender in Python server
mode. Clients can connect and send Python commands via the command
port to the server.
- The Command Port allows to edit objects simultaneously using the
Blender GUI and one or more clients connected to Blender via the
command port.
- The patch also includes `blash', a Blender Python shell client.
- `blash' can be used with the emacs python mode - the result is a
formidable Blender Python development environment.
- Clients can be written in any language: lisp, Python, Perl, C,
C++, Java etc.
- The patch was only tested on Debian sid until now but should run
on any platform after a little customisation.
For a screen shot see http://formgames.org/blender/command-port/
Have fun,
Dietrich
* Blender command port patch
-
https://projects.blender.org/tracker/index.php?func=detail&aid=6887&group_id=9&atid=127
* Example - a simple pyramid
The following example shows how the command port can be used to model
a simple pyramid:
- start the Blender server in some xterm
$ blender --geometry 800x600+10+10 --bcp 6789 &
- start blash in another xterm
$ blash --port 6789
This is Blash - the GNU BLender-Again SHell :)
Connection to Blender Server established. (IP address:
127.0.0.1, port: 6789)
- enter blender python commands
from Blender import *
vertexes = [[1, 1, 0], [-1, 1, 0], [-1, -1, 0], [1, -1, 0], [0, 0,
1.27]]
faces = [[3, 2, 1, 0], [0, 1, 4], [1, 2, 4], [2, 3, 4], [3, 0,
4]]
mesh = Mesh.New('mesh')
mesh.verts.extend(vertexes)
mesh.faces.extend(faces)
scene = Scene.GetCurrent()
object = scene.objects.new(mesh, 'object')
Redraw()
bye
* Installation
- make a directory to build Blender
BCP=$HOME/bcp
mkdir -p $BCP
cd $BCP
- download blender 2.44 sources
wget http://download.blender.org/source/blender-2.44.tar.gz
wget http://download.blender.org/source/blender-2.44.tar.gz.md5sum
md5sum -c blender-2.44.tar.gz.md5sum
- download blender command port patch
wget
http://formgames.org/blender/command-port/patches/blender-command-port-patch.2007-06-26.txt
- unpack the blender sources
gunzip blender-2.44.tar.gz
tar xvf blender-2.44.tar
- patch them
cd blender-2.44
patch -p0 < ../blender-command-port-patch.2007-06-26.txt
- build blash and blender
scons WITH_COMMAND_PORT=true blash
- the (linux) binaries
$BCP/install/linux2/blender
$BCP/install/linux2/blash
More information about the Bf-committers
mailing list