[Bf-python] threading needed for pyverse

Brecht Van Lommel blendix at pandora.be
Sun Nov 23 22:43:49 CET 2003


Hi,

Tom Dyar and I recently started working on python bindings for Verse.
With this project we are in the first place aiming at Blender, as you
might have guessed. I think it would be nice to have one or more python
scripts that connect Blender to Verse, to give the community a preview
of what Verse can do for Blender and to test the new Verse
implementation. Once we have working bindings it would be relatively
easy to make scripts that for example, enable users to collaborate on a
scene or add multiplayer capabilities to a game. Or maybe something like
the demo I showed at the Blender Conference:
http://users.pandora.be/blendix/verse/

But there is a problem. A Verse python script needs to check with the
server regularly for updates using the function verse_callback_update().
For this some kind of timeout function is needed. I think it is
currently impossible to this kind of thing, since (the module) threading
doesn't work, and an eternal while-loop will stop Blender from working.
If anyone knows a workaround, please tell me, but I think some extra
functionality would need to be added to the python implementation.

I see two possible solutions. First, you could modify the embedding
implementation by adding support for threading, as described in the
python C API (http://www.python.org/doc/2.3.2/api/threads.html). This
seems rather complicated to me, and I don't think I could code it. I
assume it might also interfere with Blender's mainloop. Another options
would be to provide a function that would allow the script to connect a
python function to some kind of timeout. I tried to make such a function
using Ghost's timeout function, but it broke some things in Blender and
caused random segfaults. I doesn't seem to be made for this sort of
thing, since it is only used for the automatic saves every x minutes.

I would appreciate any tips on this, and I would appreciate it even more
if someone could implement such functionality. I am willing to code this
myself, but I don't think I have enough overview of the Blender code to
do this.

Thanks in advance,
Brecht




More information about the Bf-python mailing list