[Bf-python] Embedding Blender - XEmbed protocol

Goat Man goatman.py at gmail.com
Tue Jul 27 14:37:54 CEST 2010


Dietrich,
I'm developing this code as part of the process in porting
Pyppet<http://pyppet.blogspot.com/>to RPython and Blender2.5.  I have
just gotten bpy.ops to proxy from
RPython.
http://pastebin.com/TsYNqd8p

I found a bug in Blender253, pickle can only dump imported classes, and
builtin types.
But if you define your own class, and them dump an instance, the pickler
raises a attribute-lookup error.
The workaround i am using is sys.path.append('.') and then import the script
as a module, and calling a dump function..  But when the pickler loads the
dump, it seems like it gets dumped again.  Thats why in the pastebin demo
above two planes are created.


On Mon, Jul 26, 2010 at 5:52 AM, Dietrich Bollmann <diresu at web.de> wrote:

> Hi Goat Man :)
>
> On Sun, 2010-07-25 at 22:57 -0700, Goat Man wrote:
> > Thats pretty awesome Dietrich, i hope it finds its way into official
> > blender in some form.
>
> Thanks :)  But unfortunately it didn't find the way into the official
> blender version until now, as my approach to code everything from
> scratch was not appreciated and I still couldn't find the time to
> rewrite it using some library to get rid of my low-level stuff.  On the
> corresponding page on the blender patch tracker
>
> https://projects.blender.org/tracker/index.php?func=detail&aid=6887&group_id=9&atid=127is more information about why the patch was not integrated.
>
> I also would be happy to get some form of command port functionality
> integrated into blender, be it my code, some modified version of it
> using some message queue for example at the place of my low-level code
> or whatever other implementation somebody else has to offer.
>
> > But is your system one-way only?  How do you get return values from
> > functions back into, in your case emacs?
>
> It is two-way.  I temporarily redirect stdout and stderr into string
> buffers before evaluating the code and send them back to the client :)
>
> In emacs I use a slightly modified python mode and, at the place of the
> normal "python" command, wrap the blender shell client "blash".  This
> works as "blash" behaves the same way as a normal python shell.
>
> For my lisp client I translate lisp to python code strings when sending
> commands to blender and later parse the output of the shell and
> translate it back into lisp code (only the subset I need which is small:
> I basically code everything as python dictionaries which are interpreted
> on server side to generate the 3D models etc.).  Before switching to
> Blender I used the Maya command port which basically worked the same
> way.  That's where I got the idea to do it like this...
>
> If you are interested, you can read more about the simple protocol I use
> to send python code / get back the results (stdout and stderr) here:
> http://formgames.org/blender/command-port/#bcp-protocol
>
> When using the command port from python I have to generate the python
> command strings and parse the responses in the same way I described
> concerning my lisp client.  A "hello world" Python client is here:
> http://formgames.org/blender/command-port/#hello-world-python-client It
> would be much nicer of course to have a proxy bpy class generating the
> command port input and parsing the output as you wrote in your second
> email.
>
> Both links are for blender 2.4* as I couldn't find the time necessary to
> update the page yet, but the code for 2.5 is similar (using Python 3.1
> at the place of 2.5).
>
> > I'm working on a solution for getting return values, and doing
> > callbacks.  My target is RPython (PyPy), i haven't started on bpy yet
> > though, but i have gotten pygtk, pyode, and pygame partly working, so
> > i am sure the solution is general enough to handle bpy.
>
> That sounds and looks pretty awesome also :)  What do you intend to use
> your code for?
>
> Good luck (and fun of course), Dietrich
>
>
> > http://pastebin.com/rWEfgMSN
> > _______________________________________________
> > Bf-python mailing list
> > Bf-python at blender.org
> > http://lists.blender.org/mailman/listinfo/bf-python
>
>
> _______________________________________________
> Bf-python mailing list
> Bf-python at blender.org
> http://lists.blender.org/mailman/listinfo/bf-python
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.blender.org/pipermail/bf-python/attachments/20100727/db7097f7/attachment.html>


More information about the Bf-python mailing list