[Bf-python] Remote IPython & PyCrust Shell for Blender

Stani spe.stani.be at gmail.com
Mon Mar 17 23:08:53 CET 2008


Willian Padovani Germano schreef:
> Hi Stani,
>
> Stani wrote:
> (...)
>   
>> I am working on some new features for SPE, which is an open-source,
>> cross-platform python IDE for Blender:
>> http://pythonide.stani.be
>>     
> (...)
>   
>> However for normal Blender modeling (not Game Engine) I was wondering
>> which scriptlink I could use without blocking the user interface of
>> Blender. Is there some sort of timer event/scriptlink? Or is there a
>> better way to do this?
>>     
>
> Right now afaik there's no out of the box solution. No timer event 
> scriptlink yet, neither one for communication between processes, Verse 
> is not finished, etc. It shouldn't be hard to add a scriptlink for this 
> (for one system, making it work for all platforms might take more help), 
> only depends on finding a dev with interest and time to code it.
>   
Hi Willian,

I managed to have a work-around through a creative detour:
- link the socket server with a redraw scriptlink
- let my python shell (which is floating partly on top of the blender 
window) move one pixel back and forward for every command so that a 
redraw of blender is forced
(its a bit more complicated to prevent blocking)

It is a hack and proper support would be better, but it really works 
wonderfully. I can now simultaneously work in blender or in the python 
shell (with all the wistles and bells of auto-completion and calltips) 
on any drawing. It is a much better solution than how SPE was working 
before with Blender of which the user interface got totally blocked. 
This will be soon all available in a future version of SPE.
> Also, maybe threading can help. This occurred to me when I started 
> making bpython "thread-safe" a few weeks ago: we could add a new 
> function or make Blender.Run() support running the script in a separate 
> thread and this script could for example keep checking if an external 
> app has sent data to Blender. Didn't test it yet, though, will try to 
> play with it this week.
>   
In which Blender version could this be available? Threading for sure 
would help! If you are able to make threading work this will open tons 
of possibilities (server sockets, pyODE, better integration with 
ipython, ...). The nicest would be if the standard python threading 
module would just work. If that is impossible other solutions are 
welcome too, but please try to mimic the threading module api as that is 
what everyone knows.

One final note: it is really frustrating that it is impossible for 
scripts embedded in blender drawings (not the ones which are imported) 
that global variables don't work in the local scope. For example, this 
doesn't work:
import sys
def foo(x):
  print x, sys.platform

Right now I have to rewrite all my functions like:
import sys
def foo(x,sys=sys):
  print x, sys.platform

When I did some research on this, it was mentioned on this mailing list 
that a certain script which is loaded by blender, does all kind of 
namespace manipulation which causes this bug. (If I remember correctly, 
it was console.py) I think that such a script should be removed 
immediately from Blender as it causes a major regression. I wonder how 
people can code in Blender with such a hassle.

Thanks for your answer,
Stani

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.blender.org/pipermail/bf-python/attachments/20080317/c6680f9f/attachment.html>


More information about the Bf-python mailing list